Urara-Blog/node_modules/.pnpm-store/v3/files/ee/d3279e6f4a76d841356b7001346c4fa044935037c368d6dc93671867aabecfa94fc666f98b359a25dd56fcd4a35a216f81995772aee3689954f27989a490cd
2022-08-14 01:14:53 +08:00

27 lines
699 B
Text

'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow
module.exports = function DeletePropertyOrThrow(O, P) {
if (Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
// eslint-disable-next-line no-param-reassign
var success = delete O[P];
if (!success) {
throw new $TypeError('Attempt to delete property failed.');
}
return success;
};