From 783ee6e3b3fe50745907ec6a45d7f3fd11457c7a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 23 Apr 2024 09:53:46 -0700 Subject: [PATCH] [Refactor] create and use `helpers/isPropertyKey` --- 2015/CreateDataProperty.js | 6 +++--- 2015/CreateDataPropertyOrThrow.js | 6 +++--- 2015/CreateMethodProperty.js | 6 +++--- 2015/DefinePropertyOrThrow.js | 6 +++--- 2015/DeletePropertyOrThrow.js | 7 +++---- 2015/Get.js | 7 +++---- 2015/GetMethod.js | 6 +++--- 2015/GetV.js | 6 +++--- 2015/HasOwnProperty.js | 5 ++--- 2015/HasProperty.js | 5 ++--- 2015/Invoke.js | 4 ++-- 2015/IsPropertyKey.js | 4 +++- 2015/OrdinaryDefineOwnProperty.js | 4 ++-- 2015/OrdinaryGetOwnProperty.js | 4 ++-- 2015/OrdinaryHasProperty.js | 5 ++--- 2015/Set.js | 4 ++-- 2015/StringGetIndexProperty.js | 4 ++-- 2015/ValidateAndApplyPropertyDescriptor.js | 4 ++-- 2016/CreateDataProperty.js | 6 +++--- 2016/CreateDataPropertyOrThrow.js | 6 +++--- 2016/CreateMethodProperty.js | 6 +++--- 2016/DefinePropertyOrThrow.js | 6 +++--- 2016/DeletePropertyOrThrow.js | 7 +++---- 2016/Get.js | 7 +++---- 2016/GetMethod.js | 6 +++--- 2016/GetV.js | 6 +++--- 2016/HasOwnProperty.js | 5 ++--- 2016/HasProperty.js | 5 ++--- 2016/Invoke.js | 4 ++-- 2016/IsPropertyKey.js | 4 +++- 2016/OrdinaryDefineOwnProperty.js | 4 ++-- 2016/OrdinaryGetOwnProperty.js | 4 ++-- 2016/OrdinaryHasProperty.js | 5 ++--- 2016/Set.js | 4 ++-- 2016/ValidateAndApplyPropertyDescriptor.js | 4 ++-- 2017/CreateDataProperty.js | 6 +++--- 2017/CreateDataPropertyOrThrow.js | 6 +++--- 2017/CreateMethodProperty.js | 6 +++--- 2017/DefinePropertyOrThrow.js | 6 +++--- 2017/DeletePropertyOrThrow.js | 7 +++---- 2017/Get.js | 7 +++---- 2017/GetMethod.js | 6 +++--- 2017/GetV.js | 6 +++--- 2017/HasOwnProperty.js | 5 ++--- 2017/HasProperty.js | 5 ++--- 2017/Invoke.js | 4 ++-- 2017/IsPropertyKey.js | 4 +++- 2017/OrdinaryDefineOwnProperty.js | 4 ++-- 2017/OrdinaryGetOwnProperty.js | 4 ++-- 2017/OrdinaryHasProperty.js | 5 ++--- 2017/Set.js | 4 ++-- 2017/StringGetOwnProperty.js | 6 +++--- 2017/ValidateAndApplyPropertyDescriptor.js | 4 ++-- 2018/CopyDataProperties.js | 4 ++-- 2018/CreateDataProperty.js | 6 +++--- 2018/CreateDataPropertyOrThrow.js | 6 +++--- 2018/CreateMethodProperty.js | 6 +++--- 2018/DefinePropertyOrThrow.js | 6 +++--- 2018/DeletePropertyOrThrow.js | 7 +++---- 2018/Get.js | 7 +++---- 2018/GetMethod.js | 6 +++--- 2018/GetV.js | 6 +++--- 2018/HasOwnProperty.js | 5 ++--- 2018/HasProperty.js | 5 ++--- 2018/Invoke.js | 4 ++-- 2018/IsPropertyKey.js | 4 +++- 2018/OrdinaryDefineOwnProperty.js | 4 ++-- 2018/OrdinaryGetOwnProperty.js | 4 ++-- 2018/OrdinaryHasProperty.js | 5 ++--- 2018/Set.js | 4 ++-- 2018/StringGetOwnProperty.js | 6 +++--- 2018/ValidateAndApplyPropertyDescriptor.js | 4 ++-- 2019/CopyDataProperties.js | 4 ++-- 2019/CreateDataProperty.js | 6 +++--- 2019/CreateDataPropertyOrThrow.js | 6 +++--- 2019/CreateMethodProperty.js | 6 +++--- 2019/DefinePropertyOrThrow.js | 6 +++--- 2019/DeletePropertyOrThrow.js | 7 +++---- 2019/Get.js | 7 +++---- 2019/GetMethod.js | 6 +++--- 2019/GetV.js | 6 +++--- 2019/HasOwnProperty.js | 5 ++--- 2019/HasProperty.js | 5 ++--- 2019/Invoke.js | 4 ++-- 2019/IsPropertyKey.js | 4 +++- 2019/OrdinaryDefineOwnProperty.js | 4 ++-- 2019/OrdinaryGetOwnProperty.js | 4 ++-- 2019/OrdinaryHasProperty.js | 5 ++--- 2019/Set.js | 4 ++-- 2019/StringGetOwnProperty.js | 6 +++--- 2019/ValidateAndApplyPropertyDescriptor.js | 4 ++-- 2020/CopyDataProperties.js | 4 ++-- 2020/CreateDataProperty.js | 6 +++--- 2020/CreateDataPropertyOrThrow.js | 6 +++--- 2020/CreateMethodProperty.js | 6 +++--- 2020/DefinePropertyOrThrow.js | 6 +++--- 2020/DeletePropertyOrThrow.js | 7 +++---- 2020/Get.js | 7 +++---- 2020/GetMethod.js | 6 +++--- 2020/GetV.js | 6 +++--- 2020/HasOwnProperty.js | 5 ++--- 2020/HasProperty.js | 5 ++--- 2020/Invoke.js | 4 ++-- 2020/IsPropertyKey.js | 4 +++- 2020/OrdinaryDefineOwnProperty.js | 4 ++-- 2020/OrdinaryGetOwnProperty.js | 4 ++-- 2020/OrdinaryHasProperty.js | 5 ++--- 2020/Set.js | 4 ++-- 2020/StringGetOwnProperty.js | 6 +++--- 2020/ValidateAndApplyPropertyDescriptor.js | 4 ++-- 2021/CopyDataProperties.js | 4 ++-- 2021/CreateDataProperty.js | 6 +++--- 2021/CreateDataPropertyOrThrow.js | 6 +++--- 2021/CreateMethodProperty.js | 6 +++--- 2021/DefinePropertyOrThrow.js | 6 +++--- 2021/DeletePropertyOrThrow.js | 7 +++---- 2021/Get.js | 7 +++---- 2021/GetMethod.js | 6 +++--- 2021/GetV.js | 6 +++--- 2021/HasOwnProperty.js | 5 ++--- 2021/HasProperty.js | 5 ++--- 2021/Invoke.js | 4 ++-- 2021/IsPropertyKey.js | 4 +++- 2021/OrdinaryDefineOwnProperty.js | 4 ++-- 2021/OrdinaryGetOwnProperty.js | 4 ++-- 2021/OrdinaryHasProperty.js | 5 ++--- 2021/Set.js | 4 ++-- 2021/StringGetOwnProperty.js | 6 +++--- 2021/ValidateAndApplyPropertyDescriptor.js | 4 ++-- 2022/CopyDataProperties.js | 4 ++-- 2022/CreateDataProperty.js | 6 +++--- 2022/CreateDataPropertyOrThrow.js | 6 +++--- 2022/CreateMethodProperty.js | 6 +++--- 2022/CreateNonEnumerableDataPropertyOrThrow.js | 6 +++--- 2022/DefineMethodProperty.js | 4 ++-- 2022/DefinePropertyOrThrow.js | 6 +++--- 2022/DeletePropertyOrThrow.js | 7 +++---- 2022/Get.js | 7 +++---- 2022/GetMethod.js | 6 +++--- 2022/GetV.js | 6 +++--- 2022/HasOwnProperty.js | 5 ++--- 2022/HasProperty.js | 5 ++--- 2022/Invoke.js | 4 ++-- 2022/IsPropertyKey.js | 4 +++- 2022/OrdinaryDefineOwnProperty.js | 4 ++-- 2022/OrdinaryGetOwnProperty.js | 4 ++-- 2022/OrdinaryHasProperty.js | 5 ++--- 2022/Set.js | 4 ++-- 2022/StringGetOwnProperty.js | 6 +++--- 2022/ValidateAndApplyPropertyDescriptor.js | 4 ++-- 2023/CopyDataProperties.js | 4 ++-- 2023/CreateDataProperty.js | 6 +++--- 2023/CreateDataPropertyOrThrow.js | 6 +++--- 2023/CreateMethodProperty.js | 6 +++--- 2023/CreateNonEnumerableDataPropertyOrThrow.js | 6 +++--- 2023/DefineMethodProperty.js | 4 ++-- 2023/DefinePropertyOrThrow.js | 6 +++--- 2023/DeletePropertyOrThrow.js | 7 +++---- 2023/Get.js | 7 +++---- 2023/GetMethod.js | 6 +++--- 2023/GetV.js | 6 +++--- 2023/HasOwnProperty.js | 5 ++--- 2023/HasProperty.js | 5 ++--- 2023/Invoke.js | 4 ++-- 2023/IsPropertyKey.js | 4 +++- 2023/OrdinaryDefineOwnProperty.js | 4 ++-- 2023/OrdinaryGetOwnProperty.js | 4 ++-- 2023/OrdinaryHasProperty.js | 5 ++--- 2023/Set.js | 4 ++-- 2023/StringGetOwnProperty.js | 6 +++--- 2023/ValidateAndApplyPropertyDescriptor.js | 4 ++-- 2024/CopyDataProperties.js | 4 ++-- 2024/CreateDataProperty.js | 6 +++--- 2024/CreateDataPropertyOrThrow.js | 6 +++--- 2024/CreateNonEnumerableDataPropertyOrThrow.js | 6 +++--- 2024/DefineMethodProperty.js | 4 ++-- 2024/DefinePropertyOrThrow.js | 6 +++--- 2024/DeletePropertyOrThrow.js | 7 +++---- 2024/Get.js | 7 +++---- 2024/GetMethod.js | 6 +++--- 2024/GetV.js | 6 +++--- 2024/HasOwnProperty.js | 5 ++--- 2024/HasProperty.js | 5 ++--- 2024/Invoke.js | 4 ++-- 2024/IsPropertyKey.js | 4 +++- 2024/OrdinaryDefineOwnProperty.js | 4 ++-- 2024/OrdinaryGetOwnProperty.js | 4 ++-- 2024/OrdinaryHasProperty.js | 5 ++--- 2024/Set.js | 4 ++-- 2024/StringGetOwnProperty.js | 6 +++--- 2024/ValidateAndApplyPropertyDescriptor.js | 4 ++-- helpers/isPropertyKey.js | 5 +++++ 192 files changed, 487 insertions(+), 512 deletions(-) create mode 100644 helpers/isPropertyKey.js diff --git a/2015/CreateDataProperty.js b/2015/CreateDataProperty.js index 5da45cdd..f0108393 100644 --- a/2015/CreateDataProperty.js +++ b/2015/CreateDataProperty.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var isObject = require('../helpers/isObject'); @@ -13,8 +13,8 @@ module.exports = function CreateDataProperty(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { '[[Configurable]]': true, diff --git a/2015/CreateDataPropertyOrThrow.js b/2015/CreateDataPropertyOrThrow.js index 494e92eb..64083f09 100644 --- a/2015/CreateDataPropertyOrThrow.js +++ b/2015/CreateDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var CreateDataProperty = require('./CreateDataProperty'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow @@ -13,8 +13,8 @@ module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var success = CreateDataProperty(O, P, V); if (!success) { diff --git a/2015/CreateMethodProperty.js b/2015/CreateMethodProperty.js index 22eb4416..f5cd757e 100644 --- a/2015/CreateMethodProperty.js +++ b/2015/CreateMethodProperty.js @@ -6,7 +6,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -18,8 +18,8 @@ module.exports = function CreateMethodProperty(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2015/DefinePropertyOrThrow.js b/2015/DefinePropertyOrThrow.js index a2355b09..d25110ab 100644 --- a/2015/DefinePropertyOrThrow.js +++ b/2015/DefinePropertyOrThrow.js @@ -7,7 +7,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -20,8 +20,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc); diff --git a/2015/DeletePropertyOrThrow.js b/2015/DeletePropertyOrThrow.js index 07ac40cb..8f9b58c0 100644 --- a/2015/DeletePropertyOrThrow.js +++ b/2015/DeletePropertyOrThrow.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow @@ -13,8 +12,8 @@ module.exports = function DeletePropertyOrThrow(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // eslint-disable-next-line no-param-reassign diff --git a/2015/Get.js b/2015/Get.js index 12e65bd8..cfd7061c 100644 --- a/2015/Get.js +++ b/2015/Get.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-get-o-p @@ -16,8 +15,8 @@ module.exports = function Get(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } // 7.3.1.2 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.1.3 return O[P]; diff --git a/2015/GetMethod.js b/2015/GetMethod.js index 1c2ee9ef..e28bb150 100644 --- a/2015/GetMethod.js +++ b/2015/GetMethod.js @@ -4,7 +4,7 @@ var $TypeError = require('es-errors/type'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var inspect = require('object-inspect'); @@ -12,8 +12,8 @@ var inspect = require('object-inspect'); module.exports = function GetMethod(O, P) { // 7.3.9.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // 7.3.9.2 diff --git a/2015/GetV.js b/2015/GetV.js index 81d2f1e1..920dec3c 100644 --- a/2015/GetV.js +++ b/2015/GetV.js @@ -4,15 +4,15 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // var ToObject = require('./ToObject'); // https://262.ecma-international.org/6.0/#sec-getv module.exports = function GetV(V, P) { // 7.3.2.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.2.2-3 diff --git a/2015/HasOwnProperty.js b/2015/HasOwnProperty.js index daed1d53..cea2172f 100644 --- a/2015/HasOwnProperty.js +++ b/2015/HasOwnProperty.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var hasOwn = require('hasown'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasownproperty @@ -14,7 +13,7 @@ module.exports = function HasOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return hasOwn(O, P); diff --git a/2015/HasProperty.js b/2015/HasProperty.js index 00514a3b..037c8550 100644 --- a/2015/HasProperty.js +++ b/2015/HasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasproperty @@ -12,7 +11,7 @@ module.exports = function HasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; diff --git a/2015/Invoke.js b/2015/Invoke.js index 6c2426ff..57bca8eb 100644 --- a/2015/Invoke.js +++ b/2015/Invoke.js @@ -5,12 +5,12 @@ var $TypeError = require('es-errors/type'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-invoke module.exports = function Invoke(O, P) { - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; diff --git a/2015/IsPropertyKey.js b/2015/IsPropertyKey.js index aaeb6f9b..4b1c9c71 100644 --- a/2015/IsPropertyKey.js +++ b/2015/IsPropertyKey.js @@ -1,7 +1,9 @@ 'use strict'; +var isPropertyKey = require('../helpers/isPropertyKey'); + // https://262.ecma-international.org/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { - return typeof argument === 'string' || typeof argument === 'symbol'; + return isPropertyKey(argument); }; diff --git a/2015/OrdinaryDefineOwnProperty.js b/2015/OrdinaryDefineOwnProperty.js index 29941a3e..cad4aa08 100644 --- a/2015/OrdinaryDefineOwnProperty.js +++ b/2015/OrdinaryDefineOwnProperty.js @@ -8,7 +8,7 @@ var isPropertyDescriptor = require('../helpers/records/property-descriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); @@ -21,7 +21,7 @@ module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor(Desc)) { diff --git a/2015/OrdinaryGetOwnProperty.js b/2015/OrdinaryGetOwnProperty.js index efdd5b1d..4a8c16b3 100644 --- a/2015/OrdinaryGetOwnProperty.js +++ b/2015/OrdinaryGetOwnProperty.js @@ -10,7 +10,7 @@ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var hasOwn = require('hasown'); var IsArray = require('./IsArray'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -22,7 +22,7 @@ module.exports = function OrdinaryGetOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!hasOwn(O, P)) { diff --git a/2015/OrdinaryHasProperty.js b/2015/OrdinaryHasProperty.js index 978382ee..9e7ac616 100644 --- a/2015/OrdinaryHasProperty.js +++ b/2015/OrdinaryHasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty @@ -12,7 +11,7 @@ module.exports = function OrdinaryHasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; diff --git a/2015/Set.js b/2015/Set.js index 9ab8a29e..b6311f85 100644 --- a/2015/Set.js +++ b/2015/Set.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -23,7 +23,7 @@ module.exports = function Set(O, P, V, Throw) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (typeof Throw !== 'boolean') { diff --git a/2015/StringGetIndexProperty.js b/2015/StringGetIndexProperty.js index b058d16b..f40cd23e 100644 --- a/2015/StringGetIndexProperty.js +++ b/2015/StringGetIndexProperty.js @@ -12,7 +12,7 @@ var unbox = require('unbox-primitive'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsInteger = require('./IsInteger'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-stringgetindexproperty @@ -20,7 +20,7 @@ module.exports = function StringGetIndexProperty(S, P) { if (typeof S === 'string' || !isString(S)) { throw new $TypeError('Assertion failed: `S` must be a boxed String Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } diff --git a/2015/ValidateAndApplyPropertyDescriptor.js b/2015/ValidateAndApplyPropertyDescriptor.js index 50de9899..46ca26ce 100644 --- a/2015/ValidateAndApplyPropertyDescriptor.js +++ b/2015/ValidateAndApplyPropertyDescriptor.js @@ -10,7 +10,7 @@ var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -33,7 +33,7 @@ module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, D if (typeof current !== 'undefined' && !isPropertyDescriptor(current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } - if (typeof O !== 'undefined' && !IsPropertyKey(P)) { + if (typeof O !== 'undefined' && !isPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (typeof current === 'undefined') { diff --git a/2016/CreateDataProperty.js b/2016/CreateDataProperty.js index 5da45cdd..f0108393 100644 --- a/2016/CreateDataProperty.js +++ b/2016/CreateDataProperty.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var isObject = require('../helpers/isObject'); @@ -13,8 +13,8 @@ module.exports = function CreateDataProperty(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { '[[Configurable]]': true, diff --git a/2016/CreateDataPropertyOrThrow.js b/2016/CreateDataPropertyOrThrow.js index 494e92eb..64083f09 100644 --- a/2016/CreateDataPropertyOrThrow.js +++ b/2016/CreateDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var CreateDataProperty = require('./CreateDataProperty'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow @@ -13,8 +13,8 @@ module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var success = CreateDataProperty(O, P, V); if (!success) { diff --git a/2016/CreateMethodProperty.js b/2016/CreateMethodProperty.js index 22eb4416..f5cd757e 100644 --- a/2016/CreateMethodProperty.js +++ b/2016/CreateMethodProperty.js @@ -6,7 +6,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -18,8 +18,8 @@ module.exports = function CreateMethodProperty(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2016/DefinePropertyOrThrow.js b/2016/DefinePropertyOrThrow.js index a2355b09..d25110ab 100644 --- a/2016/DefinePropertyOrThrow.js +++ b/2016/DefinePropertyOrThrow.js @@ -7,7 +7,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -20,8 +20,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc); diff --git a/2016/DeletePropertyOrThrow.js b/2016/DeletePropertyOrThrow.js index 07ac40cb..8f9b58c0 100644 --- a/2016/DeletePropertyOrThrow.js +++ b/2016/DeletePropertyOrThrow.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow @@ -13,8 +12,8 @@ module.exports = function DeletePropertyOrThrow(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // eslint-disable-next-line no-param-reassign diff --git a/2016/Get.js b/2016/Get.js index 12e65bd8..cfd7061c 100644 --- a/2016/Get.js +++ b/2016/Get.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-get-o-p @@ -16,8 +15,8 @@ module.exports = function Get(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } // 7.3.1.2 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.1.3 return O[P]; diff --git a/2016/GetMethod.js b/2016/GetMethod.js index 1c2ee9ef..e28bb150 100644 --- a/2016/GetMethod.js +++ b/2016/GetMethod.js @@ -4,7 +4,7 @@ var $TypeError = require('es-errors/type'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var inspect = require('object-inspect'); @@ -12,8 +12,8 @@ var inspect = require('object-inspect'); module.exports = function GetMethod(O, P) { // 7.3.9.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // 7.3.9.2 diff --git a/2016/GetV.js b/2016/GetV.js index 81d2f1e1..920dec3c 100644 --- a/2016/GetV.js +++ b/2016/GetV.js @@ -4,15 +4,15 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // var ToObject = require('./ToObject'); // https://262.ecma-international.org/6.0/#sec-getv module.exports = function GetV(V, P) { // 7.3.2.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.2.2-3 diff --git a/2016/HasOwnProperty.js b/2016/HasOwnProperty.js index daed1d53..cea2172f 100644 --- a/2016/HasOwnProperty.js +++ b/2016/HasOwnProperty.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var hasOwn = require('hasown'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasownproperty @@ -14,7 +13,7 @@ module.exports = function HasOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return hasOwn(O, P); diff --git a/2016/HasProperty.js b/2016/HasProperty.js index 00514a3b..037c8550 100644 --- a/2016/HasProperty.js +++ b/2016/HasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasproperty @@ -12,7 +11,7 @@ module.exports = function HasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; diff --git a/2016/Invoke.js b/2016/Invoke.js index 6c2426ff..57bca8eb 100644 --- a/2016/Invoke.js +++ b/2016/Invoke.js @@ -5,12 +5,12 @@ var $TypeError = require('es-errors/type'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-invoke module.exports = function Invoke(O, P) { - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; diff --git a/2016/IsPropertyKey.js b/2016/IsPropertyKey.js index aaeb6f9b..4b1c9c71 100644 --- a/2016/IsPropertyKey.js +++ b/2016/IsPropertyKey.js @@ -1,7 +1,9 @@ 'use strict'; +var isPropertyKey = require('../helpers/isPropertyKey'); + // https://262.ecma-international.org/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { - return typeof argument === 'string' || typeof argument === 'symbol'; + return isPropertyKey(argument); }; diff --git a/2016/OrdinaryDefineOwnProperty.js b/2016/OrdinaryDefineOwnProperty.js index 29941a3e..cad4aa08 100644 --- a/2016/OrdinaryDefineOwnProperty.js +++ b/2016/OrdinaryDefineOwnProperty.js @@ -8,7 +8,7 @@ var isPropertyDescriptor = require('../helpers/records/property-descriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); @@ -21,7 +21,7 @@ module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor(Desc)) { diff --git a/2016/OrdinaryGetOwnProperty.js b/2016/OrdinaryGetOwnProperty.js index efdd5b1d..4a8c16b3 100644 --- a/2016/OrdinaryGetOwnProperty.js +++ b/2016/OrdinaryGetOwnProperty.js @@ -10,7 +10,7 @@ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var hasOwn = require('hasown'); var IsArray = require('./IsArray'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -22,7 +22,7 @@ module.exports = function OrdinaryGetOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!hasOwn(O, P)) { diff --git a/2016/OrdinaryHasProperty.js b/2016/OrdinaryHasProperty.js index 978382ee..9e7ac616 100644 --- a/2016/OrdinaryHasProperty.js +++ b/2016/OrdinaryHasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty @@ -12,7 +11,7 @@ module.exports = function OrdinaryHasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; diff --git a/2016/Set.js b/2016/Set.js index 9ab8a29e..b6311f85 100644 --- a/2016/Set.js +++ b/2016/Set.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -23,7 +23,7 @@ module.exports = function Set(O, P, V, Throw) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (typeof Throw !== 'boolean') { diff --git a/2016/ValidateAndApplyPropertyDescriptor.js b/2016/ValidateAndApplyPropertyDescriptor.js index 50de9899..46ca26ce 100644 --- a/2016/ValidateAndApplyPropertyDescriptor.js +++ b/2016/ValidateAndApplyPropertyDescriptor.js @@ -10,7 +10,7 @@ var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -33,7 +33,7 @@ module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, D if (typeof current !== 'undefined' && !isPropertyDescriptor(current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } - if (typeof O !== 'undefined' && !IsPropertyKey(P)) { + if (typeof O !== 'undefined' && !isPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (typeof current === 'undefined') { diff --git a/2017/CreateDataProperty.js b/2017/CreateDataProperty.js index 5da45cdd..f0108393 100644 --- a/2017/CreateDataProperty.js +++ b/2017/CreateDataProperty.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var isObject = require('../helpers/isObject'); @@ -13,8 +13,8 @@ module.exports = function CreateDataProperty(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { '[[Configurable]]': true, diff --git a/2017/CreateDataPropertyOrThrow.js b/2017/CreateDataPropertyOrThrow.js index 494e92eb..64083f09 100644 --- a/2017/CreateDataPropertyOrThrow.js +++ b/2017/CreateDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var CreateDataProperty = require('./CreateDataProperty'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow @@ -13,8 +13,8 @@ module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var success = CreateDataProperty(O, P, V); if (!success) { diff --git a/2017/CreateMethodProperty.js b/2017/CreateMethodProperty.js index 22eb4416..f5cd757e 100644 --- a/2017/CreateMethodProperty.js +++ b/2017/CreateMethodProperty.js @@ -6,7 +6,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -18,8 +18,8 @@ module.exports = function CreateMethodProperty(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2017/DefinePropertyOrThrow.js b/2017/DefinePropertyOrThrow.js index a2355b09..d25110ab 100644 --- a/2017/DefinePropertyOrThrow.js +++ b/2017/DefinePropertyOrThrow.js @@ -7,7 +7,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -20,8 +20,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc); diff --git a/2017/DeletePropertyOrThrow.js b/2017/DeletePropertyOrThrow.js index 07ac40cb..8f9b58c0 100644 --- a/2017/DeletePropertyOrThrow.js +++ b/2017/DeletePropertyOrThrow.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow @@ -13,8 +12,8 @@ module.exports = function DeletePropertyOrThrow(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // eslint-disable-next-line no-param-reassign diff --git a/2017/Get.js b/2017/Get.js index 12e65bd8..cfd7061c 100644 --- a/2017/Get.js +++ b/2017/Get.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-get-o-p @@ -16,8 +15,8 @@ module.exports = function Get(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } // 7.3.1.2 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.1.3 return O[P]; diff --git a/2017/GetMethod.js b/2017/GetMethod.js index 1c2ee9ef..e28bb150 100644 --- a/2017/GetMethod.js +++ b/2017/GetMethod.js @@ -4,7 +4,7 @@ var $TypeError = require('es-errors/type'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var inspect = require('object-inspect'); @@ -12,8 +12,8 @@ var inspect = require('object-inspect'); module.exports = function GetMethod(O, P) { // 7.3.9.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // 7.3.9.2 diff --git a/2017/GetV.js b/2017/GetV.js index 81d2f1e1..920dec3c 100644 --- a/2017/GetV.js +++ b/2017/GetV.js @@ -4,15 +4,15 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // var ToObject = require('./ToObject'); // https://262.ecma-international.org/6.0/#sec-getv module.exports = function GetV(V, P) { // 7.3.2.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.2.2-3 diff --git a/2017/HasOwnProperty.js b/2017/HasOwnProperty.js index daed1d53..cea2172f 100644 --- a/2017/HasOwnProperty.js +++ b/2017/HasOwnProperty.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var hasOwn = require('hasown'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasownproperty @@ -14,7 +13,7 @@ module.exports = function HasOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return hasOwn(O, P); diff --git a/2017/HasProperty.js b/2017/HasProperty.js index 00514a3b..037c8550 100644 --- a/2017/HasProperty.js +++ b/2017/HasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasproperty @@ -12,7 +11,7 @@ module.exports = function HasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; diff --git a/2017/Invoke.js b/2017/Invoke.js index 6c2426ff..57bca8eb 100644 --- a/2017/Invoke.js +++ b/2017/Invoke.js @@ -5,12 +5,12 @@ var $TypeError = require('es-errors/type'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-invoke module.exports = function Invoke(O, P) { - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; diff --git a/2017/IsPropertyKey.js b/2017/IsPropertyKey.js index aaeb6f9b..4b1c9c71 100644 --- a/2017/IsPropertyKey.js +++ b/2017/IsPropertyKey.js @@ -1,7 +1,9 @@ 'use strict'; +var isPropertyKey = require('../helpers/isPropertyKey'); + // https://262.ecma-international.org/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { - return typeof argument === 'string' || typeof argument === 'symbol'; + return isPropertyKey(argument); }; diff --git a/2017/OrdinaryDefineOwnProperty.js b/2017/OrdinaryDefineOwnProperty.js index 29941a3e..cad4aa08 100644 --- a/2017/OrdinaryDefineOwnProperty.js +++ b/2017/OrdinaryDefineOwnProperty.js @@ -8,7 +8,7 @@ var isPropertyDescriptor = require('../helpers/records/property-descriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); @@ -21,7 +21,7 @@ module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor(Desc)) { diff --git a/2017/OrdinaryGetOwnProperty.js b/2017/OrdinaryGetOwnProperty.js index efdd5b1d..4a8c16b3 100644 --- a/2017/OrdinaryGetOwnProperty.js +++ b/2017/OrdinaryGetOwnProperty.js @@ -10,7 +10,7 @@ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var hasOwn = require('hasown'); var IsArray = require('./IsArray'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -22,7 +22,7 @@ module.exports = function OrdinaryGetOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!hasOwn(O, P)) { diff --git a/2017/OrdinaryHasProperty.js b/2017/OrdinaryHasProperty.js index 978382ee..9e7ac616 100644 --- a/2017/OrdinaryHasProperty.js +++ b/2017/OrdinaryHasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty @@ -12,7 +11,7 @@ module.exports = function OrdinaryHasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; diff --git a/2017/Set.js b/2017/Set.js index 9ab8a29e..b6311f85 100644 --- a/2017/Set.js +++ b/2017/Set.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -23,7 +23,7 @@ module.exports = function Set(O, P, V, Throw) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (typeof Throw !== 'boolean') { diff --git a/2017/StringGetOwnProperty.js b/2017/StringGetOwnProperty.js index a7f46521..62f61e59 100644 --- a/2017/StringGetOwnProperty.js +++ b/2017/StringGetOwnProperty.js @@ -8,9 +8,9 @@ var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsInteger = require('./IsInteger'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); var isNegativeZero = require('math-intrinsics/isNegativeZero'); @@ -26,8 +26,8 @@ module.exports = function StringGetOwnProperty(S, P) { if (typeof str !== 'string') { throw new $TypeError('Assertion failed: `S` must be a boxed string object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } if (typeof P !== 'string') { return void undefined; diff --git a/2017/ValidateAndApplyPropertyDescriptor.js b/2017/ValidateAndApplyPropertyDescriptor.js index 50de9899..46ca26ce 100644 --- a/2017/ValidateAndApplyPropertyDescriptor.js +++ b/2017/ValidateAndApplyPropertyDescriptor.js @@ -10,7 +10,7 @@ var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -33,7 +33,7 @@ module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, D if (typeof current !== 'undefined' && !isPropertyDescriptor(current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } - if (typeof O !== 'undefined' && !IsPropertyKey(P)) { + if (typeof O !== 'undefined' && !isPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (typeof current === 'undefined') { diff --git a/2018/CopyDataProperties.js b/2018/CopyDataProperties.js index b6ab07f5..56888f4e 100644 --- a/2018/CopyDataProperties.js +++ b/2018/CopyDataProperties.js @@ -12,7 +12,7 @@ var CreateDataProperty = require('./CreateDataProperty'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); @@ -30,7 +30,7 @@ module.exports = function CopyDataProperties(target, source, excludedItems) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } for (var i = 0; i < excludedItems.length; i += 1) { - if (!IsPropertyKey(excludedItems[i])) { + if (!isPropertyKey(excludedItems[i])) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } } diff --git a/2018/CreateDataProperty.js b/2018/CreateDataProperty.js index 5da45cdd..f0108393 100644 --- a/2018/CreateDataProperty.js +++ b/2018/CreateDataProperty.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var isObject = require('../helpers/isObject'); @@ -13,8 +13,8 @@ module.exports = function CreateDataProperty(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { '[[Configurable]]': true, diff --git a/2018/CreateDataPropertyOrThrow.js b/2018/CreateDataPropertyOrThrow.js index 494e92eb..64083f09 100644 --- a/2018/CreateDataPropertyOrThrow.js +++ b/2018/CreateDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var CreateDataProperty = require('./CreateDataProperty'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow @@ -13,8 +13,8 @@ module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var success = CreateDataProperty(O, P, V); if (!success) { diff --git a/2018/CreateMethodProperty.js b/2018/CreateMethodProperty.js index 22eb4416..f5cd757e 100644 --- a/2018/CreateMethodProperty.js +++ b/2018/CreateMethodProperty.js @@ -6,7 +6,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -18,8 +18,8 @@ module.exports = function CreateMethodProperty(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2018/DefinePropertyOrThrow.js b/2018/DefinePropertyOrThrow.js index a2355b09..d25110ab 100644 --- a/2018/DefinePropertyOrThrow.js +++ b/2018/DefinePropertyOrThrow.js @@ -7,7 +7,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -20,8 +20,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc); diff --git a/2018/DeletePropertyOrThrow.js b/2018/DeletePropertyOrThrow.js index 07ac40cb..8f9b58c0 100644 --- a/2018/DeletePropertyOrThrow.js +++ b/2018/DeletePropertyOrThrow.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow @@ -13,8 +12,8 @@ module.exports = function DeletePropertyOrThrow(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // eslint-disable-next-line no-param-reassign diff --git a/2018/Get.js b/2018/Get.js index 12e65bd8..cfd7061c 100644 --- a/2018/Get.js +++ b/2018/Get.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-get-o-p @@ -16,8 +15,8 @@ module.exports = function Get(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } // 7.3.1.2 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.1.3 return O[P]; diff --git a/2018/GetMethod.js b/2018/GetMethod.js index 1c2ee9ef..e28bb150 100644 --- a/2018/GetMethod.js +++ b/2018/GetMethod.js @@ -4,7 +4,7 @@ var $TypeError = require('es-errors/type'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var inspect = require('object-inspect'); @@ -12,8 +12,8 @@ var inspect = require('object-inspect'); module.exports = function GetMethod(O, P) { // 7.3.9.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // 7.3.9.2 diff --git a/2018/GetV.js b/2018/GetV.js index 81d2f1e1..920dec3c 100644 --- a/2018/GetV.js +++ b/2018/GetV.js @@ -4,15 +4,15 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // var ToObject = require('./ToObject'); // https://262.ecma-international.org/6.0/#sec-getv module.exports = function GetV(V, P) { // 7.3.2.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.2.2-3 diff --git a/2018/HasOwnProperty.js b/2018/HasOwnProperty.js index daed1d53..cea2172f 100644 --- a/2018/HasOwnProperty.js +++ b/2018/HasOwnProperty.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var hasOwn = require('hasown'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasownproperty @@ -14,7 +13,7 @@ module.exports = function HasOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return hasOwn(O, P); diff --git a/2018/HasProperty.js b/2018/HasProperty.js index 00514a3b..037c8550 100644 --- a/2018/HasProperty.js +++ b/2018/HasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasproperty @@ -12,7 +11,7 @@ module.exports = function HasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; diff --git a/2018/Invoke.js b/2018/Invoke.js index 6c2426ff..57bca8eb 100644 --- a/2018/Invoke.js +++ b/2018/Invoke.js @@ -5,12 +5,12 @@ var $TypeError = require('es-errors/type'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-invoke module.exports = function Invoke(O, P) { - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; diff --git a/2018/IsPropertyKey.js b/2018/IsPropertyKey.js index aaeb6f9b..4b1c9c71 100644 --- a/2018/IsPropertyKey.js +++ b/2018/IsPropertyKey.js @@ -1,7 +1,9 @@ 'use strict'; +var isPropertyKey = require('../helpers/isPropertyKey'); + // https://262.ecma-international.org/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { - return typeof argument === 'string' || typeof argument === 'symbol'; + return isPropertyKey(argument); }; diff --git a/2018/OrdinaryDefineOwnProperty.js b/2018/OrdinaryDefineOwnProperty.js index 29941a3e..cad4aa08 100644 --- a/2018/OrdinaryDefineOwnProperty.js +++ b/2018/OrdinaryDefineOwnProperty.js @@ -8,7 +8,7 @@ var isPropertyDescriptor = require('../helpers/records/property-descriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); @@ -21,7 +21,7 @@ module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor(Desc)) { diff --git a/2018/OrdinaryGetOwnProperty.js b/2018/OrdinaryGetOwnProperty.js index efdd5b1d..4a8c16b3 100644 --- a/2018/OrdinaryGetOwnProperty.js +++ b/2018/OrdinaryGetOwnProperty.js @@ -10,7 +10,7 @@ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var hasOwn = require('hasown'); var IsArray = require('./IsArray'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -22,7 +22,7 @@ module.exports = function OrdinaryGetOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!hasOwn(O, P)) { diff --git a/2018/OrdinaryHasProperty.js b/2018/OrdinaryHasProperty.js index 978382ee..9e7ac616 100644 --- a/2018/OrdinaryHasProperty.js +++ b/2018/OrdinaryHasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty @@ -12,7 +11,7 @@ module.exports = function OrdinaryHasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; diff --git a/2018/Set.js b/2018/Set.js index 9ab8a29e..b6311f85 100644 --- a/2018/Set.js +++ b/2018/Set.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -23,7 +23,7 @@ module.exports = function Set(O, P, V, Throw) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (typeof Throw !== 'boolean') { diff --git a/2018/StringGetOwnProperty.js b/2018/StringGetOwnProperty.js index a7f46521..62f61e59 100644 --- a/2018/StringGetOwnProperty.js +++ b/2018/StringGetOwnProperty.js @@ -8,9 +8,9 @@ var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsInteger = require('./IsInteger'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); var isNegativeZero = require('math-intrinsics/isNegativeZero'); @@ -26,8 +26,8 @@ module.exports = function StringGetOwnProperty(S, P) { if (typeof str !== 'string') { throw new $TypeError('Assertion failed: `S` must be a boxed string object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } if (typeof P !== 'string') { return void undefined; diff --git a/2018/ValidateAndApplyPropertyDescriptor.js b/2018/ValidateAndApplyPropertyDescriptor.js index 50de9899..46ca26ce 100644 --- a/2018/ValidateAndApplyPropertyDescriptor.js +++ b/2018/ValidateAndApplyPropertyDescriptor.js @@ -10,7 +10,7 @@ var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -33,7 +33,7 @@ module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, D if (typeof current !== 'undefined' && !isPropertyDescriptor(current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } - if (typeof O !== 'undefined' && !IsPropertyKey(P)) { + if (typeof O !== 'undefined' && !isPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (typeof current === 'undefined') { diff --git a/2019/CopyDataProperties.js b/2019/CopyDataProperties.js index b6ab07f5..56888f4e 100644 --- a/2019/CopyDataProperties.js +++ b/2019/CopyDataProperties.js @@ -12,7 +12,7 @@ var CreateDataProperty = require('./CreateDataProperty'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); @@ -30,7 +30,7 @@ module.exports = function CopyDataProperties(target, source, excludedItems) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } for (var i = 0; i < excludedItems.length; i += 1) { - if (!IsPropertyKey(excludedItems[i])) { + if (!isPropertyKey(excludedItems[i])) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } } diff --git a/2019/CreateDataProperty.js b/2019/CreateDataProperty.js index 5da45cdd..f0108393 100644 --- a/2019/CreateDataProperty.js +++ b/2019/CreateDataProperty.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var isObject = require('../helpers/isObject'); @@ -13,8 +13,8 @@ module.exports = function CreateDataProperty(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { '[[Configurable]]': true, diff --git a/2019/CreateDataPropertyOrThrow.js b/2019/CreateDataPropertyOrThrow.js index 494e92eb..64083f09 100644 --- a/2019/CreateDataPropertyOrThrow.js +++ b/2019/CreateDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var CreateDataProperty = require('./CreateDataProperty'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow @@ -13,8 +13,8 @@ module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var success = CreateDataProperty(O, P, V); if (!success) { diff --git a/2019/CreateMethodProperty.js b/2019/CreateMethodProperty.js index 22eb4416..f5cd757e 100644 --- a/2019/CreateMethodProperty.js +++ b/2019/CreateMethodProperty.js @@ -6,7 +6,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -18,8 +18,8 @@ module.exports = function CreateMethodProperty(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2019/DefinePropertyOrThrow.js b/2019/DefinePropertyOrThrow.js index a2355b09..d25110ab 100644 --- a/2019/DefinePropertyOrThrow.js +++ b/2019/DefinePropertyOrThrow.js @@ -7,7 +7,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -20,8 +20,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc); diff --git a/2019/DeletePropertyOrThrow.js b/2019/DeletePropertyOrThrow.js index 07ac40cb..8f9b58c0 100644 --- a/2019/DeletePropertyOrThrow.js +++ b/2019/DeletePropertyOrThrow.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow @@ -13,8 +12,8 @@ module.exports = function DeletePropertyOrThrow(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // eslint-disable-next-line no-param-reassign diff --git a/2019/Get.js b/2019/Get.js index 12e65bd8..cfd7061c 100644 --- a/2019/Get.js +++ b/2019/Get.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-get-o-p @@ -16,8 +15,8 @@ module.exports = function Get(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } // 7.3.1.2 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.1.3 return O[P]; diff --git a/2019/GetMethod.js b/2019/GetMethod.js index 1c2ee9ef..e28bb150 100644 --- a/2019/GetMethod.js +++ b/2019/GetMethod.js @@ -4,7 +4,7 @@ var $TypeError = require('es-errors/type'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var inspect = require('object-inspect'); @@ -12,8 +12,8 @@ var inspect = require('object-inspect'); module.exports = function GetMethod(O, P) { // 7.3.9.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // 7.3.9.2 diff --git a/2019/GetV.js b/2019/GetV.js index 81d2f1e1..920dec3c 100644 --- a/2019/GetV.js +++ b/2019/GetV.js @@ -4,15 +4,15 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // var ToObject = require('./ToObject'); // https://262.ecma-international.org/6.0/#sec-getv module.exports = function GetV(V, P) { // 7.3.2.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.2.2-3 diff --git a/2019/HasOwnProperty.js b/2019/HasOwnProperty.js index daed1d53..cea2172f 100644 --- a/2019/HasOwnProperty.js +++ b/2019/HasOwnProperty.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var hasOwn = require('hasown'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasownproperty @@ -14,7 +13,7 @@ module.exports = function HasOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return hasOwn(O, P); diff --git a/2019/HasProperty.js b/2019/HasProperty.js index 00514a3b..037c8550 100644 --- a/2019/HasProperty.js +++ b/2019/HasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasproperty @@ -12,7 +11,7 @@ module.exports = function HasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; diff --git a/2019/Invoke.js b/2019/Invoke.js index 6c2426ff..57bca8eb 100644 --- a/2019/Invoke.js +++ b/2019/Invoke.js @@ -5,12 +5,12 @@ var $TypeError = require('es-errors/type'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-invoke module.exports = function Invoke(O, P) { - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; diff --git a/2019/IsPropertyKey.js b/2019/IsPropertyKey.js index aaeb6f9b..4b1c9c71 100644 --- a/2019/IsPropertyKey.js +++ b/2019/IsPropertyKey.js @@ -1,7 +1,9 @@ 'use strict'; +var isPropertyKey = require('../helpers/isPropertyKey'); + // https://262.ecma-international.org/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { - return typeof argument === 'string' || typeof argument === 'symbol'; + return isPropertyKey(argument); }; diff --git a/2019/OrdinaryDefineOwnProperty.js b/2019/OrdinaryDefineOwnProperty.js index 29941a3e..cad4aa08 100644 --- a/2019/OrdinaryDefineOwnProperty.js +++ b/2019/OrdinaryDefineOwnProperty.js @@ -8,7 +8,7 @@ var isPropertyDescriptor = require('../helpers/records/property-descriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); @@ -21,7 +21,7 @@ module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor(Desc)) { diff --git a/2019/OrdinaryGetOwnProperty.js b/2019/OrdinaryGetOwnProperty.js index efdd5b1d..4a8c16b3 100644 --- a/2019/OrdinaryGetOwnProperty.js +++ b/2019/OrdinaryGetOwnProperty.js @@ -10,7 +10,7 @@ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var hasOwn = require('hasown'); var IsArray = require('./IsArray'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -22,7 +22,7 @@ module.exports = function OrdinaryGetOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!hasOwn(O, P)) { diff --git a/2019/OrdinaryHasProperty.js b/2019/OrdinaryHasProperty.js index 978382ee..9e7ac616 100644 --- a/2019/OrdinaryHasProperty.js +++ b/2019/OrdinaryHasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty @@ -12,7 +11,7 @@ module.exports = function OrdinaryHasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; diff --git a/2019/Set.js b/2019/Set.js index 9ab8a29e..b6311f85 100644 --- a/2019/Set.js +++ b/2019/Set.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -23,7 +23,7 @@ module.exports = function Set(O, P, V, Throw) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (typeof Throw !== 'boolean') { diff --git a/2019/StringGetOwnProperty.js b/2019/StringGetOwnProperty.js index a7f46521..62f61e59 100644 --- a/2019/StringGetOwnProperty.js +++ b/2019/StringGetOwnProperty.js @@ -8,9 +8,9 @@ var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsInteger = require('./IsInteger'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); var isNegativeZero = require('math-intrinsics/isNegativeZero'); @@ -26,8 +26,8 @@ module.exports = function StringGetOwnProperty(S, P) { if (typeof str !== 'string') { throw new $TypeError('Assertion failed: `S` must be a boxed string object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } if (typeof P !== 'string') { return void undefined; diff --git a/2019/ValidateAndApplyPropertyDescriptor.js b/2019/ValidateAndApplyPropertyDescriptor.js index 50de9899..46ca26ce 100644 --- a/2019/ValidateAndApplyPropertyDescriptor.js +++ b/2019/ValidateAndApplyPropertyDescriptor.js @@ -10,7 +10,7 @@ var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -33,7 +33,7 @@ module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, D if (typeof current !== 'undefined' && !isPropertyDescriptor(current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } - if (typeof O !== 'undefined' && !IsPropertyKey(P)) { + if (typeof O !== 'undefined' && !isPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (typeof current === 'undefined') { diff --git a/2020/CopyDataProperties.js b/2020/CopyDataProperties.js index f62ea143..0e1cd348 100644 --- a/2020/CopyDataProperties.js +++ b/2020/CopyDataProperties.js @@ -13,7 +13,7 @@ var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); @@ -27,7 +27,7 @@ module.exports = function CopyDataProperties(target, source, excludedItems) { throw new $TypeError('Assertion failed: "target" must be an Object'); } - if (!IsArray(excludedItems) || !every(excludedItems, IsPropertyKey)) { + if (!IsArray(excludedItems) || !every(excludedItems, isPropertyKey)) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } diff --git a/2020/CreateDataProperty.js b/2020/CreateDataProperty.js index 5da45cdd..f0108393 100644 --- a/2020/CreateDataProperty.js +++ b/2020/CreateDataProperty.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var isObject = require('../helpers/isObject'); @@ -13,8 +13,8 @@ module.exports = function CreateDataProperty(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { '[[Configurable]]': true, diff --git a/2020/CreateDataPropertyOrThrow.js b/2020/CreateDataPropertyOrThrow.js index 494e92eb..64083f09 100644 --- a/2020/CreateDataPropertyOrThrow.js +++ b/2020/CreateDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var CreateDataProperty = require('./CreateDataProperty'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow @@ -13,8 +13,8 @@ module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var success = CreateDataProperty(O, P, V); if (!success) { diff --git a/2020/CreateMethodProperty.js b/2020/CreateMethodProperty.js index 22eb4416..f5cd757e 100644 --- a/2020/CreateMethodProperty.js +++ b/2020/CreateMethodProperty.js @@ -6,7 +6,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -18,8 +18,8 @@ module.exports = function CreateMethodProperty(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2020/DefinePropertyOrThrow.js b/2020/DefinePropertyOrThrow.js index a2355b09..d25110ab 100644 --- a/2020/DefinePropertyOrThrow.js +++ b/2020/DefinePropertyOrThrow.js @@ -7,7 +7,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -20,8 +20,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc); diff --git a/2020/DeletePropertyOrThrow.js b/2020/DeletePropertyOrThrow.js index 07ac40cb..8f9b58c0 100644 --- a/2020/DeletePropertyOrThrow.js +++ b/2020/DeletePropertyOrThrow.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow @@ -13,8 +12,8 @@ module.exports = function DeletePropertyOrThrow(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // eslint-disable-next-line no-param-reassign diff --git a/2020/Get.js b/2020/Get.js index 12e65bd8..cfd7061c 100644 --- a/2020/Get.js +++ b/2020/Get.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-get-o-p @@ -16,8 +15,8 @@ module.exports = function Get(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } // 7.3.1.2 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.1.3 return O[P]; diff --git a/2020/GetMethod.js b/2020/GetMethod.js index 1c2ee9ef..e28bb150 100644 --- a/2020/GetMethod.js +++ b/2020/GetMethod.js @@ -4,7 +4,7 @@ var $TypeError = require('es-errors/type'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var inspect = require('object-inspect'); @@ -12,8 +12,8 @@ var inspect = require('object-inspect'); module.exports = function GetMethod(O, P) { // 7.3.9.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // 7.3.9.2 diff --git a/2020/GetV.js b/2020/GetV.js index 81d2f1e1..920dec3c 100644 --- a/2020/GetV.js +++ b/2020/GetV.js @@ -4,15 +4,15 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // var ToObject = require('./ToObject'); // https://262.ecma-international.org/6.0/#sec-getv module.exports = function GetV(V, P) { // 7.3.2.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.2.2-3 diff --git a/2020/HasOwnProperty.js b/2020/HasOwnProperty.js index daed1d53..cea2172f 100644 --- a/2020/HasOwnProperty.js +++ b/2020/HasOwnProperty.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var hasOwn = require('hasown'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasownproperty @@ -14,7 +13,7 @@ module.exports = function HasOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return hasOwn(O, P); diff --git a/2020/HasProperty.js b/2020/HasProperty.js index 00514a3b..037c8550 100644 --- a/2020/HasProperty.js +++ b/2020/HasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasproperty @@ -12,7 +11,7 @@ module.exports = function HasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; diff --git a/2020/Invoke.js b/2020/Invoke.js index 6c2426ff..57bca8eb 100644 --- a/2020/Invoke.js +++ b/2020/Invoke.js @@ -5,12 +5,12 @@ var $TypeError = require('es-errors/type'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-invoke module.exports = function Invoke(O, P) { - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; diff --git a/2020/IsPropertyKey.js b/2020/IsPropertyKey.js index aaeb6f9b..4b1c9c71 100644 --- a/2020/IsPropertyKey.js +++ b/2020/IsPropertyKey.js @@ -1,7 +1,9 @@ 'use strict'; +var isPropertyKey = require('../helpers/isPropertyKey'); + // https://262.ecma-international.org/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { - return typeof argument === 'string' || typeof argument === 'symbol'; + return isPropertyKey(argument); }; diff --git a/2020/OrdinaryDefineOwnProperty.js b/2020/OrdinaryDefineOwnProperty.js index 29941a3e..cad4aa08 100644 --- a/2020/OrdinaryDefineOwnProperty.js +++ b/2020/OrdinaryDefineOwnProperty.js @@ -8,7 +8,7 @@ var isPropertyDescriptor = require('../helpers/records/property-descriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); @@ -21,7 +21,7 @@ module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor(Desc)) { diff --git a/2020/OrdinaryGetOwnProperty.js b/2020/OrdinaryGetOwnProperty.js index efdd5b1d..4a8c16b3 100644 --- a/2020/OrdinaryGetOwnProperty.js +++ b/2020/OrdinaryGetOwnProperty.js @@ -10,7 +10,7 @@ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var hasOwn = require('hasown'); var IsArray = require('./IsArray'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -22,7 +22,7 @@ module.exports = function OrdinaryGetOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!hasOwn(O, P)) { diff --git a/2020/OrdinaryHasProperty.js b/2020/OrdinaryHasProperty.js index 978382ee..9e7ac616 100644 --- a/2020/OrdinaryHasProperty.js +++ b/2020/OrdinaryHasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty @@ -12,7 +11,7 @@ module.exports = function OrdinaryHasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; diff --git a/2020/Set.js b/2020/Set.js index 9ab8a29e..b6311f85 100644 --- a/2020/Set.js +++ b/2020/Set.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -23,7 +23,7 @@ module.exports = function Set(O, P, V, Throw) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (typeof Throw !== 'boolean') { diff --git a/2020/StringGetOwnProperty.js b/2020/StringGetOwnProperty.js index a7f46521..62f61e59 100644 --- a/2020/StringGetOwnProperty.js +++ b/2020/StringGetOwnProperty.js @@ -8,9 +8,9 @@ var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsInteger = require('./IsInteger'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); var isNegativeZero = require('math-intrinsics/isNegativeZero'); @@ -26,8 +26,8 @@ module.exports = function StringGetOwnProperty(S, P) { if (typeof str !== 'string') { throw new $TypeError('Assertion failed: `S` must be a boxed string object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } if (typeof P !== 'string') { return void undefined; diff --git a/2020/ValidateAndApplyPropertyDescriptor.js b/2020/ValidateAndApplyPropertyDescriptor.js index 50de9899..46ca26ce 100644 --- a/2020/ValidateAndApplyPropertyDescriptor.js +++ b/2020/ValidateAndApplyPropertyDescriptor.js @@ -10,7 +10,7 @@ var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -33,7 +33,7 @@ module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, D if (typeof current !== 'undefined' && !isPropertyDescriptor(current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } - if (typeof O !== 'undefined' && !IsPropertyKey(P)) { + if (typeof O !== 'undefined' && !isPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (typeof current === 'undefined') { diff --git a/2021/CopyDataProperties.js b/2021/CopyDataProperties.js index ee27522f..8471a4f2 100644 --- a/2021/CopyDataProperties.js +++ b/2021/CopyDataProperties.js @@ -14,7 +14,7 @@ var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsIntegralNumber = require('./IsIntegralNumber'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); @@ -28,7 +28,7 @@ module.exports = function CopyDataProperties(target, source, excludedItems) { throw new $TypeError('Assertion failed: "target" must be an Object'); } - if (!IsArray(excludedItems) || !every(excludedItems, IsPropertyKey)) { + if (!IsArray(excludedItems) || !every(excludedItems, isPropertyKey)) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } diff --git a/2021/CreateDataProperty.js b/2021/CreateDataProperty.js index 5da45cdd..f0108393 100644 --- a/2021/CreateDataProperty.js +++ b/2021/CreateDataProperty.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var isObject = require('../helpers/isObject'); @@ -13,8 +13,8 @@ module.exports = function CreateDataProperty(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { '[[Configurable]]': true, diff --git a/2021/CreateDataPropertyOrThrow.js b/2021/CreateDataPropertyOrThrow.js index 494e92eb..64083f09 100644 --- a/2021/CreateDataPropertyOrThrow.js +++ b/2021/CreateDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var CreateDataProperty = require('./CreateDataProperty'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow @@ -13,8 +13,8 @@ module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var success = CreateDataProperty(O, P, V); if (!success) { diff --git a/2021/CreateMethodProperty.js b/2021/CreateMethodProperty.js index 22eb4416..f5cd757e 100644 --- a/2021/CreateMethodProperty.js +++ b/2021/CreateMethodProperty.js @@ -6,7 +6,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -18,8 +18,8 @@ module.exports = function CreateMethodProperty(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2021/DefinePropertyOrThrow.js b/2021/DefinePropertyOrThrow.js index a2355b09..d25110ab 100644 --- a/2021/DefinePropertyOrThrow.js +++ b/2021/DefinePropertyOrThrow.js @@ -7,7 +7,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -20,8 +20,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc); diff --git a/2021/DeletePropertyOrThrow.js b/2021/DeletePropertyOrThrow.js index 07ac40cb..8f9b58c0 100644 --- a/2021/DeletePropertyOrThrow.js +++ b/2021/DeletePropertyOrThrow.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow @@ -13,8 +12,8 @@ module.exports = function DeletePropertyOrThrow(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // eslint-disable-next-line no-param-reassign diff --git a/2021/Get.js b/2021/Get.js index 12e65bd8..cfd7061c 100644 --- a/2021/Get.js +++ b/2021/Get.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-get-o-p @@ -16,8 +15,8 @@ module.exports = function Get(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } // 7.3.1.2 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.1.3 return O[P]; diff --git a/2021/GetMethod.js b/2021/GetMethod.js index 1c2ee9ef..e28bb150 100644 --- a/2021/GetMethod.js +++ b/2021/GetMethod.js @@ -4,7 +4,7 @@ var $TypeError = require('es-errors/type'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var inspect = require('object-inspect'); @@ -12,8 +12,8 @@ var inspect = require('object-inspect'); module.exports = function GetMethod(O, P) { // 7.3.9.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // 7.3.9.2 diff --git a/2021/GetV.js b/2021/GetV.js index 81d2f1e1..920dec3c 100644 --- a/2021/GetV.js +++ b/2021/GetV.js @@ -4,15 +4,15 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // var ToObject = require('./ToObject'); // https://262.ecma-international.org/6.0/#sec-getv module.exports = function GetV(V, P) { // 7.3.2.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.2.2-3 diff --git a/2021/HasOwnProperty.js b/2021/HasOwnProperty.js index daed1d53..cea2172f 100644 --- a/2021/HasOwnProperty.js +++ b/2021/HasOwnProperty.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var hasOwn = require('hasown'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasownproperty @@ -14,7 +13,7 @@ module.exports = function HasOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return hasOwn(O, P); diff --git a/2021/HasProperty.js b/2021/HasProperty.js index 00514a3b..037c8550 100644 --- a/2021/HasProperty.js +++ b/2021/HasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasproperty @@ -12,7 +11,7 @@ module.exports = function HasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; diff --git a/2021/Invoke.js b/2021/Invoke.js index 6c2426ff..57bca8eb 100644 --- a/2021/Invoke.js +++ b/2021/Invoke.js @@ -5,12 +5,12 @@ var $TypeError = require('es-errors/type'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-invoke module.exports = function Invoke(O, P) { - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; diff --git a/2021/IsPropertyKey.js b/2021/IsPropertyKey.js index aaeb6f9b..4b1c9c71 100644 --- a/2021/IsPropertyKey.js +++ b/2021/IsPropertyKey.js @@ -1,7 +1,9 @@ 'use strict'; +var isPropertyKey = require('../helpers/isPropertyKey'); + // https://262.ecma-international.org/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { - return typeof argument === 'string' || typeof argument === 'symbol'; + return isPropertyKey(argument); }; diff --git a/2021/OrdinaryDefineOwnProperty.js b/2021/OrdinaryDefineOwnProperty.js index 29941a3e..cad4aa08 100644 --- a/2021/OrdinaryDefineOwnProperty.js +++ b/2021/OrdinaryDefineOwnProperty.js @@ -8,7 +8,7 @@ var isPropertyDescriptor = require('../helpers/records/property-descriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); @@ -21,7 +21,7 @@ module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor(Desc)) { diff --git a/2021/OrdinaryGetOwnProperty.js b/2021/OrdinaryGetOwnProperty.js index efdd5b1d..4a8c16b3 100644 --- a/2021/OrdinaryGetOwnProperty.js +++ b/2021/OrdinaryGetOwnProperty.js @@ -10,7 +10,7 @@ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var hasOwn = require('hasown'); var IsArray = require('./IsArray'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -22,7 +22,7 @@ module.exports = function OrdinaryGetOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!hasOwn(O, P)) { diff --git a/2021/OrdinaryHasProperty.js b/2021/OrdinaryHasProperty.js index 978382ee..9e7ac616 100644 --- a/2021/OrdinaryHasProperty.js +++ b/2021/OrdinaryHasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty @@ -12,7 +11,7 @@ module.exports = function OrdinaryHasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; diff --git a/2021/Set.js b/2021/Set.js index 9ab8a29e..b6311f85 100644 --- a/2021/Set.js +++ b/2021/Set.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -23,7 +23,7 @@ module.exports = function Set(O, P, V, Throw) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (typeof Throw !== 'boolean') { diff --git a/2021/StringGetOwnProperty.js b/2021/StringGetOwnProperty.js index 58f33865..5dcb204a 100644 --- a/2021/StringGetOwnProperty.js +++ b/2021/StringGetOwnProperty.js @@ -9,9 +9,9 @@ var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsIntegralNumber = require('./IsIntegralNumber'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/12.0/#sec-stringgetownproperty @@ -25,8 +25,8 @@ module.exports = function StringGetOwnProperty(S, P) { if (typeof str !== 'string') { throw new $TypeError('Assertion failed: `S` must be a boxed string object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } if (typeof P !== 'string') { return void undefined; diff --git a/2021/ValidateAndApplyPropertyDescriptor.js b/2021/ValidateAndApplyPropertyDescriptor.js index 50de9899..46ca26ce 100644 --- a/2021/ValidateAndApplyPropertyDescriptor.js +++ b/2021/ValidateAndApplyPropertyDescriptor.js @@ -10,7 +10,7 @@ var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -33,7 +33,7 @@ module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, D if (typeof current !== 'undefined' && !isPropertyDescriptor(current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } - if (typeof O !== 'undefined' && !IsPropertyKey(P)) { + if (typeof O !== 'undefined' && !isPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (typeof current === 'undefined') { diff --git a/2022/CopyDataProperties.js b/2022/CopyDataProperties.js index ee27522f..8471a4f2 100644 --- a/2022/CopyDataProperties.js +++ b/2022/CopyDataProperties.js @@ -14,7 +14,7 @@ var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsIntegralNumber = require('./IsIntegralNumber'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); @@ -28,7 +28,7 @@ module.exports = function CopyDataProperties(target, source, excludedItems) { throw new $TypeError('Assertion failed: "target" must be an Object'); } - if (!IsArray(excludedItems) || !every(excludedItems, IsPropertyKey)) { + if (!IsArray(excludedItems) || !every(excludedItems, isPropertyKey)) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } diff --git a/2022/CreateDataProperty.js b/2022/CreateDataProperty.js index 5da45cdd..f0108393 100644 --- a/2022/CreateDataProperty.js +++ b/2022/CreateDataProperty.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var isObject = require('../helpers/isObject'); @@ -13,8 +13,8 @@ module.exports = function CreateDataProperty(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { '[[Configurable]]': true, diff --git a/2022/CreateDataPropertyOrThrow.js b/2022/CreateDataPropertyOrThrow.js index 494e92eb..64083f09 100644 --- a/2022/CreateDataPropertyOrThrow.js +++ b/2022/CreateDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var CreateDataProperty = require('./CreateDataProperty'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow @@ -13,8 +13,8 @@ module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var success = CreateDataProperty(O, P, V); if (!success) { diff --git a/2022/CreateMethodProperty.js b/2022/CreateMethodProperty.js index 22eb4416..f5cd757e 100644 --- a/2022/CreateMethodProperty.js +++ b/2022/CreateMethodProperty.js @@ -6,7 +6,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -18,8 +18,8 @@ module.exports = function CreateMethodProperty(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2022/CreateNonEnumerableDataPropertyOrThrow.js b/2022/CreateNonEnumerableDataPropertyOrThrow.js index 0218bf42..63868eea 100644 --- a/2022/CreateNonEnumerableDataPropertyOrThrow.js +++ b/2022/CreateNonEnumerableDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/13.0/#sec-createnonenumerabledatapropertyorthrow @@ -14,8 +14,8 @@ module.exports = function CreateNonEnumerableDataPropertyOrThrow(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2022/DefineMethodProperty.js b/2022/DefineMethodProperty.js index 2866cc33..dd159078 100644 --- a/2022/DefineMethodProperty.js +++ b/2022/DefineMethodProperty.js @@ -4,9 +4,9 @@ var $TypeError = require('es-errors/type'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/13.0/#sec-definemethodproperty @@ -14,7 +14,7 @@ module.exports = function DefineMethodProperty(homeObject, key, closure, enumera if (!isObject(homeObject)) { throw new $TypeError('Assertion failed: `homeObject` is not an Object'); } - if (!IsPropertyKey(key)) { + if (!isPropertyKey(key)) { throw new $TypeError('Assertion failed: `key` is not a Property Key or a Private Name'); } if (typeof closure !== 'function') { diff --git a/2022/DefinePropertyOrThrow.js b/2022/DefinePropertyOrThrow.js index a2355b09..d25110ab 100644 --- a/2022/DefinePropertyOrThrow.js +++ b/2022/DefinePropertyOrThrow.js @@ -7,7 +7,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -20,8 +20,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc); diff --git a/2022/DeletePropertyOrThrow.js b/2022/DeletePropertyOrThrow.js index 07ac40cb..8f9b58c0 100644 --- a/2022/DeletePropertyOrThrow.js +++ b/2022/DeletePropertyOrThrow.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow @@ -13,8 +12,8 @@ module.exports = function DeletePropertyOrThrow(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // eslint-disable-next-line no-param-reassign diff --git a/2022/Get.js b/2022/Get.js index 12e65bd8..cfd7061c 100644 --- a/2022/Get.js +++ b/2022/Get.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-get-o-p @@ -16,8 +15,8 @@ module.exports = function Get(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } // 7.3.1.2 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.1.3 return O[P]; diff --git a/2022/GetMethod.js b/2022/GetMethod.js index 1c2ee9ef..e28bb150 100644 --- a/2022/GetMethod.js +++ b/2022/GetMethod.js @@ -4,7 +4,7 @@ var $TypeError = require('es-errors/type'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var inspect = require('object-inspect'); @@ -12,8 +12,8 @@ var inspect = require('object-inspect'); module.exports = function GetMethod(O, P) { // 7.3.9.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // 7.3.9.2 diff --git a/2022/GetV.js b/2022/GetV.js index 81d2f1e1..920dec3c 100644 --- a/2022/GetV.js +++ b/2022/GetV.js @@ -4,15 +4,15 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // var ToObject = require('./ToObject'); // https://262.ecma-international.org/6.0/#sec-getv module.exports = function GetV(V, P) { // 7.3.2.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.2.2-3 diff --git a/2022/HasOwnProperty.js b/2022/HasOwnProperty.js index daed1d53..cea2172f 100644 --- a/2022/HasOwnProperty.js +++ b/2022/HasOwnProperty.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var hasOwn = require('hasown'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasownproperty @@ -14,7 +13,7 @@ module.exports = function HasOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return hasOwn(O, P); diff --git a/2022/HasProperty.js b/2022/HasProperty.js index 00514a3b..037c8550 100644 --- a/2022/HasProperty.js +++ b/2022/HasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasproperty @@ -12,7 +11,7 @@ module.exports = function HasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; diff --git a/2022/Invoke.js b/2022/Invoke.js index 6c2426ff..57bca8eb 100644 --- a/2022/Invoke.js +++ b/2022/Invoke.js @@ -5,12 +5,12 @@ var $TypeError = require('es-errors/type'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-invoke module.exports = function Invoke(O, P) { - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; diff --git a/2022/IsPropertyKey.js b/2022/IsPropertyKey.js index aaeb6f9b..4b1c9c71 100644 --- a/2022/IsPropertyKey.js +++ b/2022/IsPropertyKey.js @@ -1,7 +1,9 @@ 'use strict'; +var isPropertyKey = require('../helpers/isPropertyKey'); + // https://262.ecma-international.org/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { - return typeof argument === 'string' || typeof argument === 'symbol'; + return isPropertyKey(argument); }; diff --git a/2022/OrdinaryDefineOwnProperty.js b/2022/OrdinaryDefineOwnProperty.js index 29941a3e..cad4aa08 100644 --- a/2022/OrdinaryDefineOwnProperty.js +++ b/2022/OrdinaryDefineOwnProperty.js @@ -8,7 +8,7 @@ var isPropertyDescriptor = require('../helpers/records/property-descriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); @@ -21,7 +21,7 @@ module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor(Desc)) { diff --git a/2022/OrdinaryGetOwnProperty.js b/2022/OrdinaryGetOwnProperty.js index efdd5b1d..4a8c16b3 100644 --- a/2022/OrdinaryGetOwnProperty.js +++ b/2022/OrdinaryGetOwnProperty.js @@ -10,7 +10,7 @@ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var hasOwn = require('hasown'); var IsArray = require('./IsArray'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -22,7 +22,7 @@ module.exports = function OrdinaryGetOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!hasOwn(O, P)) { diff --git a/2022/OrdinaryHasProperty.js b/2022/OrdinaryHasProperty.js index 978382ee..9e7ac616 100644 --- a/2022/OrdinaryHasProperty.js +++ b/2022/OrdinaryHasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty @@ -12,7 +11,7 @@ module.exports = function OrdinaryHasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; diff --git a/2022/Set.js b/2022/Set.js index 9ab8a29e..b6311f85 100644 --- a/2022/Set.js +++ b/2022/Set.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -23,7 +23,7 @@ module.exports = function Set(O, P, V, Throw) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (typeof Throw !== 'boolean') { diff --git a/2022/StringGetOwnProperty.js b/2022/StringGetOwnProperty.js index 58f33865..5dcb204a 100644 --- a/2022/StringGetOwnProperty.js +++ b/2022/StringGetOwnProperty.js @@ -9,9 +9,9 @@ var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsIntegralNumber = require('./IsIntegralNumber'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/12.0/#sec-stringgetownproperty @@ -25,8 +25,8 @@ module.exports = function StringGetOwnProperty(S, P) { if (typeof str !== 'string') { throw new $TypeError('Assertion failed: `S` must be a boxed string object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } if (typeof P !== 'string') { return void undefined; diff --git a/2022/ValidateAndApplyPropertyDescriptor.js b/2022/ValidateAndApplyPropertyDescriptor.js index f524ca06..36a0a0b0 100644 --- a/2022/ValidateAndApplyPropertyDescriptor.js +++ b/2022/ValidateAndApplyPropertyDescriptor.js @@ -10,7 +10,7 @@ var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); @@ -26,7 +26,7 @@ module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, D if (typeof O !== 'undefined' && !isObject(O)) { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (typeof extensible !== 'boolean') { diff --git a/2023/CopyDataProperties.js b/2023/CopyDataProperties.js index ee27522f..8471a4f2 100644 --- a/2023/CopyDataProperties.js +++ b/2023/CopyDataProperties.js @@ -14,7 +14,7 @@ var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsIntegralNumber = require('./IsIntegralNumber'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); @@ -28,7 +28,7 @@ module.exports = function CopyDataProperties(target, source, excludedItems) { throw new $TypeError('Assertion failed: "target" must be an Object'); } - if (!IsArray(excludedItems) || !every(excludedItems, IsPropertyKey)) { + if (!IsArray(excludedItems) || !every(excludedItems, isPropertyKey)) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } diff --git a/2023/CreateDataProperty.js b/2023/CreateDataProperty.js index 5da45cdd..f0108393 100644 --- a/2023/CreateDataProperty.js +++ b/2023/CreateDataProperty.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var isObject = require('../helpers/isObject'); @@ -13,8 +13,8 @@ module.exports = function CreateDataProperty(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { '[[Configurable]]': true, diff --git a/2023/CreateDataPropertyOrThrow.js b/2023/CreateDataPropertyOrThrow.js index 590c51e3..1db2da5e 100644 --- a/2023/CreateDataPropertyOrThrow.js +++ b/2023/CreateDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var CreateDataProperty = require('./CreateDataProperty'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // // https://262.ecma-international.org/14.0/#sec-createdatapropertyorthrow @@ -13,8 +13,8 @@ module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var success = CreateDataProperty(O, P, V); if (!success) { diff --git a/2023/CreateMethodProperty.js b/2023/CreateMethodProperty.js index 22eb4416..f5cd757e 100644 --- a/2023/CreateMethodProperty.js +++ b/2023/CreateMethodProperty.js @@ -6,7 +6,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -18,8 +18,8 @@ module.exports = function CreateMethodProperty(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2023/CreateNonEnumerableDataPropertyOrThrow.js b/2023/CreateNonEnumerableDataPropertyOrThrow.js index 0218bf42..63868eea 100644 --- a/2023/CreateNonEnumerableDataPropertyOrThrow.js +++ b/2023/CreateNonEnumerableDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/13.0/#sec-createnonenumerabledatapropertyorthrow @@ -14,8 +14,8 @@ module.exports = function CreateNonEnumerableDataPropertyOrThrow(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2023/DefineMethodProperty.js b/2023/DefineMethodProperty.js index 2866cc33..dd159078 100644 --- a/2023/DefineMethodProperty.js +++ b/2023/DefineMethodProperty.js @@ -4,9 +4,9 @@ var $TypeError = require('es-errors/type'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/13.0/#sec-definemethodproperty @@ -14,7 +14,7 @@ module.exports = function DefineMethodProperty(homeObject, key, closure, enumera if (!isObject(homeObject)) { throw new $TypeError('Assertion failed: `homeObject` is not an Object'); } - if (!IsPropertyKey(key)) { + if (!isPropertyKey(key)) { throw new $TypeError('Assertion failed: `key` is not a Property Key or a Private Name'); } if (typeof closure !== 'function') { diff --git a/2023/DefinePropertyOrThrow.js b/2023/DefinePropertyOrThrow.js index a2355b09..d25110ab 100644 --- a/2023/DefinePropertyOrThrow.js +++ b/2023/DefinePropertyOrThrow.js @@ -7,7 +7,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -20,8 +20,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc); diff --git a/2023/DeletePropertyOrThrow.js b/2023/DeletePropertyOrThrow.js index 07ac40cb..8f9b58c0 100644 --- a/2023/DeletePropertyOrThrow.js +++ b/2023/DeletePropertyOrThrow.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow @@ -13,8 +12,8 @@ module.exports = function DeletePropertyOrThrow(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // eslint-disable-next-line no-param-reassign diff --git a/2023/Get.js b/2023/Get.js index 12e65bd8..cfd7061c 100644 --- a/2023/Get.js +++ b/2023/Get.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-get-o-p @@ -16,8 +15,8 @@ module.exports = function Get(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } // 7.3.1.2 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.1.3 return O[P]; diff --git a/2023/GetMethod.js b/2023/GetMethod.js index 1c2ee9ef..e28bb150 100644 --- a/2023/GetMethod.js +++ b/2023/GetMethod.js @@ -4,7 +4,7 @@ var $TypeError = require('es-errors/type'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var inspect = require('object-inspect'); @@ -12,8 +12,8 @@ var inspect = require('object-inspect'); module.exports = function GetMethod(O, P) { // 7.3.9.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // 7.3.9.2 diff --git a/2023/GetV.js b/2023/GetV.js index 81d2f1e1..920dec3c 100644 --- a/2023/GetV.js +++ b/2023/GetV.js @@ -4,15 +4,15 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // var ToObject = require('./ToObject'); // https://262.ecma-international.org/6.0/#sec-getv module.exports = function GetV(V, P) { // 7.3.2.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.2.2-3 diff --git a/2023/HasOwnProperty.js b/2023/HasOwnProperty.js index daed1d53..cea2172f 100644 --- a/2023/HasOwnProperty.js +++ b/2023/HasOwnProperty.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var hasOwn = require('hasown'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasownproperty @@ -14,7 +13,7 @@ module.exports = function HasOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return hasOwn(O, P); diff --git a/2023/HasProperty.js b/2023/HasProperty.js index 00514a3b..037c8550 100644 --- a/2023/HasProperty.js +++ b/2023/HasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasproperty @@ -12,7 +11,7 @@ module.exports = function HasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; diff --git a/2023/Invoke.js b/2023/Invoke.js index 6c2426ff..57bca8eb 100644 --- a/2023/Invoke.js +++ b/2023/Invoke.js @@ -5,12 +5,12 @@ var $TypeError = require('es-errors/type'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-invoke module.exports = function Invoke(O, P) { - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; diff --git a/2023/IsPropertyKey.js b/2023/IsPropertyKey.js index aaeb6f9b..4b1c9c71 100644 --- a/2023/IsPropertyKey.js +++ b/2023/IsPropertyKey.js @@ -1,7 +1,9 @@ 'use strict'; +var isPropertyKey = require('../helpers/isPropertyKey'); + // https://262.ecma-international.org/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { - return typeof argument === 'string' || typeof argument === 'symbol'; + return isPropertyKey(argument); }; diff --git a/2023/OrdinaryDefineOwnProperty.js b/2023/OrdinaryDefineOwnProperty.js index 29941a3e..cad4aa08 100644 --- a/2023/OrdinaryDefineOwnProperty.js +++ b/2023/OrdinaryDefineOwnProperty.js @@ -8,7 +8,7 @@ var isPropertyDescriptor = require('../helpers/records/property-descriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); @@ -21,7 +21,7 @@ module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor(Desc)) { diff --git a/2023/OrdinaryGetOwnProperty.js b/2023/OrdinaryGetOwnProperty.js index efdd5b1d..4a8c16b3 100644 --- a/2023/OrdinaryGetOwnProperty.js +++ b/2023/OrdinaryGetOwnProperty.js @@ -10,7 +10,7 @@ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var hasOwn = require('hasown'); var IsArray = require('./IsArray'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -22,7 +22,7 @@ module.exports = function OrdinaryGetOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!hasOwn(O, P)) { diff --git a/2023/OrdinaryHasProperty.js b/2023/OrdinaryHasProperty.js index 978382ee..9e7ac616 100644 --- a/2023/OrdinaryHasProperty.js +++ b/2023/OrdinaryHasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty @@ -12,7 +11,7 @@ module.exports = function OrdinaryHasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; diff --git a/2023/Set.js b/2023/Set.js index 9ab8a29e..b6311f85 100644 --- a/2023/Set.js +++ b/2023/Set.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -23,7 +23,7 @@ module.exports = function Set(O, P, V, Throw) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (typeof Throw !== 'boolean') { diff --git a/2023/StringGetOwnProperty.js b/2023/StringGetOwnProperty.js index 58f33865..5dcb204a 100644 --- a/2023/StringGetOwnProperty.js +++ b/2023/StringGetOwnProperty.js @@ -9,9 +9,9 @@ var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsIntegralNumber = require('./IsIntegralNumber'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/12.0/#sec-stringgetownproperty @@ -25,8 +25,8 @@ module.exports = function StringGetOwnProperty(S, P) { if (typeof str !== 'string') { throw new $TypeError('Assertion failed: `S` must be a boxed string object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } if (typeof P !== 'string') { return void undefined; diff --git a/2023/ValidateAndApplyPropertyDescriptor.js b/2023/ValidateAndApplyPropertyDescriptor.js index f524ca06..36a0a0b0 100644 --- a/2023/ValidateAndApplyPropertyDescriptor.js +++ b/2023/ValidateAndApplyPropertyDescriptor.js @@ -10,7 +10,7 @@ var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); @@ -26,7 +26,7 @@ module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, D if (typeof O !== 'undefined' && !isObject(O)) { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (typeof extensible !== 'boolean') { diff --git a/2024/CopyDataProperties.js b/2024/CopyDataProperties.js index ee27522f..8471a4f2 100644 --- a/2024/CopyDataProperties.js +++ b/2024/CopyDataProperties.js @@ -14,7 +14,7 @@ var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsIntegralNumber = require('./IsIntegralNumber'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); @@ -28,7 +28,7 @@ module.exports = function CopyDataProperties(target, source, excludedItems) { throw new $TypeError('Assertion failed: "target" must be an Object'); } - if (!IsArray(excludedItems) || !every(excludedItems, IsPropertyKey)) { + if (!IsArray(excludedItems) || !every(excludedItems, isPropertyKey)) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } diff --git a/2024/CreateDataProperty.js b/2024/CreateDataProperty.js index 5da45cdd..f0108393 100644 --- a/2024/CreateDataProperty.js +++ b/2024/CreateDataProperty.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var isObject = require('../helpers/isObject'); @@ -13,8 +13,8 @@ module.exports = function CreateDataProperty(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { '[[Configurable]]': true, diff --git a/2024/CreateDataPropertyOrThrow.js b/2024/CreateDataPropertyOrThrow.js index 590c51e3..1db2da5e 100644 --- a/2024/CreateDataPropertyOrThrow.js +++ b/2024/CreateDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var CreateDataProperty = require('./CreateDataProperty'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // // https://262.ecma-international.org/14.0/#sec-createdatapropertyorthrow @@ -13,8 +13,8 @@ module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var success = CreateDataProperty(O, P, V); if (!success) { diff --git a/2024/CreateNonEnumerableDataPropertyOrThrow.js b/2024/CreateNonEnumerableDataPropertyOrThrow.js index 0218bf42..63868eea 100644 --- a/2024/CreateNonEnumerableDataPropertyOrThrow.js +++ b/2024/CreateNonEnumerableDataPropertyOrThrow.js @@ -3,9 +3,9 @@ var $TypeError = require('es-errors/type'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/13.0/#sec-createnonenumerabledatapropertyorthrow @@ -14,8 +14,8 @@ module.exports = function CreateNonEnumerableDataPropertyOrThrow(O, P, V) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var newDesc = { diff --git a/2024/DefineMethodProperty.js b/2024/DefineMethodProperty.js index 2866cc33..dd159078 100644 --- a/2024/DefineMethodProperty.js +++ b/2024/DefineMethodProperty.js @@ -4,9 +4,9 @@ var $TypeError = require('es-errors/type'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/13.0/#sec-definemethodproperty @@ -14,7 +14,7 @@ module.exports = function DefineMethodProperty(homeObject, key, closure, enumera if (!isObject(homeObject)) { throw new $TypeError('Assertion failed: `homeObject` is not an Object'); } - if (!IsPropertyKey(key)) { + if (!isPropertyKey(key)) { throw new $TypeError('Assertion failed: `key` is not a Property Key or a Private Name'); } if (typeof closure !== 'function') { diff --git a/2024/DefinePropertyOrThrow.js b/2024/DefinePropertyOrThrow.js index a2355b09..d25110ab 100644 --- a/2024/DefinePropertyOrThrow.js +++ b/2024/DefinePropertyOrThrow.js @@ -7,7 +7,7 @@ var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -20,8 +20,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc); diff --git a/2024/DeletePropertyOrThrow.js b/2024/DeletePropertyOrThrow.js index 07ac40cb..8f9b58c0 100644 --- a/2024/DeletePropertyOrThrow.js +++ b/2024/DeletePropertyOrThrow.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow @@ -13,8 +12,8 @@ module.exports = function DeletePropertyOrThrow(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // eslint-disable-next-line no-param-reassign diff --git a/2024/Get.js b/2024/Get.js index 12e65bd8..cfd7061c 100644 --- a/2024/Get.js +++ b/2024/Get.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-get-o-p @@ -16,8 +15,8 @@ module.exports = function Get(O, P) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } // 7.3.1.2 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.1.3 return O[P]; diff --git a/2024/GetMethod.js b/2024/GetMethod.js index 1c2ee9ef..e28bb150 100644 --- a/2024/GetMethod.js +++ b/2024/GetMethod.js @@ -4,7 +4,7 @@ var $TypeError = require('es-errors/type'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var inspect = require('object-inspect'); @@ -12,8 +12,8 @@ var inspect = require('object-inspect'); module.exports = function GetMethod(O, P) { // 7.3.9.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } // 7.3.9.2 diff --git a/2024/GetV.js b/2024/GetV.js index 81d2f1e1..920dec3c 100644 --- a/2024/GetV.js +++ b/2024/GetV.js @@ -4,15 +4,15 @@ var $TypeError = require('es-errors/type'); var inspect = require('object-inspect'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // var ToObject = require('./ToObject'); // https://262.ecma-international.org/6.0/#sec-getv module.exports = function GetV(V, P) { // 7.3.2.1 - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P)); } // 7.3.2.2-3 diff --git a/2024/HasOwnProperty.js b/2024/HasOwnProperty.js index daed1d53..cea2172f 100644 --- a/2024/HasOwnProperty.js +++ b/2024/HasOwnProperty.js @@ -4,9 +4,8 @@ var $TypeError = require('es-errors/type'); var hasOwn = require('hasown'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasownproperty @@ -14,7 +13,7 @@ module.exports = function HasOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return hasOwn(O, P); diff --git a/2024/HasProperty.js b/2024/HasProperty.js index 00514a3b..037c8550 100644 --- a/2024/HasProperty.js +++ b/2024/HasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-hasproperty @@ -12,7 +11,7 @@ module.exports = function HasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; diff --git a/2024/Invoke.js b/2024/Invoke.js index 6c2426ff..57bca8eb 100644 --- a/2024/Invoke.js +++ b/2024/Invoke.js @@ -5,12 +5,12 @@ var $TypeError = require('es-errors/type'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-invoke module.exports = function Invoke(O, P) { - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; diff --git a/2024/IsPropertyKey.js b/2024/IsPropertyKey.js index aaeb6f9b..4b1c9c71 100644 --- a/2024/IsPropertyKey.js +++ b/2024/IsPropertyKey.js @@ -1,7 +1,9 @@ 'use strict'; +var isPropertyKey = require('../helpers/isPropertyKey'); + // https://262.ecma-international.org/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { - return typeof argument === 'string' || typeof argument === 'symbol'; + return isPropertyKey(argument); }; diff --git a/2024/OrdinaryDefineOwnProperty.js b/2024/OrdinaryDefineOwnProperty.js index 29941a3e..cad4aa08 100644 --- a/2024/OrdinaryDefineOwnProperty.js +++ b/2024/OrdinaryDefineOwnProperty.js @@ -8,7 +8,7 @@ var isPropertyDescriptor = require('../helpers/records/property-descriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsExtensible = require('./IsExtensible'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); @@ -21,7 +21,7 @@ module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor(Desc)) { diff --git a/2024/OrdinaryGetOwnProperty.js b/2024/OrdinaryGetOwnProperty.js index efdd5b1d..4a8c16b3 100644 --- a/2024/OrdinaryGetOwnProperty.js +++ b/2024/OrdinaryGetOwnProperty.js @@ -10,7 +10,7 @@ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var hasOwn = require('hasown'); var IsArray = require('./IsArray'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); @@ -22,7 +22,7 @@ module.exports = function OrdinaryGetOwnProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: O must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!hasOwn(O, P)) { diff --git a/2024/OrdinaryHasProperty.js b/2024/OrdinaryHasProperty.js index 978382ee..9e7ac616 100644 --- a/2024/OrdinaryHasProperty.js +++ b/2024/OrdinaryHasProperty.js @@ -2,9 +2,8 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); - var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty @@ -12,7 +11,7 @@ module.exports = function OrdinaryHasProperty(O, P) { if (!isObject(O)) { throw new $TypeError('Assertion failed: Type(O) is not Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; diff --git a/2024/Set.js b/2024/Set.js index 9ab8a29e..b6311f85 100644 --- a/2024/Set.js +++ b/2024/Set.js @@ -2,7 +2,7 @@ var $TypeError = require('es-errors/type'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var isObject = require('../helpers/isObject'); @@ -23,7 +23,7 @@ module.exports = function Set(O, P, V, Throw) { if (!isObject(O)) { throw new $TypeError('Assertion failed: `O` must be an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (typeof Throw !== 'boolean') { diff --git a/2024/StringGetOwnProperty.js b/2024/StringGetOwnProperty.js index 58f33865..5dcb204a 100644 --- a/2024/StringGetOwnProperty.js +++ b/2024/StringGetOwnProperty.js @@ -9,9 +9,9 @@ var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsIntegralNumber = require('./IsIntegralNumber'); -var IsPropertyKey = require('./IsPropertyKey'); var isObject = require('../helpers/isObject'); +var isPropertyKey = require('../helpers/isPropertyKey'); // https://262.ecma-international.org/12.0/#sec-stringgetownproperty @@ -25,8 +25,8 @@ module.exports = function StringGetOwnProperty(S, P) { if (typeof str !== 'string') { throw new $TypeError('Assertion failed: `S` must be a boxed string object'); } - if (!IsPropertyKey(P)) { - throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + if (!isPropertyKey(P)) { + throw new $TypeError('Assertion failed: P is not a Property Key'); } if (typeof P !== 'string') { return void undefined; diff --git a/2024/ValidateAndApplyPropertyDescriptor.js b/2024/ValidateAndApplyPropertyDescriptor.js index f524ca06..36a0a0b0 100644 --- a/2024/ValidateAndApplyPropertyDescriptor.js +++ b/2024/ValidateAndApplyPropertyDescriptor.js @@ -10,7 +10,7 @@ var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); -var IsPropertyKey = require('./IsPropertyKey'); +var isPropertyKey = require('../helpers/isPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); @@ -26,7 +26,7 @@ module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, D if (typeof O !== 'undefined' && !isObject(O)) { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } - if (!IsPropertyKey(P)) { + if (!isPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (typeof extensible !== 'boolean') { diff --git a/helpers/isPropertyKey.js b/helpers/isPropertyKey.js new file mode 100644 index 00000000..4b1c5766 --- /dev/null +++ b/helpers/isPropertyKey.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function isPropertyKey(argument) { + return typeof argument === 'string' || typeof argument === 'symbol'; +};