Permalink
Cannot retrieve contributors at this time
25 lines (20 sloc)
729 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/es-abstract/2021/CreateDataPropertyOrThrow.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var GetIntrinsic = require('get-intrinsic'); | |
var $TypeError = GetIntrinsic('%TypeError%'); | |
var CreateDataProperty = require('./CreateDataProperty'); | |
var IsPropertyKey = require('./IsPropertyKey'); | |
var Type = require('./Type'); | |
// // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow | |
module.exports = function CreateDataPropertyOrThrow(O, P, V) { | |
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'); | |
} | |
var success = CreateDataProperty(O, P, V); | |
if (!success) { | |
throw new $TypeError('unable to create data property'); | |
} | |
return success; | |
}; |