source: frontend/node_modules/es-abstract/2024/DeletePropertyOrThrow.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 664 bytes
Line 
1'use strict';
2
3var $TypeError = require('es-errors/type');
4var isObject = require('es-object-atoms/isObject');
5
6var isPropertyKey = require('../helpers/isPropertyKey');
7
8// https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow
9
10module.exports = function DeletePropertyOrThrow(O, P) {
11 if (!isObject(O)) {
12 throw new $TypeError('Assertion failed: Type(O) is not Object');
13 }
14
15 if (!isPropertyKey(P)) {
16 throw new $TypeError('Assertion failed: P is not a Property Key');
17 }
18
19 // eslint-disable-next-line no-param-reassign
20 var success = delete O[P];
21 if (!success) {
22 throw new $TypeError('Attempt to delete property failed.');
23 }
24 return success;
25};
Note: See TracBrowser for help on using the repository browser.