pax_global_header00006660000000000000000000000064143176143020014513gustar00rootroot0000000000000052 comment=00f5e26e233404ffb6baf347db0ff3bd9f8b2b14 es-abstract-1.20.4/000077500000000000000000000000001431761430200140075ustar00rootroot00000000000000es-abstract-1.20.4/.editorconfig000066400000000000000000000004701431761430200164650ustar00rootroot00000000000000root = true [*] indent_style = tab; insert_final_newline = true; quote_type = auto; space_after_anonymous_functions = true; space_after_control_statements = true; spaces_around_operators = true; trim_trailing_whitespace = true; spaces_in_brackets = false; end_of_line = lf; [CHANGELOG.md] indent_style = space es-abstract-1.20.4/.eslintrc000066400000000000000000000022751431761430200156410ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "env": { "es6": true, }, "rules": { "array-bracket-newline": 0, "complexity": 0, "eqeqeq": [2, "allow-null"], "func-name-matching": 0, "id-length": [2, { "min": 1, "max": 40 }], "max-params": [2, 4], "max-statements-per-line": [2, { "max": 2 }], "multiline-comment-style": 0, "no-magic-numbers": 0, "new-cap": 0, "no-extra-parens": 1, "sort-keys": 0, }, "overrides": [ { "files": "GetIntrinsic.js", "rules": { "max-statements": 0, } }, { "files": "operations/*", "rules": { "max-lines": 0, }, }, { "files": [ "operations/deltas.js", "operations/getOps.js", "operations/spackle.js", "operations/years.js", ], "extends": "@ljharb/eslint-config/node/latest", "rules": { "complexity": 0, "func-style": 0, "max-lines-per-function": 0, "max-nested-callbacks": 0, "max-statements": 0, "no-magic-numbers": 0, "no-throw-literal": 0, }, }, { "files": "test/**", "extends": "@ljharb/eslint-config/tests", "rules": { "max-len": 0, "max-lines-per-function": 0, "no-implicit-coercion": 0, "no-invalid-this": 1, }, }, ], } es-abstract-1.20.4/.gitattributes000066400000000000000000001572131431761430200167130ustar00rootroot000000000000002015/AbstractRelationalComparison.js spackled linguist-generated=true 2015/DateFromTime.js spackled linguist-generated=true 2015/Day.js spackled linguist-generated=true 2015/DayFromYear.js spackled linguist-generated=true 2015/DayWithinYear.js spackled linguist-generated=true 2015/DaysInYear.js spackled linguist-generated=true 2015/HourFromTime.js spackled linguist-generated=true 2015/InLeapYear.js spackled linguist-generated=true 2015/IsCallable.js spackled linguist-generated=true 2015/IsPropertyDescriptor.js spackled linguist-generated=true 2015/MakeDate.js spackled linguist-generated=true 2015/MakeDay.js spackled linguist-generated=true 2015/MakeTime.js spackled linguist-generated=true 2015/MinFromTime.js spackled linguist-generated=true 2015/MonthFromTime.js spackled linguist-generated=true 2015/SameValue.js spackled linguist-generated=true 2015/SecFromTime.js spackled linguist-generated=true 2015/StrictEqualityComparison.js spackled linguist-generated=true 2015/TimeClip.js spackled linguist-generated=true 2015/TimeFromYear.js spackled linguist-generated=true 2015/TimeWithinDay.js spackled linguist-generated=true 2015/ToBoolean.js spackled linguist-generated=true 2015/ToInt32.js spackled linguist-generated=true 2015/ToPropertyDescriptor.js spackled linguist-generated=true 2015/ToUint16.js spackled linguist-generated=true 2015/ToUint32.js spackled linguist-generated=true 2015/WeekDay.js spackled linguist-generated=true 2015/YearFromTime.js spackled linguist-generated=true 2015/abs.js spackled linguist-generated=true 2015/floor.js spackled linguist-generated=true 2015/modulo.js spackled linguist-generated=true 2015/msFromTime.js spackled linguist-generated=true 2016/AbstractEqualityComparison.js spackled linguist-generated=true 2016/AbstractRelationalComparison.js spackled linguist-generated=true 2016/AdvanceStringIndex.js spackled linguist-generated=true 2016/ArrayCreate.js spackled linguist-generated=true 2016/ArraySetLength.js spackled linguist-generated=true 2016/ArraySpeciesCreate.js spackled linguist-generated=true 2016/Call.js spackled linguist-generated=true 2016/CanonicalNumericIndexString.js spackled linguist-generated=true 2016/CharacterRange.js spackled linguist-generated=true 2016/CompletePropertyDescriptor.js spackled linguist-generated=true 2016/CreateDataProperty.js spackled linguist-generated=true 2016/CreateDataPropertyOrThrow.js spackled linguist-generated=true 2016/CreateHTML.js spackled linguist-generated=true 2016/CreateIterResultObject.js spackled linguist-generated=true 2016/CreateListFromArrayLike.js spackled linguist-generated=true 2016/CreateMethodProperty.js spackled linguist-generated=true 2016/DateFromTime.js spackled linguist-generated=true 2016/Day.js spackled linguist-generated=true 2016/DayFromYear.js spackled linguist-generated=true 2016/DayWithinYear.js spackled linguist-generated=true 2016/DaysInYear.js spackled linguist-generated=true 2016/DefinePropertyOrThrow.js spackled linguist-generated=true 2016/DeletePropertyOrThrow.js spackled linguist-generated=true 2016/EnumerableOwnNames.js spackled linguist-generated=true 2016/FromPropertyDescriptor.js spackled linguist-generated=true 2016/Get.js spackled linguist-generated=true 2016/GetIterator.js spackled linguist-generated=true 2016/GetMethod.js spackled linguist-generated=true 2016/GetOwnPropertyKeys.js spackled linguist-generated=true 2016/GetPrototypeFromConstructor.js spackled linguist-generated=true 2016/GetSubstitution.js spackled linguist-generated=true 2016/GetV.js spackled linguist-generated=true 2016/HasOwnProperty.js spackled linguist-generated=true 2016/HasProperty.js spackled linguist-generated=true 2016/HourFromTime.js spackled linguist-generated=true 2016/InLeapYear.js spackled linguist-generated=true 2016/InstanceofOperator.js spackled linguist-generated=true 2016/Invoke.js spackled linguist-generated=true 2016/IsAccessorDescriptor.js spackled linguist-generated=true 2016/IsArray.js spackled linguist-generated=true 2016/IsCallable.js spackled linguist-generated=true 2016/IsCompatiblePropertyDescriptor.js spackled linguist-generated=true 2016/IsConcatSpreadable.js spackled linguist-generated=true 2016/IsConstructor.js spackled linguist-generated=true 2016/IsDataDescriptor.js spackled linguist-generated=true 2016/IsExtensible.js spackled linguist-generated=true 2016/IsGenericDescriptor.js spackled linguist-generated=true 2016/IsInteger.js spackled linguist-generated=true 2016/IsPromise.js spackled linguist-generated=true 2016/IsPropertyDescriptor.js spackled linguist-generated=true 2016/IsPropertyKey.js spackled linguist-generated=true 2016/IsRegExp.js spackled linguist-generated=true 2016/IteratorClose.js spackled linguist-generated=true 2016/IteratorComplete.js spackled linguist-generated=true 2016/IteratorNext.js spackled linguist-generated=true 2016/IteratorStep.js spackled linguist-generated=true 2016/IteratorValue.js spackled linguist-generated=true 2016/MakeDate.js spackled linguist-generated=true 2016/MakeDay.js spackled linguist-generated=true 2016/MakeTime.js spackled linguist-generated=true 2016/MinFromTime.js spackled linguist-generated=true 2016/MonthFromTime.js spackled linguist-generated=true 2016/ObjectCreate.js spackled linguist-generated=true 2016/ObjectDefineProperties.js spackled linguist-generated=true 2016/OrdinaryCreateFromConstructor.js spackled linguist-generated=true 2016/OrdinaryDefineOwnProperty.js spackled linguist-generated=true 2016/OrdinaryGetOwnProperty.js spackled linguist-generated=true 2016/OrdinaryHasInstance.js spackled linguist-generated=true 2016/OrdinaryHasProperty.js spackled linguist-generated=true 2016/QuoteJSONString.js spackled linguist-generated=true 2016/RegExpCreate.js spackled linguist-generated=true 2016/RegExpExec.js spackled linguist-generated=true 2016/RequireObjectCoercible.js spackled linguist-generated=true 2016/SameValue.js spackled linguist-generated=true 2016/SameValueZero.js spackled linguist-generated=true 2016/SecFromTime.js spackled linguist-generated=true 2016/Set.js spackled linguist-generated=true 2016/SetFunctionName.js spackled linguist-generated=true 2016/SetIntegrityLevel.js spackled linguist-generated=true 2016/SpeciesConstructor.js spackled linguist-generated=true 2016/SplitMatch.js spackled linguist-generated=true 2016/StrictEqualityComparison.js spackled linguist-generated=true 2016/StringCreate.js spackled linguist-generated=true 2016/SymbolDescriptiveString.js spackled linguist-generated=true 2016/TestIntegrityLevel.js spackled linguist-generated=true 2016/TimeClip.js spackled linguist-generated=true 2016/TimeFromYear.js spackled linguist-generated=true 2016/TimeWithinDay.js spackled linguist-generated=true 2016/ToBoolean.js spackled linguist-generated=true 2016/ToDateString.js spackled linguist-generated=true 2016/ToInt16.js spackled linguist-generated=true 2016/ToInt32.js spackled linguist-generated=true 2016/ToInt8.js spackled linguist-generated=true 2016/ToInteger.js spackled linguist-generated=true 2016/ToLength.js spackled linguist-generated=true 2016/ToNumber.js spackled linguist-generated=true 2016/ToObject.js spackled linguist-generated=true 2016/ToPrimitive.js spackled linguist-generated=true 2016/ToPropertyDescriptor.js spackled linguist-generated=true 2016/ToPropertyKey.js spackled linguist-generated=true 2016/ToString.js spackled linguist-generated=true 2016/ToUint16.js spackled linguist-generated=true 2016/ToUint32.js spackled linguist-generated=true 2016/ToUint8.js spackled linguist-generated=true 2016/ToUint8Clamp.js spackled linguist-generated=true 2016/Type.js spackled linguist-generated=true 2016/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true 2016/WeekDay.js spackled linguist-generated=true 2016/YearFromTime.js spackled linguist-generated=true 2016/abs.js spackled linguist-generated=true 2016/floor.js spackled linguist-generated=true 2016/modulo.js spackled linguist-generated=true 2016/msFromTime.js spackled linguist-generated=true 2016/thisBooleanValue.js spackled linguist-generated=true 2016/thisNumberValue.js spackled linguist-generated=true 2016/thisStringValue.js spackled linguist-generated=true 2016/thisTimeValue.js spackled linguist-generated=true 2017/AbstractEqualityComparison.js spackled linguist-generated=true 2017/AbstractRelationalComparison.js spackled linguist-generated=true 2017/AdvanceStringIndex.js spackled linguist-generated=true 2017/ArrayCreate.js spackled linguist-generated=true 2017/ArraySetLength.js spackled linguist-generated=true 2017/ArraySpeciesCreate.js spackled linguist-generated=true 2017/Call.js spackled linguist-generated=true 2017/CanonicalNumericIndexString.js spackled linguist-generated=true 2017/CharacterRange.js spackled linguist-generated=true 2017/CompletePropertyDescriptor.js spackled linguist-generated=true 2017/CreateDataProperty.js spackled linguist-generated=true 2017/CreateDataPropertyOrThrow.js spackled linguist-generated=true 2017/CreateHTML.js spackled linguist-generated=true 2017/CreateIterResultObject.js spackled linguist-generated=true 2017/CreateListFromArrayLike.js spackled linguist-generated=true 2017/CreateMethodProperty.js spackled linguist-generated=true 2017/DateFromTime.js spackled linguist-generated=true 2017/Day.js spackled linguist-generated=true 2017/DayFromYear.js spackled linguist-generated=true 2017/DayWithinYear.js spackled linguist-generated=true 2017/DaysInYear.js spackled linguist-generated=true 2017/DefinePropertyOrThrow.js spackled linguist-generated=true 2017/DeletePropertyOrThrow.js spackled linguist-generated=true 2017/FromPropertyDescriptor.js spackled linguist-generated=true 2017/Get.js spackled linguist-generated=true 2017/GetIterator.js spackled linguist-generated=true 2017/GetMethod.js spackled linguist-generated=true 2017/GetOwnPropertyKeys.js spackled linguist-generated=true 2017/GetPrototypeFromConstructor.js spackled linguist-generated=true 2017/GetSubstitution.js spackled linguist-generated=true 2017/GetV.js spackled linguist-generated=true 2017/HasOwnProperty.js spackled linguist-generated=true 2017/HasProperty.js spackled linguist-generated=true 2017/HourFromTime.js spackled linguist-generated=true 2017/InLeapYear.js spackled linguist-generated=true 2017/InstanceofOperator.js spackled linguist-generated=true 2017/Invoke.js spackled linguist-generated=true 2017/IsAccessorDescriptor.js spackled linguist-generated=true 2017/IsArray.js spackled linguist-generated=true 2017/IsCallable.js spackled linguist-generated=true 2017/IsCompatiblePropertyDescriptor.js spackled linguist-generated=true 2017/IsConcatSpreadable.js spackled linguist-generated=true 2017/IsConstructor.js spackled linguist-generated=true 2017/IsDataDescriptor.js spackled linguist-generated=true 2017/IsExtensible.js spackled linguist-generated=true 2017/IsGenericDescriptor.js spackled linguist-generated=true 2017/IsInteger.js spackled linguist-generated=true 2017/IsPromise.js spackled linguist-generated=true 2017/IsPropertyDescriptor.js spackled linguist-generated=true 2017/IsPropertyKey.js spackled linguist-generated=true 2017/IsRegExp.js spackled linguist-generated=true 2017/IteratorClose.js spackled linguist-generated=true 2017/IteratorComplete.js spackled linguist-generated=true 2017/IteratorNext.js spackled linguist-generated=true 2017/IteratorStep.js spackled linguist-generated=true 2017/IteratorValue.js spackled linguist-generated=true 2017/MakeDate.js spackled linguist-generated=true 2017/MakeDay.js spackled linguist-generated=true 2017/MakeTime.js spackled linguist-generated=true 2017/MinFromTime.js spackled linguist-generated=true 2017/MonthFromTime.js spackled linguist-generated=true 2017/ObjectCreate.js spackled linguist-generated=true 2017/ObjectDefineProperties.js spackled linguist-generated=true 2017/OrdinaryCreateFromConstructor.js spackled linguist-generated=true 2017/OrdinaryDefineOwnProperty.js spackled linguist-generated=true 2017/OrdinaryGetOwnProperty.js spackled linguist-generated=true 2017/OrdinaryGetPrototypeOf.js spackled linguist-generated=true 2017/OrdinaryHasInstance.js spackled linguist-generated=true 2017/OrdinaryHasProperty.js spackled linguist-generated=true 2017/OrdinarySetPrototypeOf.js spackled linguist-generated=true 2017/QuoteJSONString.js spackled linguist-generated=true 2017/RegExpCreate.js spackled linguist-generated=true 2017/RegExpExec.js spackled linguist-generated=true 2017/RequireObjectCoercible.js spackled linguist-generated=true 2017/SameValue.js spackled linguist-generated=true 2017/SameValueNonNumber.js spackled linguist-generated=true 2017/SameValueZero.js spackled linguist-generated=true 2017/SecFromTime.js spackled linguist-generated=true 2017/Set.js spackled linguist-generated=true 2017/SetFunctionName.js spackled linguist-generated=true 2017/SetIntegrityLevel.js spackled linguist-generated=true 2017/SpeciesConstructor.js spackled linguist-generated=true 2017/SplitMatch.js spackled linguist-generated=true 2017/StrictEqualityComparison.js spackled linguist-generated=true 2017/StringCreate.js spackled linguist-generated=true 2017/SymbolDescriptiveString.js spackled linguist-generated=true 2017/TestIntegrityLevel.js spackled linguist-generated=true 2017/TimeClip.js spackled linguist-generated=true 2017/TimeFromYear.js spackled linguist-generated=true 2017/TimeWithinDay.js spackled linguist-generated=true 2017/ToBoolean.js spackled linguist-generated=true 2017/ToDateString.js spackled linguist-generated=true 2017/ToInt16.js spackled linguist-generated=true 2017/ToInt32.js spackled linguist-generated=true 2017/ToInt8.js spackled linguist-generated=true 2017/ToInteger.js spackled linguist-generated=true 2017/ToLength.js spackled linguist-generated=true 2017/ToNumber.js spackled linguist-generated=true 2017/ToObject.js spackled linguist-generated=true 2017/ToPrimitive.js spackled linguist-generated=true 2017/ToPropertyDescriptor.js spackled linguist-generated=true 2017/ToPropertyKey.js spackled linguist-generated=true 2017/ToString.js spackled linguist-generated=true 2017/ToUint16.js spackled linguist-generated=true 2017/ToUint32.js spackled linguist-generated=true 2017/ToUint8.js spackled linguist-generated=true 2017/ToUint8Clamp.js spackled linguist-generated=true 2017/Type.js spackled linguist-generated=true 2017/UTF16Decode.js spackled linguist-generated=true 2017/UTF16Encoding.js spackled linguist-generated=true 2017/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true 2017/WeekDay.js spackled linguist-generated=true 2017/YearFromTime.js spackled linguist-generated=true 2017/abs.js spackled linguist-generated=true 2017/floor.js spackled linguist-generated=true 2017/modulo.js spackled linguist-generated=true 2017/msFromTime.js spackled linguist-generated=true 2017/thisBooleanValue.js spackled linguist-generated=true 2017/thisNumberValue.js spackled linguist-generated=true 2017/thisStringValue.js spackled linguist-generated=true 2017/thisTimeValue.js spackled linguist-generated=true 2018/AbstractEqualityComparison.js spackled linguist-generated=true 2018/AdvanceStringIndex.js spackled linguist-generated=true 2018/ArrayCreate.js spackled linguist-generated=true 2018/ArraySetLength.js spackled linguist-generated=true 2018/ArraySpeciesCreate.js spackled linguist-generated=true 2018/Call.js spackled linguist-generated=true 2018/CanonicalNumericIndexString.js spackled linguist-generated=true 2018/CharacterRange.js spackled linguist-generated=true 2018/CompletePropertyDescriptor.js spackled linguist-generated=true 2018/CreateDataProperty.js spackled linguist-generated=true 2018/CreateDataPropertyOrThrow.js spackled linguist-generated=true 2018/CreateHTML.js spackled linguist-generated=true 2018/CreateIterResultObject.js spackled linguist-generated=true 2018/CreateListFromArrayLike.js spackled linguist-generated=true 2018/CreateMethodProperty.js spackled linguist-generated=true 2018/DateFromTime.js spackled linguist-generated=true 2018/Day.js spackled linguist-generated=true 2018/DayFromYear.js spackled linguist-generated=true 2018/DayWithinYear.js spackled linguist-generated=true 2018/DaysInYear.js spackled linguist-generated=true 2018/DefinePropertyOrThrow.js spackled linguist-generated=true 2018/DeletePropertyOrThrow.js spackled linguist-generated=true 2018/FromPropertyDescriptor.js spackled linguist-generated=true 2018/Get.js spackled linguist-generated=true 2018/GetIterator.js spackled linguist-generated=true 2018/GetMethod.js spackled linguist-generated=true 2018/GetOwnPropertyKeys.js spackled linguist-generated=true 2018/GetPrototypeFromConstructor.js spackled linguist-generated=true 2018/GetV.js spackled linguist-generated=true 2018/HasOwnProperty.js spackled linguist-generated=true 2018/HasProperty.js spackled linguist-generated=true 2018/HourFromTime.js spackled linguist-generated=true 2018/InLeapYear.js spackled linguist-generated=true 2018/InstanceofOperator.js spackled linguist-generated=true 2018/Invoke.js spackled linguist-generated=true 2018/IsAccessorDescriptor.js spackled linguist-generated=true 2018/IsArray.js spackled linguist-generated=true 2018/IsCallable.js spackled linguist-generated=true 2018/IsCompatiblePropertyDescriptor.js spackled linguist-generated=true 2018/IsConcatSpreadable.js spackled linguist-generated=true 2018/IsConstructor.js spackled linguist-generated=true 2018/IsDataDescriptor.js spackled linguist-generated=true 2018/IsExtensible.js spackled linguist-generated=true 2018/IsGenericDescriptor.js spackled linguist-generated=true 2018/IsInteger.js spackled linguist-generated=true 2018/IsPromise.js spackled linguist-generated=true 2018/IsPropertyKey.js spackled linguist-generated=true 2018/IsRegExp.js spackled linguist-generated=true 2018/IsSharedArrayBuffer.js spackled linguist-generated=true 2018/IterableToList.js spackled linguist-generated=true 2018/IteratorClose.js spackled linguist-generated=true 2018/IteratorComplete.js spackled linguist-generated=true 2018/IteratorNext.js spackled linguist-generated=true 2018/IteratorStep.js spackled linguist-generated=true 2018/IteratorValue.js spackled linguist-generated=true 2018/MakeDate.js spackled linguist-generated=true 2018/MakeDay.js spackled linguist-generated=true 2018/MakeTime.js spackled linguist-generated=true 2018/MinFromTime.js spackled linguist-generated=true 2018/MonthFromTime.js spackled linguist-generated=true 2018/ObjectCreate.js spackled linguist-generated=true 2018/ObjectDefineProperties.js spackled linguist-generated=true 2018/OrdinaryCreateFromConstructor.js spackled linguist-generated=true 2018/OrdinaryDefineOwnProperty.js spackled linguist-generated=true 2018/OrdinaryGetOwnProperty.js spackled linguist-generated=true 2018/OrdinaryGetPrototypeOf.js spackled linguist-generated=true 2018/OrdinaryHasInstance.js spackled linguist-generated=true 2018/OrdinaryHasProperty.js spackled linguist-generated=true 2018/OrdinarySetPrototypeOf.js spackled linguist-generated=true 2018/OrdinaryToPrimitive.js spackled linguist-generated=true 2018/RegExpCreate.js spackled linguist-generated=true 2018/RegExpExec.js spackled linguist-generated=true 2018/RequireObjectCoercible.js spackled linguist-generated=true 2018/SameValue.js spackled linguist-generated=true 2018/SameValueNonNumber.js spackled linguist-generated=true 2018/SameValueZero.js spackled linguist-generated=true 2018/SecFromTime.js spackled linguist-generated=true 2018/Set.js spackled linguist-generated=true 2018/SetFunctionName.js spackled linguist-generated=true 2018/SetIntegrityLevel.js spackled linguist-generated=true 2018/SpeciesConstructor.js spackled linguist-generated=true 2018/SplitMatch.js spackled linguist-generated=true 2018/StrictEqualityComparison.js spackled linguist-generated=true 2018/StringCreate.js spackled linguist-generated=true 2018/StringGetOwnProperty.js spackled linguist-generated=true 2018/SymbolDescriptiveString.js spackled linguist-generated=true 2018/TestIntegrityLevel.js spackled linguist-generated=true 2018/TimeClip.js spackled linguist-generated=true 2018/TimeFromYear.js spackled linguist-generated=true 2018/TimeWithinDay.js spackled linguist-generated=true 2018/ToBoolean.js spackled linguist-generated=true 2018/ToDateString.js spackled linguist-generated=true 2018/ToIndex.js spackled linguist-generated=true 2018/ToInt16.js spackled linguist-generated=true 2018/ToInt32.js spackled linguist-generated=true 2018/ToInt8.js spackled linguist-generated=true 2018/ToInteger.js spackled linguist-generated=true 2018/ToLength.js spackled linguist-generated=true 2018/ToNumber.js spackled linguist-generated=true 2018/ToObject.js spackled linguist-generated=true 2018/ToPrimitive.js spackled linguist-generated=true 2018/ToPropertyDescriptor.js spackled linguist-generated=true 2018/ToPropertyKey.js spackled linguist-generated=true 2018/ToString.js spackled linguist-generated=true 2018/ToUint16.js spackled linguist-generated=true 2018/ToUint32.js spackled linguist-generated=true 2018/ToUint8.js spackled linguist-generated=true 2018/ToUint8Clamp.js spackled linguist-generated=true 2018/Type.js spackled linguist-generated=true 2018/UTF16Decode.js spackled linguist-generated=true 2018/UTF16Encoding.js spackled linguist-generated=true 2018/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true 2018/WeekDay.js spackled linguist-generated=true 2018/YearFromTime.js spackled linguist-generated=true 2018/abs.js spackled linguist-generated=true 2018/floor.js spackled linguist-generated=true 2018/modulo.js spackled linguist-generated=true 2018/msFromTime.js spackled linguist-generated=true 2018/thisBooleanValue.js spackled linguist-generated=true 2018/thisNumberValue.js spackled linguist-generated=true 2018/thisStringValue.js spackled linguist-generated=true 2018/thisTimeValue.js spackled linguist-generated=true 2019/AbstractEqualityComparison.js spackled linguist-generated=true 2019/AbstractRelationalComparison.js spackled linguist-generated=true 2019/AdvanceStringIndex.js spackled linguist-generated=true 2019/ArrayCreate.js spackled linguist-generated=true 2019/ArraySetLength.js spackled linguist-generated=true 2019/ArraySpeciesCreate.js spackled linguist-generated=true 2019/Call.js spackled linguist-generated=true 2019/CanonicalNumericIndexString.js spackled linguist-generated=true 2019/CharacterRange.js spackled linguist-generated=true 2019/CompletePropertyDescriptor.js spackled linguist-generated=true 2019/CopyDataProperties.js spackled linguist-generated=true 2019/CreateDataProperty.js spackled linguist-generated=true 2019/CreateDataPropertyOrThrow.js spackled linguist-generated=true 2019/CreateHTML.js spackled linguist-generated=true 2019/CreateIterResultObject.js spackled linguist-generated=true 2019/CreateListFromArrayLike.js spackled linguist-generated=true 2019/CreateMethodProperty.js spackled linguist-generated=true 2019/DateFromTime.js spackled linguist-generated=true 2019/DateString.js spackled linguist-generated=true 2019/Day.js spackled linguist-generated=true 2019/DayFromYear.js spackled linguist-generated=true 2019/DayWithinYear.js spackled linguist-generated=true 2019/DaysInYear.js spackled linguist-generated=true 2019/DefinePropertyOrThrow.js spackled linguist-generated=true 2019/DeletePropertyOrThrow.js spackled linguist-generated=true 2019/EnumerableOwnPropertyNames.js spackled linguist-generated=true 2019/FromPropertyDescriptor.js spackled linguist-generated=true 2019/Get.js spackled linguist-generated=true 2019/GetIterator.js spackled linguist-generated=true 2019/GetMethod.js spackled linguist-generated=true 2019/GetOwnPropertyKeys.js spackled linguist-generated=true 2019/GetPrototypeFromConstructor.js spackled linguist-generated=true 2019/GetSubstitution.js spackled linguist-generated=true 2019/GetV.js spackled linguist-generated=true 2019/HasOwnProperty.js spackled linguist-generated=true 2019/HasProperty.js spackled linguist-generated=true 2019/HourFromTime.js spackled linguist-generated=true 2019/InLeapYear.js spackled linguist-generated=true 2019/InstanceofOperator.js spackled linguist-generated=true 2019/Invoke.js spackled linguist-generated=true 2019/IsAccessorDescriptor.js spackled linguist-generated=true 2019/IsArray.js spackled linguist-generated=true 2019/IsCallable.js spackled linguist-generated=true 2019/IsCompatiblePropertyDescriptor.js spackled linguist-generated=true 2019/IsConcatSpreadable.js spackled linguist-generated=true 2019/IsConstructor.js spackled linguist-generated=true 2019/IsDataDescriptor.js spackled linguist-generated=true 2019/IsExtensible.js spackled linguist-generated=true 2019/IsGenericDescriptor.js spackled linguist-generated=true 2019/IsInteger.js spackled linguist-generated=true 2019/IsPromise.js spackled linguist-generated=true 2019/IsPropertyKey.js spackled linguist-generated=true 2019/IsRegExp.js spackled linguist-generated=true 2019/IsSharedArrayBuffer.js spackled linguist-generated=true 2019/IsStringPrefix.js spackled linguist-generated=true 2019/IterableToList.js spackled linguist-generated=true 2019/IteratorClose.js spackled linguist-generated=true 2019/IteratorComplete.js spackled linguist-generated=true 2019/IteratorNext.js spackled linguist-generated=true 2019/IteratorStep.js spackled linguist-generated=true 2019/IteratorValue.js spackled linguist-generated=true 2019/MakeDate.js spackled linguist-generated=true 2019/MakeDay.js spackled linguist-generated=true 2019/MakeTime.js spackled linguist-generated=true 2019/MinFromTime.js spackled linguist-generated=true 2019/MonthFromTime.js spackled linguist-generated=true 2019/NumberToString.js spackled linguist-generated=true 2019/ObjectCreate.js spackled linguist-generated=true 2019/ObjectDefineProperties.js spackled linguist-generated=true 2019/OrdinaryCreateFromConstructor.js spackled linguist-generated=true 2019/OrdinaryDefineOwnProperty.js spackled linguist-generated=true 2019/OrdinaryGetOwnProperty.js spackled linguist-generated=true 2019/OrdinaryGetPrototypeOf.js spackled linguist-generated=true 2019/OrdinaryHasInstance.js spackled linguist-generated=true 2019/OrdinaryHasProperty.js spackled linguist-generated=true 2019/OrdinarySetPrototypeOf.js spackled linguist-generated=true 2019/OrdinaryToPrimitive.js spackled linguist-generated=true 2019/PromiseResolve.js spackled linguist-generated=true 2019/RegExpCreate.js spackled linguist-generated=true 2019/RegExpExec.js spackled linguist-generated=true 2019/RequireObjectCoercible.js spackled linguist-generated=true 2019/SameValue.js spackled linguist-generated=true 2019/SameValueNonNumber.js spackled linguist-generated=true 2019/SameValueZero.js spackled linguist-generated=true 2019/SecFromTime.js spackled linguist-generated=true 2019/Set.js spackled linguist-generated=true 2019/SetFunctionLength.js spackled linguist-generated=true 2019/SetFunctionName.js spackled linguist-generated=true 2019/SetIntegrityLevel.js spackled linguist-generated=true 2019/SpeciesConstructor.js spackled linguist-generated=true 2019/SplitMatch.js spackled linguist-generated=true 2019/StrictEqualityComparison.js spackled linguist-generated=true 2019/StringCreate.js spackled linguist-generated=true 2019/StringGetOwnProperty.js spackled linguist-generated=true 2019/SymbolDescriptiveString.js spackled linguist-generated=true 2019/TestIntegrityLevel.js spackled linguist-generated=true 2019/TimeClip.js spackled linguist-generated=true 2019/TimeFromYear.js spackled linguist-generated=true 2019/TimeString.js spackled linguist-generated=true 2019/TimeWithinDay.js spackled linguist-generated=true 2019/ToBoolean.js spackled linguist-generated=true 2019/ToDateString.js spackled linguist-generated=true 2019/ToIndex.js spackled linguist-generated=true 2019/ToInt16.js spackled linguist-generated=true 2019/ToInt32.js spackled linguist-generated=true 2019/ToInt8.js spackled linguist-generated=true 2019/ToInteger.js spackled linguist-generated=true 2019/ToLength.js spackled linguist-generated=true 2019/ToNumber.js spackled linguist-generated=true 2019/ToObject.js spackled linguist-generated=true 2019/ToPrimitive.js spackled linguist-generated=true 2019/ToPropertyDescriptor.js spackled linguist-generated=true 2019/ToPropertyKey.js spackled linguist-generated=true 2019/ToString.js spackled linguist-generated=true 2019/ToUint16.js spackled linguist-generated=true 2019/ToUint32.js spackled linguist-generated=true 2019/ToUint8.js spackled linguist-generated=true 2019/ToUint8Clamp.js spackled linguist-generated=true 2019/Type.js spackled linguist-generated=true 2019/UTF16Decode.js spackled linguist-generated=true 2019/UTF16Encoding.js spackled linguist-generated=true 2019/UnicodeEscape.js spackled linguist-generated=true 2019/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true 2019/WeekDay.js spackled linguist-generated=true 2019/YearFromTime.js spackled linguist-generated=true 2019/abs.js spackled linguist-generated=true 2019/floor.js spackled linguist-generated=true 2019/modulo.js spackled linguist-generated=true 2019/msFromTime.js spackled linguist-generated=true 2019/thisBooleanValue.js spackled linguist-generated=true 2019/thisNumberValue.js spackled linguist-generated=true 2019/thisStringValue.js spackled linguist-generated=true 2019/thisSymbolValue.js spackled linguist-generated=true 2020/AddEntriesFromIterable.js spackled linguist-generated=true 2020/ArrayCreate.js spackled linguist-generated=true 2020/ArraySetLength.js spackled linguist-generated=true 2020/ArraySpeciesCreate.js spackled linguist-generated=true 2020/Call.js spackled linguist-generated=true 2020/CanonicalNumericIndexString.js spackled linguist-generated=true 2020/CharacterRange.js spackled linguist-generated=true 2020/CompletePropertyDescriptor.js spackled linguist-generated=true 2020/CreateDataProperty.js spackled linguist-generated=true 2020/CreateDataPropertyOrThrow.js spackled linguist-generated=true 2020/CreateHTML.js spackled linguist-generated=true 2020/CreateIterResultObject.js spackled linguist-generated=true 2020/CreateMethodProperty.js spackled linguist-generated=true 2020/DateFromTime.js spackled linguist-generated=true 2020/DateString.js spackled linguist-generated=true 2020/Day.js spackled linguist-generated=true 2020/DayFromYear.js spackled linguist-generated=true 2020/DayWithinYear.js spackled linguist-generated=true 2020/DaysInYear.js spackled linguist-generated=true 2020/DefinePropertyOrThrow.js spackled linguist-generated=true 2020/DeletePropertyOrThrow.js spackled linguist-generated=true 2020/EnumerableOwnPropertyNames.js spackled linguist-generated=true 2020/FromPropertyDescriptor.js spackled linguist-generated=true 2020/Get.js spackled linguist-generated=true 2020/GetMethod.js spackled linguist-generated=true 2020/GetOwnPropertyKeys.js spackled linguist-generated=true 2020/GetPrototypeFromConstructor.js spackled linguist-generated=true 2020/GetSubstitution.js spackled linguist-generated=true 2020/GetV.js spackled linguist-generated=true 2020/HasOwnProperty.js spackled linguist-generated=true 2020/HasProperty.js spackled linguist-generated=true 2020/HourFromTime.js spackled linguist-generated=true 2020/InLeapYear.js spackled linguist-generated=true 2020/InstanceofOperator.js spackled linguist-generated=true 2020/Invoke.js spackled linguist-generated=true 2020/IsAccessorDescriptor.js spackled linguist-generated=true 2020/IsArray.js spackled linguist-generated=true 2020/IsCallable.js spackled linguist-generated=true 2020/IsCompatiblePropertyDescriptor.js spackled linguist-generated=true 2020/IsConcatSpreadable.js spackled linguist-generated=true 2020/IsConstructor.js spackled linguist-generated=true 2020/IsDataDescriptor.js spackled linguist-generated=true 2020/IsExtensible.js spackled linguist-generated=true 2020/IsGenericDescriptor.js spackled linguist-generated=true 2020/IsInteger.js spackled linguist-generated=true 2020/IsPromise.js spackled linguist-generated=true 2020/IsPropertyKey.js spackled linguist-generated=true 2020/IsRegExp.js spackled linguist-generated=true 2020/IsSharedArrayBuffer.js spackled linguist-generated=true 2020/IsStringPrefix.js spackled linguist-generated=true 2020/IteratorClose.js spackled linguist-generated=true 2020/IteratorComplete.js spackled linguist-generated=true 2020/IteratorNext.js spackled linguist-generated=true 2020/IteratorStep.js spackled linguist-generated=true 2020/IteratorValue.js spackled linguist-generated=true 2020/MakeDate.js spackled linguist-generated=true 2020/MakeDay.js spackled linguist-generated=true 2020/MakeTime.js spackled linguist-generated=true 2020/MinFromTime.js spackled linguist-generated=true 2020/MonthFromTime.js spackled linguist-generated=true 2020/ObjectDefineProperties.js spackled linguist-generated=true 2020/OrdinaryDefineOwnProperty.js spackled linguist-generated=true 2020/OrdinaryGetOwnProperty.js spackled linguist-generated=true 2020/OrdinaryGetPrototypeOf.js spackled linguist-generated=true 2020/OrdinaryHasInstance.js spackled linguist-generated=true 2020/OrdinaryHasProperty.js spackled linguist-generated=true 2020/OrdinarySetPrototypeOf.js spackled linguist-generated=true 2020/OrdinaryToPrimitive.js spackled linguist-generated=true 2020/PromiseResolve.js spackled linguist-generated=true 2020/RegExpCreate.js spackled linguist-generated=true 2020/RegExpExec.js spackled linguist-generated=true 2020/RequireObjectCoercible.js spackled linguist-generated=true 2020/SameValue.js spackled linguist-generated=true 2020/SameValueZero.js spackled linguist-generated=true 2020/SecFromTime.js spackled linguist-generated=true 2020/Set.js spackled linguist-generated=true 2020/SetFunctionName.js spackled linguist-generated=true 2020/SetIntegrityLevel.js spackled linguist-generated=true 2020/SpeciesConstructor.js spackled linguist-generated=true 2020/SplitMatch.js spackled linguist-generated=true 2020/StrictEqualityComparison.js spackled linguist-generated=true 2020/StringCreate.js spackled linguist-generated=true 2020/StringGetOwnProperty.js spackled linguist-generated=true 2020/SymbolDescriptiveString.js spackled linguist-generated=true 2020/TestIntegrityLevel.js spackled linguist-generated=true 2020/TimeClip.js spackled linguist-generated=true 2020/TimeFromYear.js spackled linguist-generated=true 2020/TimeString.js spackled linguist-generated=true 2020/TimeWithinDay.js spackled linguist-generated=true 2020/ToBoolean.js spackled linguist-generated=true 2020/ToDateString.js spackled linguist-generated=true 2020/ToInt16.js spackled linguist-generated=true 2020/ToInt32.js spackled linguist-generated=true 2020/ToInt8.js spackled linguist-generated=true 2020/ToLength.js spackled linguist-generated=true 2020/ToObject.js spackled linguist-generated=true 2020/ToPrimitive.js spackled linguist-generated=true 2020/ToPropertyDescriptor.js spackled linguist-generated=true 2020/ToPropertyKey.js spackled linguist-generated=true 2020/ToString.js spackled linguist-generated=true 2020/ToUint16.js spackled linguist-generated=true 2020/ToUint32.js spackled linguist-generated=true 2020/ToUint8.js spackled linguist-generated=true 2020/ToUint8Clamp.js spackled linguist-generated=true 2020/TrimString.js spackled linguist-generated=true 2020/UTF16Encoding.js spackled linguist-generated=true 2020/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true 2020/WeekDay.js spackled linguist-generated=true 2020/YearFromTime.js spackled linguist-generated=true 2020/abs.js spackled linguist-generated=true 2020/floor.js spackled linguist-generated=true 2020/modulo.js spackled linguist-generated=true 2020/msFromTime.js spackled linguist-generated=true 2020/thisBooleanValue.js spackled linguist-generated=true 2020/thisNumberValue.js spackled linguist-generated=true 2020/thisStringValue.js spackled linguist-generated=true 2020/thisSymbolValue.js spackled linguist-generated=true 2020/thisTimeValue.js spackled linguist-generated=true 2021/AbstractEqualityComparison.js spackled linguist-generated=true 2021/AbstractRelationalComparison.js spackled linguist-generated=true 2021/AddEntriesFromIterable.js spackled linguist-generated=true 2021/ArraySetLength.js spackled linguist-generated=true 2021/BigInt/add.js spackled linguist-generated=true 2021/BigInt/bitwiseAND.js spackled linguist-generated=true 2021/BigInt/bitwiseNOT.js spackled linguist-generated=true 2021/BigInt/bitwiseOR.js spackled linguist-generated=true 2021/BigInt/bitwiseXOR.js spackled linguist-generated=true 2021/BigInt/divide.js spackled linguist-generated=true 2021/BigInt/equal.js spackled linguist-generated=true 2021/BigInt/exponentiate.js spackled linguist-generated=true 2021/BigInt/index.js spackled linguist-generated=true 2021/BigInt/leftShift.js spackled linguist-generated=true 2021/BigInt/lessThan.js spackled linguist-generated=true 2021/BigInt/multiply.js spackled linguist-generated=true 2021/BigInt/remainder.js spackled linguist-generated=true 2021/BigInt/sameValue.js spackled linguist-generated=true 2021/BigInt/sameValueZero.js spackled linguist-generated=true 2021/BigInt/signedRightShift.js spackled linguist-generated=true 2021/BigInt/subtract.js spackled linguist-generated=true 2021/BigInt/toString.js spackled linguist-generated=true 2021/BigInt/unaryMinus.js spackled linguist-generated=true 2021/BigInt/unsignedRightShift.js spackled linguist-generated=true 2021/BigIntBitwiseOp.js spackled linguist-generated=true 2021/BinaryAnd.js spackled linguist-generated=true 2021/BinaryOr.js spackled linguist-generated=true 2021/BinaryXor.js spackled linguist-generated=true 2021/Call.js spackled linguist-generated=true 2021/CanonicalNumericIndexString.js spackled linguist-generated=true 2021/CharacterRange.js spackled linguist-generated=true 2021/CompletePropertyDescriptor.js spackled linguist-generated=true 2021/CreateDataProperty.js spackled linguist-generated=true 2021/CreateDataPropertyOrThrow.js spackled linguist-generated=true 2021/CreateHTML.js spackled linguist-generated=true 2021/CreateIterResultObject.js spackled linguist-generated=true 2021/CreateListFromArrayLike.js spackled linguist-generated=true 2021/CreateMethodProperty.js spackled linguist-generated=true 2021/CreateRegExpStringIterator.js spackled linguist-generated=true 2021/DateFromTime.js spackled linguist-generated=true 2021/DateString.js spackled linguist-generated=true 2021/Day.js spackled linguist-generated=true 2021/DayFromYear.js spackled linguist-generated=true 2021/DayWithinYear.js spackled linguist-generated=true 2021/DaysInYear.js spackled linguist-generated=true 2021/DefinePropertyOrThrow.js spackled linguist-generated=true 2021/DeletePropertyOrThrow.js spackled linguist-generated=true 2021/EnumerableOwnPropertyNames.js spackled linguist-generated=true 2021/FlattenIntoArray.js spackled linguist-generated=true 2021/FromPropertyDescriptor.js spackled linguist-generated=true 2021/Get.js spackled linguist-generated=true 2021/GetIterator.js spackled linguist-generated=true 2021/GetMethod.js spackled linguist-generated=true 2021/GetOwnPropertyKeys.js spackled linguist-generated=true 2021/GetPrototypeFromConstructor.js spackled linguist-generated=true 2021/GetV.js spackled linguist-generated=true 2021/HasOwnProperty.js spackled linguist-generated=true 2021/HasProperty.js spackled linguist-generated=true 2021/HourFromTime.js spackled linguist-generated=true 2021/InLeapYear.js spackled linguist-generated=true 2021/InstanceofOperator.js spackled linguist-generated=true 2021/Invoke.js spackled linguist-generated=true 2021/IsAccessorDescriptor.js spackled linguist-generated=true 2021/IsArray.js spackled linguist-generated=true 2021/IsBigIntElementType.js spackled linguist-generated=true 2021/IsCallable.js spackled linguist-generated=true 2021/IsCompatiblePropertyDescriptor.js spackled linguist-generated=true 2021/IsConcatSpreadable.js spackled linguist-generated=true 2021/IsConstructor.js spackled linguist-generated=true 2021/IsDataDescriptor.js spackled linguist-generated=true 2021/IsExtensible.js spackled linguist-generated=true 2021/IsGenericDescriptor.js spackled linguist-generated=true 2021/IsNoTearConfiguration.js spackled linguist-generated=true 2021/IsPromise.js spackled linguist-generated=true 2021/IsPropertyKey.js spackled linguist-generated=true 2021/IsRegExp.js spackled linguist-generated=true 2021/IsSharedArrayBuffer.js spackled linguist-generated=true 2021/IsStringPrefix.js spackled linguist-generated=true 2021/IsUnclampedIntegerElementType.js spackled linguist-generated=true 2021/IsUnsignedElementType.js spackled linguist-generated=true 2021/IteratorClose.js spackled linguist-generated=true 2021/IteratorComplete.js spackled linguist-generated=true 2021/IteratorNext.js spackled linguist-generated=true 2021/IteratorStep.js spackled linguist-generated=true 2021/IteratorValue.js spackled linguist-generated=true 2021/LengthOfArrayLike.js spackled linguist-generated=true 2021/MakeDate.js spackled linguist-generated=true 2021/MinFromTime.js spackled linguist-generated=true 2021/MonthFromTime.js spackled linguist-generated=true 2021/Number/bitwiseAND.js spackled linguist-generated=true 2021/Number/bitwiseNOT.js spackled linguist-generated=true 2021/Number/bitwiseOR.js spackled linguist-generated=true 2021/Number/bitwiseXOR.js spackled linguist-generated=true 2021/Number/divide.js spackled linguist-generated=true 2021/Number/equal.js spackled linguist-generated=true 2021/Number/exponentiate.js spackled linguist-generated=true 2021/Number/index.js spackled linguist-generated=true 2021/Number/lessThan.js spackled linguist-generated=true 2021/Number/multiply.js spackled linguist-generated=true 2021/Number/sameValue.js spackled linguist-generated=true 2021/Number/sameValueZero.js spackled linguist-generated=true 2021/Number/toString.js spackled linguist-generated=true 2021/Number/unaryMinus.js spackled linguist-generated=true 2021/NumberBitwiseOp.js spackled linguist-generated=true 2021/ObjectDefineProperties.js spackled linguist-generated=true 2021/OrdinaryCreateFromConstructor.js spackled linguist-generated=true 2021/OrdinaryDefineOwnProperty.js spackled linguist-generated=true 2021/OrdinaryGetOwnProperty.js spackled linguist-generated=true 2021/OrdinaryGetPrototypeOf.js spackled linguist-generated=true 2021/OrdinaryHasInstance.js spackled linguist-generated=true 2021/OrdinaryHasProperty.js spackled linguist-generated=true 2021/OrdinaryObjectCreate.js spackled linguist-generated=true 2021/OrdinarySetPrototypeOf.js spackled linguist-generated=true 2021/OrdinaryToPrimitive.js spackled linguist-generated=true 2021/PromiseResolve.js spackled linguist-generated=true 2021/RegExpCreate.js spackled linguist-generated=true 2021/RegExpExec.js spackled linguist-generated=true 2021/RequireObjectCoercible.js spackled linguist-generated=true 2021/SameValue.js spackled linguist-generated=true 2021/SameValueNonNumeric.js spackled linguist-generated=true 2021/SameValueZero.js spackled linguist-generated=true 2021/SecFromTime.js spackled linguist-generated=true 2021/Set.js spackled linguist-generated=true 2021/SetFunctionName.js spackled linguist-generated=true 2021/SetIntegrityLevel.js spackled linguist-generated=true 2021/SpeciesConstructor.js spackled linguist-generated=true 2021/StrictEqualityComparison.js spackled linguist-generated=true 2021/StringCreate.js spackled linguist-generated=true 2021/StringPad.js spackled linguist-generated=true 2021/StringToBigInt.js spackled linguist-generated=true 2021/SymbolDescriptiveString.js spackled linguist-generated=true 2021/TestIntegrityLevel.js spackled linguist-generated=true 2021/TimeClip.js spackled linguist-generated=true 2021/TimeFromYear.js spackled linguist-generated=true 2021/TimeString.js spackled linguist-generated=true 2021/TimeWithinDay.js spackled linguist-generated=true 2021/ToBigInt.js spackled linguist-generated=true 2021/ToBigInt64.js spackled linguist-generated=true 2021/ToBigUint64.js spackled linguist-generated=true 2021/ToBoolean.js spackled linguist-generated=true 2021/ToDateString.js spackled linguist-generated=true 2021/ToInt16.js spackled linguist-generated=true 2021/ToInt32.js spackled linguist-generated=true 2021/ToInt8.js spackled linguist-generated=true 2021/ToNumber.js spackled linguist-generated=true 2021/ToNumeric.js spackled linguist-generated=true 2021/ToObject.js spackled linguist-generated=true 2021/ToPrimitive.js spackled linguist-generated=true 2021/ToPropertyDescriptor.js spackled linguist-generated=true 2021/ToPropertyKey.js spackled linguist-generated=true 2021/ToString.js spackled linguist-generated=true 2021/ToUint16.js spackled linguist-generated=true 2021/ToUint32.js spackled linguist-generated=true 2021/ToUint8.js spackled linguist-generated=true 2021/ToUint8Clamp.js spackled linguist-generated=true 2021/TrimString.js spackled linguist-generated=true 2021/Type.js spackled linguist-generated=true 2021/UnicodeEscape.js spackled linguist-generated=true 2021/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true 2021/WeekDay.js spackled linguist-generated=true 2021/YearFromTime.js spackled linguist-generated=true 2021/abs.js spackled linguist-generated=true 2021/floor.js spackled linguist-generated=true 2021/modulo.js spackled linguist-generated=true 2021/msFromTime.js spackled linguist-generated=true 2021/thisBigIntValue.js spackled linguist-generated=true 2021/thisBooleanValue.js spackled linguist-generated=true 2021/thisNumberValue.js spackled linguist-generated=true 2021/thisStringValue.js spackled linguist-generated=true 2021/thisSymbolValue.js spackled linguist-generated=true 2021/thisTimeValue.js spackled linguist-generated=true 2022/AddEntriesFromIterable.js spackled linguist-generated=true 2022/AddToKeptObjects.js spackled linguist-generated=true 2022/AdvanceStringIndex.js spackled linguist-generated=true 2022/ApplyStringOrNumericBinaryOperator.js spackled linguist-generated=true 2022/ArrayCreate.js spackled linguist-generated=true 2022/ArraySetLength.js spackled linguist-generated=true 2022/ArraySpeciesCreate.js spackled linguist-generated=true 2022/BigInt/add.js spackled linguist-generated=true 2022/BigInt/bitwiseAND.js spackled linguist-generated=true 2022/BigInt/bitwiseNOT.js spackled linguist-generated=true 2022/BigInt/bitwiseOR.js spackled linguist-generated=true 2022/BigInt/bitwiseXOR.js spackled linguist-generated=true 2022/BigInt/divide.js spackled linguist-generated=true 2022/BigInt/equal.js spackled linguist-generated=true 2022/BigInt/exponentiate.js spackled linguist-generated=true 2022/BigInt/index.js spackled linguist-generated=true 2022/BigInt/leftShift.js spackled linguist-generated=true 2022/BigInt/lessThan.js spackled linguist-generated=true 2022/BigInt/multiply.js spackled linguist-generated=true 2022/BigInt/remainder.js spackled linguist-generated=true 2022/BigInt/sameValue.js spackled linguist-generated=true 2022/BigInt/sameValueZero.js spackled linguist-generated=true 2022/BigInt/signedRightShift.js spackled linguist-generated=true 2022/BigInt/subtract.js spackled linguist-generated=true 2022/BigInt/toString.js spackled linguist-generated=true 2022/BigInt/unaryMinus.js spackled linguist-generated=true 2022/BigInt/unsignedRightShift.js spackled linguist-generated=true 2022/BigIntBitwiseOp.js spackled linguist-generated=true 2022/BinaryAnd.js spackled linguist-generated=true 2022/BinaryOr.js spackled linguist-generated=true 2022/BinaryXor.js spackled linguist-generated=true 2022/ByteListBitwiseOp.js spackled linguist-generated=true 2022/ByteListEqual.js spackled linguist-generated=true 2022/Call.js spackled linguist-generated=true 2022/CanonicalNumericIndexString.js spackled linguist-generated=true 2022/CharacterRange.js spackled linguist-generated=true 2022/ClearKeptObjects.js spackled linguist-generated=true 2022/CodePointAt.js spackled linguist-generated=true 2022/CodePointsToString.js spackled linguist-generated=true 2022/CompletePropertyDescriptor.js spackled linguist-generated=true 2022/CopyDataProperties.js spackled linguist-generated=true 2022/CreateDataProperty.js spackled linguist-generated=true 2022/CreateDataPropertyOrThrow.js spackled linguist-generated=true 2022/CreateHTML.js spackled linguist-generated=true 2022/CreateIterResultObject.js spackled linguist-generated=true 2022/CreateListFromArrayLike.js spackled linguist-generated=true 2022/CreateMethodProperty.js spackled linguist-generated=true 2022/CreateRegExpStringIterator.js spackled linguist-generated=true 2022/DateFromTime.js spackled linguist-generated=true 2022/DateString.js spackled linguist-generated=true 2022/Day.js spackled linguist-generated=true 2022/DayFromYear.js spackled linguist-generated=true 2022/DayWithinYear.js spackled linguist-generated=true 2022/DaysInYear.js spackled linguist-generated=true 2022/DefinePropertyOrThrow.js spackled linguist-generated=true 2022/DeletePropertyOrThrow.js spackled linguist-generated=true 2022/EnumerableOwnPropertyNames.js spackled linguist-generated=true 2022/FlattenIntoArray.js spackled linguist-generated=true 2022/FromPropertyDescriptor.js spackled linguist-generated=true 2022/Get.js spackled linguist-generated=true 2022/GetIterator.js spackled linguist-generated=true 2022/GetMethod.js spackled linguist-generated=true 2022/GetOwnPropertyKeys.js spackled linguist-generated=true 2022/GetPromiseResolve.js spackled linguist-generated=true 2022/GetPrototypeFromConstructor.js spackled linguist-generated=true 2022/GetSubstitution.js spackled linguist-generated=true 2022/GetV.js spackled linguist-generated=true 2022/HasOwnProperty.js spackled linguist-generated=true 2022/HasProperty.js spackled linguist-generated=true 2022/HourFromTime.js spackled linguist-generated=true 2022/InLeapYear.js spackled linguist-generated=true 2022/InstanceofOperator.js spackled linguist-generated=true 2022/Invoke.js spackled linguist-generated=true 2022/IsAccessorDescriptor.js spackled linguist-generated=true 2022/IsArray.js spackled linguist-generated=true 2022/IsBigIntElementType.js spackled linguist-generated=true 2022/IsCallable.js spackled linguist-generated=true 2022/IsConcatSpreadable.js spackled linguist-generated=true 2022/IsConstructor.js spackled linguist-generated=true 2022/IsDataDescriptor.js spackled linguist-generated=true 2022/IsExtensible.js spackled linguist-generated=true 2022/IsGenericDescriptor.js spackled linguist-generated=true 2022/IsIntegralNumber.js spackled linguist-generated=true 2022/IsNoTearConfiguration.js spackled linguist-generated=true 2022/IsPromise.js spackled linguist-generated=true 2022/IsPropertyKey.js spackled linguist-generated=true 2022/IsRegExp.js spackled linguist-generated=true 2022/IsSharedArrayBuffer.js spackled linguist-generated=true 2022/IsUnclampedIntegerElementType.js spackled linguist-generated=true 2022/IsUnsignedElementType.js spackled linguist-generated=true 2022/IterableToList.js spackled linguist-generated=true 2022/IteratorClose.js spackled linguist-generated=true 2022/IteratorComplete.js spackled linguist-generated=true 2022/IteratorNext.js spackled linguist-generated=true 2022/IteratorStep.js spackled linguist-generated=true 2022/IteratorValue.js spackled linguist-generated=true 2022/LengthOfArrayLike.js spackled linguist-generated=true 2022/MakeDate.js spackled linguist-generated=true 2022/MakeDay.js spackled linguist-generated=true 2022/MakeTime.js spackled linguist-generated=true 2022/MinFromTime.js spackled linguist-generated=true 2022/MonthFromTime.js spackled linguist-generated=true 2022/Number/add.js spackled linguist-generated=true 2022/Number/bitwiseAND.js spackled linguist-generated=true 2022/Number/bitwiseNOT.js spackled linguist-generated=true 2022/Number/bitwiseOR.js spackled linguist-generated=true 2022/Number/bitwiseXOR.js spackled linguist-generated=true 2022/Number/divide.js spackled linguist-generated=true 2022/Number/equal.js spackled linguist-generated=true 2022/Number/exponentiate.js spackled linguist-generated=true 2022/Number/index.js spackled linguist-generated=true 2022/Number/leftShift.js spackled linguist-generated=true 2022/Number/lessThan.js spackled linguist-generated=true 2022/Number/multiply.js spackled linguist-generated=true 2022/Number/remainder.js spackled linguist-generated=true 2022/Number/sameValue.js spackled linguist-generated=true 2022/Number/sameValueZero.js spackled linguist-generated=true 2022/Number/signedRightShift.js spackled linguist-generated=true 2022/Number/subtract.js spackled linguist-generated=true 2022/Number/toString.js spackled linguist-generated=true 2022/Number/unaryMinus.js spackled linguist-generated=true 2022/Number/unsignedRightShift.js spackled linguist-generated=true 2022/NumberBitwiseOp.js spackled linguist-generated=true 2022/NumberToBigInt.js spackled linguist-generated=true 2022/ObjectDefineProperties.js spackled linguist-generated=true 2022/OrdinaryCreateFromConstructor.js spackled linguist-generated=true 2022/OrdinaryDefineOwnProperty.js spackled linguist-generated=true 2022/OrdinaryGetOwnProperty.js spackled linguist-generated=true 2022/OrdinaryGetPrototypeOf.js spackled linguist-generated=true 2022/OrdinaryHasInstance.js spackled linguist-generated=true 2022/OrdinaryHasProperty.js spackled linguist-generated=true 2022/OrdinaryObjectCreate.js spackled linguist-generated=true 2022/OrdinarySetPrototypeOf.js spackled linguist-generated=true 2022/OrdinaryToPrimitive.js spackled linguist-generated=true 2022/PromiseResolve.js spackled linguist-generated=true 2022/QuoteJSONString.js spackled linguist-generated=true 2022/RegExpCreate.js spackled linguist-generated=true 2022/RegExpExec.js spackled linguist-generated=true 2022/RequireObjectCoercible.js spackled linguist-generated=true 2022/SameValue.js spackled linguist-generated=true 2022/SameValueNonNumeric.js spackled linguist-generated=true 2022/SameValueZero.js spackled linguist-generated=true 2022/SecFromTime.js spackled linguist-generated=true 2022/Set.js spackled linguist-generated=true 2022/SetFunctionLength.js spackled linguist-generated=true 2022/SetFunctionName.js spackled linguist-generated=true 2022/SetIntegrityLevel.js spackled linguist-generated=true 2022/SpeciesConstructor.js spackled linguist-generated=true 2022/StringCreate.js spackled linguist-generated=true 2022/StringGetOwnProperty.js spackled linguist-generated=true 2022/StringIndexOf.js spackled linguist-generated=true 2022/StringPad.js spackled linguist-generated=true 2022/StringToBigInt.js spackled linguist-generated=true 2022/StringToCodePoints.js spackled linguist-generated=true 2022/SymbolDescriptiveString.js spackled linguist-generated=true 2022/TestIntegrityLevel.js spackled linguist-generated=true 2022/TimeClip.js spackled linguist-generated=true 2022/TimeFromYear.js spackled linguist-generated=true 2022/TimeString.js spackled linguist-generated=true 2022/TimeWithinDay.js spackled linguist-generated=true 2022/ToBigInt.js spackled linguist-generated=true 2022/ToBigInt64.js spackled linguist-generated=true 2022/ToBigUint64.js spackled linguist-generated=true 2022/ToBoolean.js spackled linguist-generated=true 2022/ToDateString.js spackled linguist-generated=true 2022/ToIndex.js spackled linguist-generated=true 2022/ToInt16.js spackled linguist-generated=true 2022/ToInt32.js spackled linguist-generated=true 2022/ToInt8.js spackled linguist-generated=true 2022/ToIntegerOrInfinity.js spackled linguist-generated=true 2022/ToLength.js spackled linguist-generated=true 2022/ToNumeric.js spackled linguist-generated=true 2022/ToObject.js spackled linguist-generated=true 2022/ToPrimitive.js spackled linguist-generated=true 2022/ToPropertyDescriptor.js spackled linguist-generated=true 2022/ToPropertyKey.js spackled linguist-generated=true 2022/ToString.js spackled linguist-generated=true 2022/ToUint16.js spackled linguist-generated=true 2022/ToUint32.js spackled linguist-generated=true 2022/ToUint8.js spackled linguist-generated=true 2022/ToUint8Clamp.js spackled linguist-generated=true 2022/TrimString.js spackled linguist-generated=true 2022/Type.js spackled linguist-generated=true 2022/UTF16EncodeCodePoint.js spackled linguist-generated=true 2022/UTF16SurrogatePairToCodePoint.js spackled linguist-generated=true 2022/UnicodeEscape.js spackled linguist-generated=true 2022/WeakRefDeref.js spackled linguist-generated=true 2022/WeekDay.js spackled linguist-generated=true 2022/YearFromTime.js spackled linguist-generated=true 2022/abs.js spackled linguist-generated=true 2022/clamp.js spackled linguist-generated=true 2022/floor.js spackled linguist-generated=true 2022/modulo.js spackled linguist-generated=true 2022/msFromTime.js spackled linguist-generated=true 2022/substring.js spackled linguist-generated=true 2022/thisBigIntValue.js spackled linguist-generated=true 2022/thisBooleanValue.js spackled linguist-generated=true 2022/thisNumberValue.js spackled linguist-generated=true 2022/thisStringValue.js spackled linguist-generated=true 2022/thisSymbolValue.js spackled linguist-generated=true 2022/thisTimeValue.js spackled linguist-generated=truees-abstract-1.20.4/.github/000077500000000000000000000000001431761430200153475ustar00rootroot00000000000000es-abstract-1.20.4/.github/FUNDING.yml000066400000000000000000000010551431761430200171650ustar00rootroot00000000000000# These are supported funding model platforms github: [ljharb] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username tidelift: npm/es-abstract community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username custom: # Replace with a single custom sponsorship URL es-abstract-1.20.4/.github/workflows/000077500000000000000000000000001431761430200174045ustar00rootroot00000000000000es-abstract-1.20.4/.github/workflows/codeql-analysis.yml000066400000000000000000000027511431761430200232240ustar00rootroot00000000000000name: "Code scanning - action" on: push: pull_request: schedule: - cron: '0 17 * * 4' permissions: contents: read jobs: CodeQL-Build: # CodeQL runs on ubuntu-latest and windows-latest permissions: actions: read # for github/codeql-action/init to get workflow details contents: read # for actions/checkout to fetch code security-events: write # for github/codeql-action/autobuild to send a status report runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v1 # Override language selection by uncommenting this and choosing your languages # with: # languages: go, javascript, csharp, python, cpp, java # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild uses: github/codeql-action/autobuild@v1 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines # and modify them (or add more) to build your code if your project # uses a compiled language #- run: | # make bootstrap # make release - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 es-abstract-1.20.4/.github/workflows/node-aught.yml000066400000000000000000000006711431761430200221660ustar00rootroot00000000000000name: 'Tests: node.js < 10' on: [pull_request, push] permissions: contents: read jobs: tests: permissions: contents: none uses: ljharb/actions/.github/workflows/node.yml@main with: range: '< 10' type: minors command: npm run tests-only node: permissions: contents: none name: 'node < 10' needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' es-abstract-1.20.4/.github/workflows/node-pretest.yml000066400000000000000000000003131431761430200225350ustar00rootroot00000000000000name: 'Tests: pretest/posttest' on: [pull_request, push] permissions: contents: read jobs: tests: permissions: contents: none uses: ljharb/actions/.github/workflows/pretest.yml@main es-abstract-1.20.4/.github/workflows/node-tens.yml000066400000000000000000000006741431761430200220320ustar00rootroot00000000000000name: 'Tests: node.js >= 10' on: [pull_request, push] permissions: contents: read jobs: tests: permissions: contents: none uses: ljharb/actions/.github/workflows/node.yml@main with: range: '>= 10' type: minors command: npm run tests-only node: permissions: contents: none name: 'node >= 10' needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' es-abstract-1.20.4/.github/workflows/rebase.yml000066400000000000000000000006771431761430200214020ustar00rootroot00000000000000name: Automatic Rebase on: [pull_request_target] permissions: contents: read jobs: _: permissions: contents: write # for ljharb/rebase to push code to rebase pull-requests: read # for ljharb/rebase to get info about PR name: "Automatic Rebase" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} es-abstract-1.20.4/.github/workflows/require-allow-edits.yml000066400000000000000000000005141431761430200240250ustar00rootroot00000000000000name: Require “Allow Edits” on: [pull_request_target] permissions: contents: read jobs: _: permissions: pull-requests: read # for ljharb/require-allow-edits to check 'allow edits' on PR name: "Require “Allow Edits”" runs-on: ubuntu-latest steps: - uses: ljharb/require-allow-edits@main es-abstract-1.20.4/.github/workflows/ses.yml000066400000000000000000000012011431761430200207130ustar00rootroot00000000000000name: 'Tests: SES' on: [pull_request, push] permissions: contents: read jobs: tests: runs-on: ubuntu-latest strategy: matrix: node-version: - '14' - '12' steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: node-version: ${{ matrix.node-version }} - run: npm run test:ses - uses: codecov/codecov-action@v2 SES: permissions: contents: none needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' es-abstract-1.20.4/.gitignore000066400000000000000000000002451431761430200160000ustar00rootroot00000000000000# gitignore node_modules # code coverage output coverage .nyc_output # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock .npmignore es-abstract-1.20.4/.npmrc000066400000000000000000000000231431761430200151220ustar00rootroot00000000000000package-lock=false es-abstract-1.20.4/.nycrc000066400000000000000000000002331431761430200151240ustar00rootroot00000000000000{ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], "exclude": [ "coverage", "operations", "test" ] } es-abstract-1.20.4/2015/000077500000000000000000000000001431761430200143765ustar00rootroot00000000000000es-abstract-1.20.4/2015/AbstractEqualityComparison.js000066400000000000000000000022021431761430200222440ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison module.exports = function AbstractEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType === yType) { return x === y; // ES6+ specified this shortcut anyways. } if (x == null && y == null) { return true; } if (xType === 'Number' && yType === 'String') { return AbstractEqualityComparison(x, ToNumber(y)); } if (xType === 'String' && yType === 'Number') { return AbstractEqualityComparison(ToNumber(x), y); } if (xType === 'Boolean') { return AbstractEqualityComparison(ToNumber(x), y); } if (yType === 'Boolean') { return AbstractEqualityComparison(x, ToNumber(y)); } if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') { return AbstractEqualityComparison(x, ToPrimitive(y)); } if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) { return AbstractEqualityComparison(ToPrimitive(x), y); } return false; }; es-abstract-1.20.4/2015/AbstractRelationalComparison.js000066400000000000000000000030661431761430200225520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var isPrefixOf = require('../helpers/isPrefixOf'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.8.5 // eslint-disable-next-line max-statements module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); } var px; var py; if (LeftFirst) { px = ToPrimitive(x, $Number); py = ToPrimitive(y, $Number); } else { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } var bothStrings = Type(px) === 'String' && Type(py) === 'String'; if (!bothStrings) { var nx = ToNumber(px); var ny = ToNumber(py); if ($isNaN(nx) || $isNaN(ny)) { return undefined; } if ($isFinite(nx) && $isFinite(ny) && nx === ny) { return false; } if (nx === Infinity) { return false; } if (ny === Infinity) { return true; } if (ny === -Infinity) { return false; } if (nx === -Infinity) { return true; } return nx < ny; // by now, these are both nonzero, finite, and not equal } if (isPrefixOf(py, px)) { return false; } if (isPrefixOf(px, py)) { return true; } return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f }; es-abstract-1.20.4/2015/AdvanceStringIndex.js000066400000000000000000000024311431761430200204540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = require('call-bind/callBound')('String.prototype.charCodeAt'); // https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex module.exports = function AdvanceStringIndex(S, index, unicode) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53'); } if (Type(unicode) !== 'Boolean') { throw new $TypeError('Assertion failed: `unicode` must be a Boolean'); } if (!unicode) { return index + 1; } var length = S.length; if ((index + 1) >= length) { return index + 1; } var first = $charCodeAt(S, index); if (!isLeadingSurrogate(first)) { return index + 1; } var second = $charCodeAt(S, index + 1); if (!isTrailingSurrogate(second)) { return index + 1; } return index + 2; }; es-abstract-1.20.4/2015/ArrayCreate.js000066400000000000000000000031621431761430200171400ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ArrayPrototype = GetIntrinsic('%Array.prototype%'); var $RangeError = GetIntrinsic('%RangeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || ( // eslint-disable-next-line no-proto, no-negated-condition [].__proto__ !== $ArrayPrototype ? null : function (O, proto) { O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign return O; } ); // https://ecma-international.org/ecma-262/6.0/#sec-arraycreate module.exports = function ArrayCreate(length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0'); } if (length > MAX_ARRAY_LENGTH) { throw new $RangeError('length is greater than (2**32 - 1)'); } var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype; var A = []; // steps 5 - 7, and 9 if (proto !== $ArrayPrototype) { // step 8 if (!$setProto) { throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } $setProto(A, proto); } if (length !== 0) { // bypasses the need for step 2 A.length = length; } /* step 10, the above as a shortcut for the below OrdinaryDefineOwnProperty(A, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': true }); */ return A; }; es-abstract-1.20.4/2015/ArraySetLength.js000066400000000000000000000051511431761430200176320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var assign = require('object.assign'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsArray = require('./IsArray'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function ArraySetLength(A, Desc) { if (!IsArray(A)) { throw new $TypeError('Assertion failed: A must be an Array'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!('[[Value]]' in Desc)) { return OrdinaryDefineOwnProperty(A, 'length', Desc); } var newLenDesc = assign({}, Desc); var newLen = ToUint32(Desc['[[Value]]']); var numberLen = ToNumber(Desc['[[Value]]']); if (newLen !== numberLen) { throw new $RangeError('Invalid array length'); } newLenDesc['[[Value]]'] = newLen; var oldLenDesc = OrdinaryGetOwnProperty(A, 'length'); if (!IsDataDescriptor(oldLenDesc)) { throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`'); } var oldLen = oldLenDesc['[[Value]]']; if (newLen >= oldLen) { return OrdinaryDefineOwnProperty(A, 'length', newLenDesc); } if (!oldLenDesc['[[Writable]]']) { return false; } var newWritable; if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) { newWritable = true; } else { newWritable = false; newLenDesc['[[Writable]]'] = true; } var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc); if (!succeeded) { return false; } while (newLen < oldLen) { oldLen -= 1; // eslint-disable-next-line no-param-reassign var deleteSucceeded = delete A[ToString(oldLen)]; if (!deleteSucceeded) { newLenDesc['[[Value]]'] = oldLen + 1; if (!newWritable) { newLenDesc['[[Writable]]'] = false; OrdinaryDefineOwnProperty(A, 'length', newLenDesc); return false; } } } if (!newWritable) { return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false }); } return true; }; es-abstract-1.20.4/2015/ArraySpeciesCreate.js000066400000000000000000000025041431761430200204530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Array = GetIntrinsic('%Array%'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsConstructor = require('./IsConstructor'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate module.exports = function ArraySpeciesCreate(originalArray, length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: length must be an integer >= 0'); } var len = length === 0 ? 0 : length; var C; var isArray = IsArray(originalArray); if (isArray) { C = Get(originalArray, 'constructor'); // TODO: figure out how to make a cross-realm normal Array, a same-realm Array // if (IsConstructor(C)) { // if C is another realm's Array, C = undefined // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ? // } if ($species && Type(C) === 'Object') { C = Get(C, $species); if (C === null) { C = void 0; } } } if (typeof C === 'undefined') { return $Array(len); } if (!IsConstructor(C)) { throw new $TypeError('C must be a constructor'); } return new C(len); // Construct(C, len); }; es-abstract-1.20.4/2015/Call.js000066400000000000000000000011571431761430200156130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsArray = require('./IsArray'); var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%'); // https://ecma-international.org/ecma-262/6.0/#sec-call module.exports = function Call(F, V) { var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } return $apply(F, V, argumentsList); }; es-abstract-1.20.4/2015/CanonicalNumericIndexString.js000066400000000000000000000012161431761430200223250ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring module.exports = function CanonicalNumericIndexString(argument) { if (Type(argument) !== 'String') { throw new $TypeError('Assertion failed: `argument` must be a String'); } if (argument === '-0') { return -0; } var n = ToNumber(argument); if (SameValue(ToString(n), argument)) { return n; } return void 0; }; es-abstract-1.20.4/2015/CharacterRange.js000066400000000000000000000014161431761430200176070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = callBound('%String.prototype.charCodeAt%'); var $push = callBound('%Array.prototype.push%'); module.exports = function CharacterRange(A, B) { if (A.length !== 1 || B.length !== 1) { throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); } var a = A[0]; var b = B[0]; var i = $charCodeAt(a, 0); var j = $charCodeAt(b, 0); if (!(i <= j)) { throw new $TypeError('Assertion failed: i is not <= j'); } var arr = []; for (var k = i; k <= j; k += 1) { $push(arr, $fromCharCode(k)); } return arr; }; es-abstract-1.20.4/2015/CompletePropertyDescriptor.js000066400000000000000000000017351431761430200223160ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor module.exports = function CompletePropertyDescriptor(Desc) { /* eslint no-param-reassign: 0 */ assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (!has(Desc, '[[Value]]')) { Desc['[[Value]]'] = void 0; } if (!has(Desc, '[[Writable]]')) { Desc['[[Writable]]'] = false; } } else { if (!has(Desc, '[[Get]]')) { Desc['[[Get]]'] = void 0; } if (!has(Desc, '[[Set]]')) { Desc['[[Set]]'] = void 0; } } if (!has(Desc, '[[Enumerable]]')) { Desc['[[Enumerable]]'] = false; } if (!has(Desc, '[[Configurable]]')) { Desc['[[Configurable]]'] = false; } return Desc; }; es-abstract-1.20.4/2015/CreateDataProperty.js000066400000000000000000000023771431761430200205070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty module.exports = function CreateDataProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var oldDesc = OrdinaryGetOwnProperty(O, P); var extensible = !oldDesc || IsExtensible(O); var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]']; if (nonConfigurable || !extensible) { return false; } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Value]]': V, '[[Writable]]': true } ); }; es-abstract-1.20.4/2015/CreateDataPropertyOrThrow.js000066400000000000000000000013361431761430200220260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var CreateDataProperty = require('./CreateDataProperty'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var success = CreateDataProperty(O, P, V); if (!success) { throw new $TypeError('unable to create data property'); } return success; }; es-abstract-1.20.4/2015/CreateHTML.js000066400000000000000000000016371431761430200166330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $replace = callBound('String.prototype.replace'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createhtml module.exports = function CreateHTML(string, tag, attribute, value) { if (Type(tag) !== 'String' || Type(attribute) !== 'String') { throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings'); } var str = RequireObjectCoercible(string); var S = ToString(str); var p1 = '<' + tag; if (attribute !== '') { var V = ToString(value); var escapedV = $replace(V, /\x22/g, '"'); p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22'; } return p1 + '>' + S + ''; }; es-abstract-1.20.4/2015/CreateIterResultObject.js000066400000000000000000000006601431761430200213130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject module.exports = function CreateIterResultObject(value, done) { if (Type(done) !== 'Boolean') { throw new $TypeError('Assertion failed: Type(done) is not Boolean'); } return { value: value, done: done }; }; es-abstract-1.20.4/2015/CreateListFromArrayLike.js000066400000000000000000000025121431761430200214230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $indexOf = callBound('Array.prototype.indexOf', true) || callBound('String.prototype.indexOf'); var $push = callBound('Array.prototype.push'); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createlistfromarraylike module.exports = function CreateListFromArrayLike(obj) { var elementTypes = arguments.length > 1 ? arguments[1] : ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object']; if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } if (!IsArray(elementTypes)) { throw new $TypeError('Assertion failed: `elementTypes`, if provided, must be an array'); } var len = ToLength(Get(obj, 'length')); var list = []; var index = 0; while (index < len) { var indexName = ToString(index); var next = Get(obj, indexName); var nextType = Type(next); if ($indexOf(elementTypes, nextType) < 0) { throw new $TypeError('item type ' + nextType + ' is not a valid elementType'); } $push(list, next); index += 1; } return list; }; es-abstract-1.20.4/2015/CreateMethodProperty.js000066400000000000000000000017231431761430200210500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty module.exports = function CreateMethodProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var newDesc = { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': V, '[[Writable]]': true }; return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, newDesc ); }; es-abstract-1.20.4/2015/DateFromTime.js000066400000000000000000000020141431761430200172510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); var MonthFromTime = require('./MonthFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.5 module.exports = function DateFromTime(t) { var m = MonthFromTime(t); var d = DayWithinYear(t); if (m === 0) { return d + 1; } if (m === 1) { return d - 30; } var leap = InLeapYear(t); if (m === 2) { return d - 58 - leap; } if (m === 3) { return d - 89 - leap; } if (m === 4) { return d - 119 - leap; } if (m === 5) { return d - 150 - leap; } if (m === 6) { return d - 180 - leap; } if (m === 7) { return d - 211 - leap; } if (m === 8) { return d - 242 - leap; } if (m === 9) { return d - 272 - leap; } if (m === 10) { return d - 303 - leap; } if (m === 11) { return d - 333 - leap; } throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m); }; es-abstract-1.20.4/2015/Day.js000066400000000000000000000003521431761430200154510ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function Day(t) { return floor(t / msPerDay); }; es-abstract-1.20.4/2015/DayFromYear.js000066400000000000000000000004001431761430200171100ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DayFromYear(y) { return (365 * (y - 1970)) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400); }; es-abstract-1.20.4/2015/DayWithinYear.js000066400000000000000000000004361431761430200174600ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var DayFromYear = require('./DayFromYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function DayWithinYear(t) { return Day(t) - DayFromYear(YearFromTime(t)); }; es-abstract-1.20.4/2015/DaysInYear.js000066400000000000000000000004551431761430200167500ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DaysInYear(y) { if (modulo(y, 4) !== 0) { return 365; } if (modulo(y, 100) !== 0) { return 366; } if (modulo(y, 400) !== 0) { return 365; } return 366; }; es-abstract-1.20.4/2015/DefinePropertyOrThrow.js000066400000000000000000000026721431761430200212270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow module.exports = function DefinePropertyOrThrow(O, P, desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var Desc = isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, desc) ? desc : ToPropertyDescriptor(desc); if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor'); } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); }; es-abstract-1.20.4/2015/DeletePropertyOrThrow.js000066400000000000000000000012731431761430200212330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow module.exports = function DeletePropertyOrThrow(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // eslint-disable-next-line no-param-reassign var success = delete O[P]; if (!success) { throw new $TypeError('Attempt to delete property failed.'); } return success; }; es-abstract-1.20.4/2015/EnumerableOwnNames.js000066400000000000000000000006411431761430200204640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var keys = require('object-keys'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-enumerableownnames module.exports = function EnumerableOwnNames(O) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } return keys(O); }; es-abstract-1.20.4/2015/FromPropertyDescriptor.js000066400000000000000000000007021431761430200214420ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor module.exports = function FromPropertyDescriptor(Desc) { if (typeof Desc !== 'undefined') { assertRecord(Type, 'Property Descriptor', 'Desc', Desc); } return fromPropertyDescriptor(Desc); }; es-abstract-1.20.4/2015/Get.js000066400000000000000000000011321431761430200154500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var inspect = require('object-inspect'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-get-o-p module.exports = function Get(O, P) { // 7.3.1.1 if (Type(O) !== 'Object') { 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)); } // 7.3.1.3 return O[P]; }; es-abstract-1.20.4/2015/GetIterator.js000066400000000000000000000015301431761430200171640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var getIteratorMethod = require('../helpers/getIteratorMethod'); var AdvanceStringIndex = require('./AdvanceStringIndex'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsArray = require('./IsArray'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getiterator module.exports = function GetIterator(obj, method) { var actualMethod = method; if (arguments.length < 2) { actualMethod = getIteratorMethod( { AdvanceStringIndex: AdvanceStringIndex, GetMethod: GetMethod, IsArray: IsArray }, obj ); } var iterator = Call(actualMethod, obj); if (Type(iterator) !== 'Object') { throw new $TypeError('iterator must return an object'); } return iterator; }; es-abstract-1.20.4/2015/GetMethod.js000066400000000000000000000012271431761430200166160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-getmethod module.exports = function GetMethod(O, P) { // 7.3.9.1 if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // 7.3.9.2 var func = GetV(O, P); // 7.3.9.4 if (func == null) { return void 0; } // 7.3.9.5 if (!IsCallable(func)) { throw new $TypeError(P + 'is not a function'); } // 7.3.9.6 return func; }; es-abstract-1.20.4/2015/GetOwnPropertyKeys.js000066400000000000000000000014751431761430200205470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%', true); var keys = require('object-keys'); var esType = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys module.exports = function GetOwnPropertyKeys(O, Type) { if (esType(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (Type === 'Symbol') { return $gOPS ? $gOPS(O) : []; } if (Type === 'String') { if (!$gOPN) { return keys(O); } return $gOPN(O); } throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`'); }; es-abstract-1.20.4/2015/GetPrototypeFromConstructor.js000066400000000000000000000016311431761430200224740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Function = GetIntrinsic('%Function%'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic if (!IsConstructor(constructor)) { throw new $TypeError('Assertion failed: `constructor` must be a constructor'); } var proto = Get(constructor, 'prototype'); if (Type(proto) !== 'Object') { if (!(constructor instanceof $Function)) { // ignore other realms, for now throw new $TypeError('cross-realm constructors not currently supported'); } proto = intrinsic; } return proto; }; es-abstract-1.20.4/2015/GetSubstitution.js000066400000000000000000000066741431761430200201250ustar00rootroot00000000000000 'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $parseInt = GetIntrinsic('%parseInt%'); var inspect = require('object-inspect'); var regexTester = require('safe-regex-test'); var callBound = require('call-bind/callBound'); var every = require('../helpers/every'); var isDigit = regexTester(/^[0-9]$/); var $charAt = callBound('String.prototype.charAt'); var $strSlice = callBound('String.prototype.slice'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false var isStringOrHole = function (capture, index, arr) { return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined'); }; // https://ecma-international.org/ecma-262/6.0/#sec-getsubstitution // eslint-disable-next-line max-statements, max-params, max-lines-per-function module.exports = function GetSubstitution(matched, str, position, captures, replacement) { if (Type(matched) !== 'String') { throw new $TypeError('Assertion failed: `matched` must be a String'); } var matchLength = matched.length; if (Type(str) !== 'String') { throw new $TypeError('Assertion failed: `str` must be a String'); } var stringLength = str.length; if (!IsInteger(position) || position < 0 || position > stringLength) { throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position)); } if (!IsArray(captures) || !every(captures, isStringOrHole)) { throw new $TypeError('Assertion failed: `captures` must be a List of Strings, got ' + inspect(captures)); } if (Type(replacement) !== 'String') { throw new $TypeError('Assertion failed: `replacement` must be a String'); } var tailPos = position + matchLength; var m = captures.length; var result = ''; for (var i = 0; i < replacement.length; i += 1) { // if this is a $, and it's not the end of the replacement var current = $charAt(replacement, i); var isLast = (i + 1) >= replacement.length; var nextIsLast = (i + 2) >= replacement.length; if (current === '$' && !isLast) { var next = $charAt(replacement, i + 1); if (next === '$') { result += '$'; i += 1; } else if (next === '&') { result += matched; i += 1; } else if (next === '`') { result += position === 0 ? '' : $strSlice(str, 0, position - 1); i += 1; } else if (next === "'") { result += tailPos >= stringLength ? '' : $strSlice(str, tailPos); i += 1; } else { var nextNext = nextIsLast ? null : $charAt(replacement, i + 2); if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) { // $1 through $9, and not followed by a digit var n = $parseInt(next, 10); // if (n > m, impl-defined) result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1]; i += 1; } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) { // $00 through $99 var nn = next + nextNext; var nnI = $parseInt(nn, 10) - 1; // if nn === '00' or nn > m, impl-defined result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI]; i += 2; } else { result += '$'; } } } else { // the final $, or else not a $ result += $charAt(replacement, i); } } return result; }; es-abstract-1.20.4/2015/GetV.js000066400000000000000000000007321431761430200156030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var ToObject = require('./ToObject'); // https://ecma-international.org/ecma-262/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'); } // 7.3.2.2-3 var O = ToObject(V); // 7.3.2.4 return O[P]; }; es-abstract-1.20.4/2015/HasOwnProperty.js000066400000000000000000000010511431761430200176750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var has = require('has'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty module.exports = function HasOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return has(O, P); }; es-abstract-1.20.4/2015/HasProperty.js000066400000000000000000000010051431761430200172100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty module.exports = function HasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2015/HourFromTime.js000066400000000000000000000005761431761430200173240ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerHour = timeConstants.msPerHour; var HoursPerDay = timeConstants.HoursPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function HourFromTime(t) { return modulo(floor(t / msPerHour), HoursPerDay); }; es-abstract-1.20.4/2015/InLeapYear.js000066400000000000000000000007761431761430200167370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DaysInYear = require('./DaysInYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function InLeapYear(t) { var days = DaysInYear(YearFromTime(t)); if (days === 365) { return 0; } if (days === 366) { return 1; } throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days); }; es-abstract-1.20.4/2015/InstanceofOperator.js000066400000000000000000000016261431761430200205460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $hasInstance = GetIntrinsic('Symbol.hasInstance', true); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var OrdinaryHasInstance = require('./OrdinaryHasInstance'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator module.exports = function InstanceofOperator(O, C) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var instOfHandler = $hasInstance ? GetMethod(C, $hasInstance) : void 0; if (typeof instOfHandler !== 'undefined') { return ToBoolean(Call(instOfHandler, C, [O])); } if (!IsCallable(C)) { throw new $TypeError('`C` is not Callable'); } return OrdinaryHasInstance(C, O); }; es-abstract-1.20.4/2015/Invoke.js000066400000000000000000000013131431761430200161650ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-invoke module.exports = function Invoke(O, P) { if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } var func = GetV(O, P); return Call(func, O, argumentsList); }; es-abstract-1.20.4/2015/IsAccessorDescriptor.js000066400000000000000000000007211431761430200210310ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor module.exports = function IsAccessorDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { return false; } return true; }; es-abstract-1.20.4/2015/IsArray.js000066400000000000000000000001731431761430200163070ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-isarray module.exports = require('../helpers/IsArray'); es-abstract-1.20.4/2015/IsCallable.js000066400000000000000000000001541431761430200167270ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.11 module.exports = require('is-callable'); es-abstract-1.20.4/2015/IsCompatiblePropertyDescriptor.js000066400000000000000000000005571431761430200231220ustar00rootroot00000000000000'use strict'; var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); }; es-abstract-1.20.4/2015/IsConcatSpreadable.js000066400000000000000000000011621431761430200204220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable module.exports = function IsConcatSpreadable(O) { if (Type(O) !== 'Object') { return false; } if ($isConcatSpreadable) { var spreadable = Get(O, $isConcatSpreadable); if (typeof spreadable !== 'undefined') { return ToBoolean(spreadable); } } return IsArray(O); }; es-abstract-1.20.4/2015/IsConstructor.js000066400000000000000000000021751431761430200175620ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('../GetIntrinsic.js'); var $construct = GetIntrinsic('%Reflect.construct%', true); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); try { DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} }); } catch (e) { // Accessor properties aren't supported DefinePropertyOrThrow = null; } // https://ecma-international.org/ecma-262/6.0/#sec-isconstructor if (DefinePropertyOrThrow && $construct) { var isConstructorMarker = {}; var badArrayLike = {}; DefinePropertyOrThrow(badArrayLike, 'length', { '[[Get]]': function () { throw isConstructorMarker; }, '[[Enumerable]]': true }); module.exports = function IsConstructor(argument) { try { // `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`: $construct(argument, badArrayLike); } catch (err) { return err === isConstructorMarker; } }; } else { module.exports = function IsConstructor(argument) { // unfortunately there's no way to truly check this without try/catch `new argument` in old environments return typeof argument === 'function' && !!argument.prototype; }; } es-abstract-1.20.4/2015/IsDataDescriptor.js000066400000000000000000000007201431761430200201370ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor module.exports = function IsDataDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { return false; } return true; }; es-abstract-1.20.4/2015/IsExtensible.js000066400000000000000000000007751431761430200173430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $isExtensible = GetIntrinsic('%Object.isExtensible%', true); var isPrimitive = require('../helpers/isPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o module.exports = $preventExtensions ? function IsExtensible(obj) { return !isPrimitive(obj) && $isExtensible(obj); } : function IsExtensible(obj) { return !isPrimitive(obj); }; es-abstract-1.20.4/2015/IsGenericDescriptor.js000066400000000000000000000010601431761430200206400ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor module.exports = function IsGenericDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) { return true; } return false; }; es-abstract-1.20.4/2015/IsInteger.js000066400000000000000000000007021431761430200166240ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); // https://ecma-international.org/ecma-262/6.0/#sec-isinteger module.exports = function IsInteger(argument) { if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) { return false; } var absValue = abs(argument); return floor(absValue) === absValue; }; es-abstract-1.20.4/2015/IsPromise.js000066400000000000000000000007451431761430200166540ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $PromiseThen = callBound('Promise.prototype.then', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ispromise module.exports = function IsPromise(x) { if (Type(x) !== 'Object') { return false; } if (!$PromiseThen) { // Promises are not supported return false; } try { $PromiseThen(x); // throws if not a promise } catch (e) { return false; } return true; }; es-abstract-1.20.4/2015/IsPropertyDescriptor.js000066400000000000000000000010521431761430200211110ustar00rootroot00000000000000'use strict'; // TODO, semver-major: delete this var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var Type = require('./Type'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); // https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type module.exports = function IsPropertyDescriptor(Desc) { return isPropertyDescriptor({ IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor, Type: Type }, Desc); }; es-abstract-1.20.4/2015/IsPropertyKey.js000066400000000000000000000003171431761430200175260ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { return typeof argument === 'string' || typeof argument === 'symbol'; }; es-abstract-1.20.4/2015/IsRegExp.js000066400000000000000000000010411431761430200164160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $match = GetIntrinsic('%Symbol.match%', true); var hasRegExpMatcher = require('is-regex'); var ToBoolean = require('./ToBoolean'); // https://ecma-international.org/ecma-262/6.0/#sec-isregexp module.exports = function IsRegExp(argument) { if (!argument || typeof argument !== 'object') { return false; } if ($match) { var isRegExp = argument[$match]; if (typeof isRegExp !== 'undefined') { return ToBoolean(isRegExp); } } return hasRegExpMatcher(argument); }; es-abstract-1.20.4/2015/IteratorClose.js000066400000000000000000000027111431761430200175140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose module.exports = function IteratorClose(iterator, completion) { if (Type(iterator) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterator) is not Object'); } if (!IsCallable(completion)) { throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record'); } var completionThunk = completion; var iteratorReturn = GetMethod(iterator, 'return'); if (typeof iteratorReturn === 'undefined') { return completionThunk(); } var completionRecord; try { var innerResult = Call(iteratorReturn, iterator, []); } catch (e) { // if we hit here, then "e" is the innerResult completion that needs re-throwing // if the completion is of type "throw", this will throw. completionThunk(); completionThunk = null; // ensure it's not called twice. // if not, then return the innerResult completion throw e; } completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does completionThunk = null; // ensure it's not called twice. if (Type(innerResult) !== 'Object') { throw new $TypeError('iterator .return must return an object'); } return completionRecord; }; es-abstract-1.20.4/2015/IteratorComplete.js000066400000000000000000000007621431761430200202230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete module.exports = function IteratorComplete(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return ToBoolean(Get(iterResult, 'done')); }; es-abstract-1.20.4/2015/IteratorNext.js000066400000000000000000000007551431761430200173730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Invoke = require('./Invoke'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext module.exports = function IteratorNext(iterator, value) { var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]); if (Type(result) !== 'Object') { throw new $TypeError('iterator next must return an object'); } return result; }; es-abstract-1.20.4/2015/IteratorStep.js000066400000000000000000000005411431761430200173610ustar00rootroot00000000000000'use strict'; var IteratorComplete = require('./IteratorComplete'); var IteratorNext = require('./IteratorNext'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep module.exports = function IteratorStep(iterator) { var result = IteratorNext(iterator); var done = IteratorComplete(result); return done === true ? false : result; }; es-abstract-1.20.4/2015/IteratorValue.js000066400000000000000000000006731431761430200175300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue module.exports = function IteratorValue(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return Get(iterResult, 'value'); }; es-abstract-1.20.4/2015/MakeDate.js000066400000000000000000000005101431761430200164030ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.13 module.exports = function MakeDate(day, time) { if (!$isFinite(day) || !$isFinite(time)) { return NaN; } return (day * msPerDay) + time; }; es-abstract-1.20.4/2015/MakeDay.js000066400000000000000000000016251431761430200162530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $DateUTC = GetIntrinsic('%Date.UTC%'); var $isFinite = require('../helpers/isFinite'); var DateFromTime = require('./DateFromTime'); var Day = require('./Day'); var floor = require('./floor'); var modulo = require('./modulo'); var MonthFromTime = require('./MonthFromTime'); var ToInteger = require('./ToInteger'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.12 module.exports = function MakeDay(year, month, date) { if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { return NaN; } var y = ToInteger(year); var m = ToInteger(month); var dt = ToInteger(date); var ym = y + floor(m / 12); var mn = modulo(m, 12); var t = $DateUTC(ym, mn, 1); if (YearFromTime(t) !== ym || MonthFromTime(t) !== mn || DateFromTime(t) !== 1) { return NaN; } return Day(t) + dt - 1; }; es-abstract-1.20.4/2015/MakeTime.js000066400000000000000000000012721431761430200164320ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var msPerMinute = timeConstants.msPerMinute; var msPerHour = timeConstants.msPerHour; var ToInteger = require('./ToInteger'); // https://262.ecma-international.org/5.1/#sec-15.9.1.11 module.exports = function MakeTime(hour, min, sec, ms) { if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { return NaN; } var h = ToInteger(hour); var m = ToInteger(min); var s = ToInteger(sec); var milli = ToInteger(ms); var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; return t; }; es-abstract-1.20.4/2015/MinFromTime.js000066400000000000000000000006141431761430200171230ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerMinute = timeConstants.msPerMinute; var MinutesPerHour = timeConstants.MinutesPerHour; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function MinFromTime(t) { return modulo(floor(t / msPerMinute), MinutesPerHour); }; es-abstract-1.20.4/2015/MonthFromTime.js000066400000000000000000000017661431761430200174760ustar00rootroot00000000000000'use strict'; var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function MonthFromTime(t) { var day = DayWithinYear(t); if (0 <= day && day < 31) { return 0; } var leap = InLeapYear(t); if (31 <= day && day < (59 + leap)) { return 1; } if ((59 + leap) <= day && day < (90 + leap)) { return 2; } if ((90 + leap) <= day && day < (120 + leap)) { return 3; } if ((120 + leap) <= day && day < (151 + leap)) { return 4; } if ((151 + leap) <= day && day < (181 + leap)) { return 5; } if ((181 + leap) <= day && day < (212 + leap)) { return 6; } if ((212 + leap) <= day && day < (243 + leap)) { return 7; } if ((243 + leap) <= day && day < (273 + leap)) { return 8; } if ((273 + leap) <= day && day < (304 + leap)) { return 9; } if ((304 + leap) <= day && day < (334 + leap)) { return 10; } if ((334 + leap) <= day && day < (365 + leap)) { return 11; } }; es-abstract-1.20.4/2015/ObjectCreate.js000066400000000000000000000020111431761430200172600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ObjectCreate = GetIntrinsic('%Object.create%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var Type = require('./Type'); var hasProto = !({ __proto__: null } instanceof Object); // https://ecma-international.org/ecma-262/6.0/#sec-objectcreate module.exports = function ObjectCreate(proto, internalSlotsList) { if (proto !== null && Type(proto) !== 'Object') { throw new $TypeError('Assertion failed: `proto` must be null or an object'); } var slots = arguments.length < 2 ? [] : internalSlotsList; if (slots.length > 0) { throw new $SyntaxError('es-abstract does not yet support internal slots'); } if ($ObjectCreate) { return $ObjectCreate(proto); } if (hasProto) { return { __proto__: proto }; } if (proto === null) { throw new $SyntaxError('native Object.create support is required to create null objects'); } var T = function T() {}; T.prototype = proto; return new T(); }; es-abstract-1.20.4/2015/ObjectDefineProperties.js000066400000000000000000000027441431761430200213410ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var Get = require('./Get'); var ToObject = require('./ToObject'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var forEach = require('../helpers/forEach'); var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $push = callBound('Array.prototype.push'); // https://262.ecma-international.org/6.0/#sec-objectdefineproperties module.exports = function ObjectDefineProperties(O, Properties) { var props = ToObject(Properties); // step 1 var keys = OwnPropertyKeys(props); // step 2 var descriptors = []; // step 3 forEach(keys, function (nextKey) { // step 4 var propDesc = ToPropertyDescriptor(getOwnPropertyDescriptor(props, nextKey)); // step 4.a if (typeof propDesc !== 'undefined' && propDesc['[[Enumerable]]']) { // step 4.b var descObj = Get(props, nextKey); // step 4.b.i var desc = ToPropertyDescriptor(descObj); // step 4.b.ii $push(descriptors, [nextKey, desc]); // step 4.b.iii } }); forEach(descriptors, function (pair) { // step 5 var P = pair[0]; // step 5.a var desc = pair[1]; // step 5.b desc = FromPropertyDescriptor(desc); // TODO: remove this once DefinePropertyOrThrow is fixed DefinePropertyOrThrow(O, P, desc); // step 5.c }); return O; // step 6 }; es-abstract-1.20.4/2015/OrdinaryCreateFromConstructor.js000066400000000000000000000014501431761430200227410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor'); var IsArray = require('./IsArray'); var ObjectCreate = require('./ObjectCreate'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarycreatefromconstructor module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto); var slots = arguments.length < 3 ? [] : arguments[2]; if (!IsArray(slots)) { throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List'); } return ObjectCreate(proto, slots); }; es-abstract-1.20.4/2015/OrdinaryDefineOwnProperty.js000066400000000000000000000045261431761430200220760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var Type = require('./Type'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!$gOPD) { // ES3/IE 8 fallback if (IsAccessorDescriptor(Desc)) { throw new $SyntaxError('This environment does not support accessor property descriptors.'); } var creatingNormalDataProperty = !(P in O) && Desc['[[Writable]]'] && Desc['[[Enumerable]]'] && Desc['[[Configurable]]'] && '[[Value]]' in Desc; var settingExistingDataProperty = (P in O) && (!('[[Configurable]]' in Desc) || Desc['[[Configurable]]']) && (!('[[Enumerable]]' in Desc) || Desc['[[Enumerable]]']) && (!('[[Writable]]' in Desc) || Desc['[[Writable]]']) && '[[Value]]' in Desc; if (creatingNormalDataProperty || settingExistingDataProperty) { O[P] = Desc['[[Value]]']; // eslint-disable-line no-param-reassign return SameValue(O[P], Desc['[[Value]]']); } throw new $SyntaxError('This environment does not support defining non-writable, non-enumerable, or non-configurable properties'); } var desc = $gOPD(O, P); var current = desc && ToPropertyDescriptor(desc); var extensible = IsExtensible(O); return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current); }; es-abstract-1.20.4/2015/OrdinaryGetOwnProperty.js000066400000000000000000000023511431761430200214150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var has = require('has'); var IsArray = require('./IsArray'); var IsPropertyKey = require('./IsPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty module.exports = function OrdinaryGetOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!has(O, P)) { return void 0; } if (!$gOPD) { // ES3 / IE 8 fallback var arrayLength = IsArray(O) && P === 'length'; var regexLastIndex = IsRegExp(O) && P === 'lastIndex'; return { '[[Configurable]]': !(arrayLength || regexLastIndex), '[[Enumerable]]': $isEnumerable(O, P), '[[Value]]': O[P], '[[Writable]]': true }; } return ToPropertyDescriptor($gOPD(O, P)); }; es-abstract-1.20.4/2015/OrdinaryHasInstance.js000066400000000000000000000011631431761430200206450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance module.exports = function OrdinaryHasInstance(C, O) { if (IsCallable(C) === false) { return false; } if (Type(O) !== 'Object') { return false; } var P = Get(C, 'prototype'); if (Type(P) !== 'Object') { throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.'); } return O instanceof C; }; es-abstract-1.20.4/2015/OrdinaryHasProperty.js000066400000000000000000000010231431761430200207200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty module.exports = function OrdinaryHasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2015/QuoteJSONString.js000066400000000000000000000026161431761430200177170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var $numberToString = callBound('Number.prototype.toString'); var $toLowerCase = callBound('String.prototype.toLowerCase'); var $strSlice = callBound('String.prototype.slice'); var $strSplit = callBound('String.prototype.split'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-quotejsonstring var escapes = { '\u0008': 'b', '\u000C': 'f', '\u000A': 'n', '\u000D': 'r', '\u0009': 't' }; module.exports = function QuoteJSONString(value) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `value` must be a String'); } var product = '"'; if (value) { forEach($strSplit(value), function (C) { if (C === '"' || C === '\\') { product += '\u005C' + C; } else if (C === '\u0008' || C === '\u000C' || C === '\u000A' || C === '\u000D' || C === '\u0009') { var abbrev = escapes[C]; product += '\u005C' + abbrev; } else { var cCharCode = $charCodeAt(C, 0); if (cCharCode < 0x20) { product += '\u005Cu' + $toLowerCase($strSlice('0000' + $numberToString(cCharCode, 16), -4)); } else { product += C; } } }); } product += '"'; return product; }; es-abstract-1.20.4/2015/RegExpCreate.js000066400000000000000000000012031431761430200172460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RegExp = GetIntrinsic('%RegExp%'); // var RegExpAlloc = require('./RegExpAlloc'); // var RegExpInitialize = require('./RegExpInitialize'); var ToString = require('./ToString'); // https://262.ecma-international.org/6.0/#sec-regexpcreate module.exports = function RegExpCreate(P, F) { // var obj = RegExpAlloc($RegExp); // return RegExpInitialize(obj, P, F); // covers spec mechanics; bypass regex brand checking var pattern = typeof P === 'undefined' ? '' : ToString(P); var flags = typeof F === 'undefined' ? '' : ToString(F); return new $RegExp(pattern, flags); }; es-abstract-1.20.4/2015/RegExpExec.js000066400000000000000000000015671431761430200167440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var regexExec = require('call-bind/callBound')('RegExp.prototype.exec'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-regexpexec module.exports = function RegExpExec(R, S) { if (Type(R) !== 'Object') { throw new $TypeError('Assertion failed: `R` must be an Object'); } if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var exec = Get(R, 'exec'); if (IsCallable(exec)) { var result = Call(exec, R, [S]); if (result === null || Type(result) === 'Object') { return result; } throw new $TypeError('"exec" method must return `null` or an Object'); } return regexExec(R, S); }; es-abstract-1.20.4/2015/RequireObjectCoercible.js000066400000000000000000000001061431761430200213040ustar00rootroot00000000000000'use strict'; module.exports = require('../5/CheckObjectCoercible'); es-abstract-1.20.4/2015/SameValue.js000066400000000000000000000004631431761430200166210ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // http://262.ecma-international.org/5.1/#sec-9.12 module.exports = function SameValue(x, y) { if (x === y) { // 0 === -0, but they are not identical. if (x === 0) { return 1 / x === 1 / y; } return true; } return $isNaN(x) && $isNaN(y); }; es-abstract-1.20.4/2015/SameValueZero.js000066400000000000000000000003371431761430200174610ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero module.exports = function SameValueZero(x, y) { return (x === y) || ($isNaN(x) && $isNaN(y)); }; es-abstract-1.20.4/2015/SecFromTime.js000066400000000000000000000006221431761430200171110ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var SecondsPerMinute = timeConstants.SecondsPerMinute; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function SecFromTime(t) { return modulo(floor(t / msPerSecond), SecondsPerMinute); }; es-abstract-1.20.4/2015/Set.js000066400000000000000000000023471431761430200154750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // IE 9 does not throw in strict mode when writability/configurability/extensibility is violated var noThrowOnStrictViolation = (function () { try { delete [].length; return true; } catch (e) { return false; } }()); // https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw module.exports = function Set(O, P, V, Throw) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (Type(Throw) !== 'Boolean') { throw new $TypeError('Assertion failed: `Throw` must be a Boolean'); } if (Throw) { O[P] = V; // eslint-disable-line no-param-reassign if (noThrowOnStrictViolation && !SameValue(O[P], V)) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; } try { O[P] = V; // eslint-disable-line no-param-reassign return noThrowOnStrictViolation ? SameValue(O[P], V) : true; } catch (e) { return false; } }; es-abstract-1.20.4/2015/SetFunctionName.js000066400000000000000000000025451431761430200200040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname module.exports = function SetFunctionName(F, name) { if (typeof F !== 'function') { throw new $TypeError('Assertion failed: `F` must be a function'); } if (!IsExtensible(F) || has(F, 'name')) { throw new $TypeError('Assertion failed: `F` must be extensible, and must not have a `name` own property'); } var nameType = Type(name); if (nameType !== 'Symbol' && nameType !== 'String') { throw new $TypeError('Assertion failed: `name` must be a Symbol or a String'); } if (nameType === 'Symbol') { var description = getSymbolDescription(name); // eslint-disable-next-line no-param-reassign name = typeof description === 'undefined' ? '' : '[' + description + ']'; } if (arguments.length > 2) { var prefix = arguments[2]; // eslint-disable-next-line no-param-reassign name = prefix + ' ' + name; } return DefinePropertyOrThrow(F, 'name', { '[[Value]]': name, '[[Writable]]': false, '[[Enumerable]]': false, '[[Configurable]]': true }); }; es-abstract-1.20.4/2015/SetIntegrityLevel.js000066400000000000000000000035061431761430200203620ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var forEach = require('../helpers/forEach'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel module.exports = function SetIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } if (!$preventExtensions) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.preventExtensions` support'); } var status = $preventExtensions(O); if (!status) { return false; } if (!$gOPN) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support'); } var theKeys = $gOPN(O); if (level === 'sealed') { forEach(theKeys, function (k) { DefinePropertyOrThrow(O, k, { configurable: false }); }); } else if (level === 'frozen') { forEach(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { var desc; if (IsAccessorDescriptor(ToPropertyDescriptor(currentDesc))) { desc = { configurable: false }; } else { desc = { configurable: false, writable: false }; } DefinePropertyOrThrow(O, k, desc); } }); } return true; }; es-abstract-1.20.4/2015/SpeciesConstructor.js000066400000000000000000000015141431761430200205760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor module.exports = function SpeciesConstructor(O, defaultConstructor) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var C = O.constructor; if (typeof C === 'undefined') { return defaultConstructor; } if (Type(C) !== 'Object') { throw new $TypeError('O.constructor is not an Object'); } var S = $species ? C[$species] : void 0; if (S == null) { return defaultConstructor; } if (IsConstructor(S)) { return S; } throw new $TypeError('no constructor found'); }; es-abstract-1.20.4/2015/SplitMatch.js000066400000000000000000000015521431761430200170070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var $charAt = callBound('String.prototype.charAt'); // https://262.ecma-international.org/6.0/#sec-splitmatch module.exports = function SplitMatch(S, q, R) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(q)) { throw new $TypeError('Assertion failed: `q` must be an integer'); } if (Type(R) !== 'String') { throw new $TypeError('Assertion failed: `R` must be a String'); } var r = R.length; var s = S.length; if (q + r > s) { return false; } for (var i = 0; i < r; i += 1) { if ($charAt(S, q + i) !== $charAt(R, i)) { return false; } } return q + r; }; es-abstract-1.20.4/2015/StrictEqualityComparison.js000066400000000000000000000005511431761430200217560ustar00rootroot00000000000000'use strict'; var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.9.6 module.exports = function StrictEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType !== yType) { return false; } if (xType === 'Undefined' || xType === 'Null') { return true; } return x === y; // shortcut for steps 4-7 }; es-abstract-1.20.4/2015/StringCreate.js000066400000000000000000000021351431761430200173270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var $StringPrototype = GetIntrinsic('%String.prototype%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var Type = require('./Type'); var setProto = require('../helpers/setProto'); // https://262.ecma-international.org/6.0/#sec-stringcreate module.exports = function StringCreate(value, prototype) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var S = $Object(value); if (prototype !== $StringPrototype) { if (setProto) { setProto(S, prototype); } else { throw new $SyntaxError('StringCreate: a `proto` argument that is not `String.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } } var length = value.length; DefinePropertyOrThrow(S, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); return S; }; es-abstract-1.20.4/2015/StringGetIndexProperty.js000066400000000000000000000025351431761430200214040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $charAt = callBound('String.prototype.charAt'); var isString = require('is-string'); var isNegativeZero = require('is-negative-zero'); var unbox = require('unbox-primitive'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsInteger = require('./IsInteger'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://262.ecma-international.org/6.0/#sec-stringgetindexproperty 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)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (Type(P) !== 'String') { return void undefined; } var index = CanonicalNumericIndexString(P); if (typeof index === 'undefined' || !IsInteger(index) || isNegativeZero(index)) { return void undefined; } var str = unbox(S); var len = str.length; if (index < 0 || len <= index) { return void undefined; } var resultStr = $charAt(str, index); return { '[[Configurable]]': false, '[[Enumerable]]': true, '[[Value]]': resultStr, '[[Writable]]': false }; }; es-abstract-1.20.4/2015/SymbolDescriptiveString.js000066400000000000000000000010161431761430200215700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $SymbolToString = callBound('Symbol.prototype.toString', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring module.exports = function SymbolDescriptiveString(sym) { if (Type(sym) !== 'Symbol') { throw new $TypeError('Assertion failed: `sym` must be a Symbol'); } return $SymbolToString(sym); }; es-abstract-1.20.4/2015/TestIntegrityLevel.js000066400000000000000000000024051431761430200205430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var every = require('../helpers/every'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel module.exports = function TestIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } var status = IsExtensible(O); if (status) { return false; } var theKeys = OwnPropertyKeys(O); return theKeys.length === 0 || every(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { if (currentDesc.configurable) { return false; } if (level === 'frozen' && IsDataDescriptor(ToPropertyDescriptor(currentDesc)) && currentDesc.writable) { return false; } } return true; }); }; es-abstract-1.20.4/2015/TimeClip.js000066400000000000000000000007241431761430200164450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var $Number = GetIntrinsic('%Number%'); var $isFinite = require('../helpers/isFinite'); var abs = require('./abs'); var ToNumber = require('./ToNumber'); // https://262.ecma-international.org/5.1/#sec-15.9.1.14 module.exports = function TimeClip(time) { if (!$isFinite(time) || abs(time) > 8.64e15) { return NaN; } return $Number(new $Date(ToNumber(time))); }; es-abstract-1.20.4/2015/TimeFromYear.js000066400000000000000000000004051431761430200172760ustar00rootroot00000000000000'use strict'; var msPerDay = require('../helpers/timeConstants').msPerDay; var DayFromYear = require('./DayFromYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function TimeFromYear(y) { return msPerDay * DayFromYear(y); }; es-abstract-1.20.4/2015/TimeWithinDay.js000066400000000000000000000003671431761430200174610ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function TimeWithinDay(t) { return modulo(t, msPerDay); }; es-abstract-1.20.4/2015/ToBoolean.js000066400000000000000000000002021431761430200166100ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.2 module.exports = function ToBoolean(value) { return !!value; }; es-abstract-1.20.4/2015/ToDateString.js000066400000000000000000000007621431761430200173100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Date = GetIntrinsic('%Date%'); var $isNaN = require('../helpers/isNaN'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-todatestring module.exports = function ToDateString(tv) { if (Type(tv) !== 'Number') { throw new $TypeError('Assertion failed: `tv` must be a Number'); } if ($isNaN(tv)) { return 'Invalid Date'; } return $Date(tv); }; es-abstract-1.20.4/2015/ToInt16.js000066400000000000000000000004041431761430200161360ustar00rootroot00000000000000'use strict'; var ToUint16 = require('./ToUint16'); // https://ecma-international.org/ecma-262/6.0/#sec-toint16 module.exports = function ToInt16(argument) { var int16bit = ToUint16(argument); return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit; }; es-abstract-1.20.4/2015/ToInt32.js000066400000000000000000000002551431761430200161400ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.5 module.exports = function ToInt32(x) { return ToNumber(x) >> 0; }; es-abstract-1.20.4/2015/ToInt8.js000066400000000000000000000003671431761430200160670ustar00rootroot00000000000000'use strict'; var ToUint8 = require('./ToUint8'); // https://ecma-international.org/ecma-262/6.0/#sec-toint8 module.exports = function ToInt8(argument) { var int8bit = ToUint8(argument); return int8bit >= 0x80 ? int8bit - 0x100 : int8bit; }; es-abstract-1.20.4/2015/ToInteger.js000066400000000000000000000004211431761430200166310ustar00rootroot00000000000000'use strict'; var ES5ToInteger = require('../5/ToInteger'); var ToNumber = require('./ToNumber'); // https://ecma-international.org/ecma-262/6.0/#sec-tointeger module.exports = function ToInteger(value) { var number = ToNumber(value); return ES5ToInteger(number); }; es-abstract-1.20.4/2015/ToLength.js000066400000000000000000000005141431761430200164600ustar00rootroot00000000000000'use strict'; var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var ToInteger = require('./ToInteger'); module.exports = function ToLength(argument) { var len = ToInteger(argument); if (len <= 0) { return 0; } // includes converting -0 to +0 if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } return len; }; es-abstract-1.20.4/2015/ToNumber.js000066400000000000000000000037301431761430200164720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Number = GetIntrinsic('%Number%'); var $RegExp = GetIntrinsic('%RegExp%'); var $parseInteger = GetIntrinsic('%parseInt%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var isPrimitive = require('../helpers/isPrimitive'); var $strSlice = callBound('String.prototype.slice'); var isBinary = regexTester(/^0b[01]+$/i); var isOctal = regexTester(/^0o[0-7]+$/i); var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i); var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); var hasNonWS = regexTester(nonWSregex); // whitespace from: https://es5.github.io/#x15.5.4.20 // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324 var ws = [ '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003', '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028', '\u2029\uFEFF' ].join(''); var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); var $replace = callBound('String.prototype.replace'); var $trim = function (value) { return $replace(value, trimRegex, ''); }; var ToPrimitive = require('./ToPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-tonumber module.exports = function ToNumber(argument) { var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (typeof value === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a number'); } if (typeof value === 'string') { if (isBinary(value)) { return ToNumber($parseInteger($strSlice(value, 2), 2)); } else if (isOctal(value)) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; } var trimmed = $trim(value); if (trimmed !== value) { return ToNumber(trimmed); } } return $Number(value); }; es-abstract-1.20.4/2015/ToObject.js000066400000000000000000000005161431761430200164470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); // https://ecma-international.org/ecma-262/6.0/#sec-toobject module.exports = function ToObject(value) { RequireObjectCoercible(value); return $Object(value); }; es-abstract-1.20.4/2015/ToPrimitive.js000066400000000000000000000004371431761430200172130ustar00rootroot00000000000000'use strict'; var toPrimitive = require('es-to-primitive/es2015'); // https://ecma-international.org/ecma-262/6.0/#sec-toprimitive module.exports = function ToPrimitive(input) { if (arguments.length > 1) { return toPrimitive(input, arguments[1]); } return toPrimitive(input); }; es-abstract-1.20.4/2015/ToPropertyDescriptor.js000066400000000000000000000026541431761430200211310ustar00rootroot00000000000000'use strict'; var has = require('has'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var ToBoolean = require('./ToBoolean'); var IsCallable = require('./IsCallable'); // https://262.ecma-international.org/5.1/#sec-8.10.5 module.exports = function ToPropertyDescriptor(Obj) { if (Type(Obj) !== 'Object') { throw new $TypeError('ToPropertyDescriptor requires an object'); } var desc = {}; if (has(Obj, 'enumerable')) { desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable); } if (has(Obj, 'configurable')) { desc['[[Configurable]]'] = ToBoolean(Obj.configurable); } if (has(Obj, 'value')) { desc['[[Value]]'] = Obj.value; } if (has(Obj, 'writable')) { desc['[[Writable]]'] = ToBoolean(Obj.writable); } if (has(Obj, 'get')) { var getter = Obj.get; if (typeof getter !== 'undefined' && !IsCallable(getter)) { throw new $TypeError('getter must be a function'); } desc['[[Get]]'] = getter; } if (has(Obj, 'set')) { var setter = Obj.set; if (typeof setter !== 'undefined' && !IsCallable(setter)) { throw new $TypeError('setter must be a function'); } desc['[[Set]]'] = setter; } if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); } return desc; }; es-abstract-1.20.4/2015/ToPropertyKey.js000066400000000000000000000006251431761430200175370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var ToPrimitive = require('./ToPrimitive'); var ToString = require('./ToString'); // https://ecma-international.org/ecma-262/6.0/#sec-topropertykey module.exports = function ToPropertyKey(argument) { var key = ToPrimitive(argument, $String); return typeof key === 'symbol' ? key : ToString(key); }; es-abstract-1.20.4/2015/ToString.js000066400000000000000000000006141431761430200165060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); // https://ecma-international.org/ecma-262/6.0/#sec-tostring module.exports = function ToString(argument) { if (typeof argument === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a string'); } return $String(argument); }; es-abstract-1.20.4/2015/ToUint16.js000066400000000000000000000010641431761430200163260ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // http://262.ecma-international.org/5.1/#sec-9.7 module.exports = function ToUint16(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x10000); }; es-abstract-1.20.4/2015/ToUint32.js000066400000000000000000000002571431761430200163270ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.6 module.exports = function ToUint32(x) { return ToNumber(x) >>> 0; }; es-abstract-1.20.4/2015/ToUint8.js000066400000000000000000000011021431761430200162400ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8 module.exports = function ToUint8(argument) { var number = ToNumber(argument); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x100); }; es-abstract-1.20.4/2015/ToUint8Clamp.js000066400000000000000000000010121431761430200172150ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp module.exports = function ToUint8Clamp(argument) { var number = ToNumber(argument); if ($isNaN(number) || number <= 0) { return 0; } if (number >= 0xFF) { return 0xFF; } var f = floor(argument); if (f + 0.5 < number) { return f + 1; } if (number < f + 0.5) { return f; } if (f % 2 !== 0) { return f + 1; } return f; }; es-abstract-1.20.4/2015/Type.js000066400000000000000000000003711431761430200156560ustar00rootroot00000000000000'use strict'; var ES5Type = require('../5/Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ecmascript-data-types-and-values module.exports = function Type(x) { if (typeof x === 'symbol') { return 'Symbol'; } return ES5Type(x); }; es-abstract-1.20.4/2015/ValidateAndApplyPropertyDescriptor.js000066400000000000000000000121731431761430200237260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var isSamePropertyDescriptor = require('../helpers/isSamePropertyDescriptor'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-validateandapplypropertydescriptor // https://ecma-international.org/ecma-262/8.0/#sec-validateandapplypropertydescriptor // eslint-disable-next-line max-lines-per-function, max-statements, max-params module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) { // this uses the ES2017+ logic, since it fixes a number of bugs in the ES2015 logic. var oType = Type(O); if (oType !== 'Undefined' && oType !== 'Object') { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } if (Type(extensible) !== 'Boolean') { throw new $TypeError('Assertion failed: extensible must be a Boolean'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (Type(current) !== 'Undefined' && !isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } if (oType !== 'Undefined' && !IsPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (Type(current) === 'Undefined') { if (!extensible) { return false; } if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': Desc['[[Configurable]]'], '[[Enumerable]]': Desc['[[Enumerable]]'], '[[Value]]': Desc['[[Value]]'], '[[Writable]]': Desc['[[Writable]]'] } ); } } else { if (!IsAccessorDescriptor(Desc)) { throw new $TypeError('Assertion failed: Desc is not an accessor descriptor'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } } return true; } if (IsGenericDescriptor(Desc) && !('[[Configurable]]' in Desc) && !('[[Enumerable]]' in Desc)) { return true; } if (isSamePropertyDescriptor({ SameValue: SameValue }, Desc, current)) { return true; // removed by ES2017, but should still be correct } // "if every field in Desc is absent, return true" can't really match the assertion that it's a Property Descriptor if (!current['[[Configurable]]']) { if (Desc['[[Configurable]]']) { return false; } if ('[[Enumerable]]' in Desc && !Desc['[[Enumerable]]'] === !!current['[[Enumerable]]']) { return false; } } if (IsGenericDescriptor(Desc)) { // no further validation is required. } else if (IsDataDescriptor(current) !== IsDataDescriptor(Desc)) { if (!current['[[Configurable]]']) { return false; } if (IsDataDescriptor(current)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Get]]': undefined } ); } } else if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Value]]': undefined } ); } } else if (IsDataDescriptor(current) && IsDataDescriptor(Desc)) { if (!current['[[Configurable]]'] && !current['[[Writable]]']) { if ('[[Writable]]' in Desc && Desc['[[Writable]]']) { return false; } if ('[[Value]]' in Desc && !SameValue(Desc['[[Value]]'], current['[[Value]]'])) { return false; } return true; } } else if (IsAccessorDescriptor(current) && IsAccessorDescriptor(Desc)) { if (!current['[[Configurable]]']) { if ('[[Set]]' in Desc && !SameValue(Desc['[[Set]]'], current['[[Set]]'])) { return false; } if ('[[Get]]' in Desc && !SameValue(Desc['[[Get]]'], current['[[Get]]'])) { return false; } return true; } } else { throw new $TypeError('Assertion failed: current and Desc are not both data, both accessors, or one accessor and one data.'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } return true; }; es-abstract-1.20.4/2015/WeekDay.js000066400000000000000000000003201431761430200162600ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.6 module.exports = function WeekDay(t) { return modulo(Day(t) + 4, 7); }; es-abstract-1.20.4/2015/YearFromTime.js000066400000000000000000000006271431761430200173040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var callBound = require('call-bind/callBound'); var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function YearFromTime(t) { // largest y such that this.TimeFromYear(y) <= t return $getUTCFullYear(new $Date(t)); }; es-abstract-1.20.4/2015/abs.js000066400000000000000000000003171431761430200155020ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $abs = GetIntrinsic('%Math.abs%'); // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function abs(x) { return $abs(x); }; es-abstract-1.20.4/2015/floor.js000066400000000000000000000003311431761430200160520ustar00rootroot00000000000000'use strict'; // var modulo = require('./modulo'); var $floor = Math.floor; // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function floor(x) { // return x - modulo(x, 1); return $floor(x); }; es-abstract-1.20.4/2015/modulo.js000066400000000000000000000002501431761430200162300ustar00rootroot00000000000000'use strict'; var mod = require('../helpers/mod'); // https://262.ecma-international.org/5.1/#sec-5.2 module.exports = function modulo(x, y) { return mod(x, y); }; es-abstract-1.20.4/2015/msFromTime.js000066400000000000000000000003751431761430200170230ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerSecond = require('../helpers/timeConstants').msPerSecond; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function msFromTime(t) { return modulo(t, msPerSecond); }; es-abstract-1.20.4/2015/thisBooleanValue.js000066400000000000000000000005571431761430200202070ustar00rootroot00000000000000'use strict'; var $BooleanValueOf = require('call-bind/callBound')('Boolean.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-boolean-prototype-object module.exports = function thisBooleanValue(value) { if (Type(value) === 'Boolean') { return value; } return $BooleanValueOf(value); }; es-abstract-1.20.4/2015/thisNumberValue.js000066400000000000000000000006061431761430200200530ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var Type = require('./Type'); var $NumberValueOf = callBound('Number.prototype.valueOf'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object module.exports = function thisNumberValue(value) { if (Type(value) === 'Number') { return value; } return $NumberValueOf(value); }; es-abstract-1.20.4/2015/thisStringValue.js000066400000000000000000000005511431761430200200700ustar00rootroot00000000000000'use strict'; var $StringValueOf = require('call-bind/callBound')('String.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object module.exports = function thisStringValue(value) { if (Type(value) === 'String') { return value; } return $StringValueOf(value); }; es-abstract-1.20.4/2015/thisTimeValue.js000066400000000000000000000004131431761430200175150ustar00rootroot00000000000000'use strict'; var $DateGetTime = require('call-bind/callBound')('Date.prototype.getTime'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-date-prototype-object module.exports = function thisTimeValue(value) { return $DateGetTime(value); }; es-abstract-1.20.4/2016/000077500000000000000000000000001431761430200143775ustar00rootroot00000000000000es-abstract-1.20.4/2016/AbstractEqualityComparison.js000066400000000000000000000022021431761430200222450ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison module.exports = function AbstractEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType === yType) { return x === y; // ES6+ specified this shortcut anyways. } if (x == null && y == null) { return true; } if (xType === 'Number' && yType === 'String') { return AbstractEqualityComparison(x, ToNumber(y)); } if (xType === 'String' && yType === 'Number') { return AbstractEqualityComparison(ToNumber(x), y); } if (xType === 'Boolean') { return AbstractEqualityComparison(ToNumber(x), y); } if (yType === 'Boolean') { return AbstractEqualityComparison(x, ToNumber(y)); } if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') { return AbstractEqualityComparison(x, ToPrimitive(y)); } if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) { return AbstractEqualityComparison(ToPrimitive(x), y); } return false; }; es-abstract-1.20.4/2016/AbstractRelationalComparison.js000066400000000000000000000030661431761430200225530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var isPrefixOf = require('../helpers/isPrefixOf'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.8.5 // eslint-disable-next-line max-statements module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); } var px; var py; if (LeftFirst) { px = ToPrimitive(x, $Number); py = ToPrimitive(y, $Number); } else { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } var bothStrings = Type(px) === 'String' && Type(py) === 'String'; if (!bothStrings) { var nx = ToNumber(px); var ny = ToNumber(py); if ($isNaN(nx) || $isNaN(ny)) { return undefined; } if ($isFinite(nx) && $isFinite(ny) && nx === ny) { return false; } if (nx === Infinity) { return false; } if (ny === Infinity) { return true; } if (ny === -Infinity) { return false; } if (nx === -Infinity) { return true; } return nx < ny; // by now, these are both nonzero, finite, and not equal } if (isPrefixOf(py, px)) { return false; } if (isPrefixOf(px, py)) { return true; } return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f }; es-abstract-1.20.4/2016/AdvanceStringIndex.js000066400000000000000000000024311431761430200204550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = require('call-bind/callBound')('String.prototype.charCodeAt'); // https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex module.exports = function AdvanceStringIndex(S, index, unicode) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53'); } if (Type(unicode) !== 'Boolean') { throw new $TypeError('Assertion failed: `unicode` must be a Boolean'); } if (!unicode) { return index + 1; } var length = S.length; if ((index + 1) >= length) { return index + 1; } var first = $charCodeAt(S, index); if (!isLeadingSurrogate(first)) { return index + 1; } var second = $charCodeAt(S, index + 1); if (!isTrailingSurrogate(second)) { return index + 1; } return index + 2; }; es-abstract-1.20.4/2016/ArrayCreate.js000066400000000000000000000031621431761430200171410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ArrayPrototype = GetIntrinsic('%Array.prototype%'); var $RangeError = GetIntrinsic('%RangeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || ( // eslint-disable-next-line no-proto, no-negated-condition [].__proto__ !== $ArrayPrototype ? null : function (O, proto) { O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign return O; } ); // https://ecma-international.org/ecma-262/6.0/#sec-arraycreate module.exports = function ArrayCreate(length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0'); } if (length > MAX_ARRAY_LENGTH) { throw new $RangeError('length is greater than (2**32 - 1)'); } var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype; var A = []; // steps 5 - 7, and 9 if (proto !== $ArrayPrototype) { // step 8 if (!$setProto) { throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } $setProto(A, proto); } if (length !== 0) { // bypasses the need for step 2 A.length = length; } /* step 10, the above as a shortcut for the below OrdinaryDefineOwnProperty(A, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': true }); */ return A; }; es-abstract-1.20.4/2016/ArraySetLength.js000066400000000000000000000051511431761430200176330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var assign = require('object.assign'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsArray = require('./IsArray'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function ArraySetLength(A, Desc) { if (!IsArray(A)) { throw new $TypeError('Assertion failed: A must be an Array'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!('[[Value]]' in Desc)) { return OrdinaryDefineOwnProperty(A, 'length', Desc); } var newLenDesc = assign({}, Desc); var newLen = ToUint32(Desc['[[Value]]']); var numberLen = ToNumber(Desc['[[Value]]']); if (newLen !== numberLen) { throw new $RangeError('Invalid array length'); } newLenDesc['[[Value]]'] = newLen; var oldLenDesc = OrdinaryGetOwnProperty(A, 'length'); if (!IsDataDescriptor(oldLenDesc)) { throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`'); } var oldLen = oldLenDesc['[[Value]]']; if (newLen >= oldLen) { return OrdinaryDefineOwnProperty(A, 'length', newLenDesc); } if (!oldLenDesc['[[Writable]]']) { return false; } var newWritable; if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) { newWritable = true; } else { newWritable = false; newLenDesc['[[Writable]]'] = true; } var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc); if (!succeeded) { return false; } while (newLen < oldLen) { oldLen -= 1; // eslint-disable-next-line no-param-reassign var deleteSucceeded = delete A[ToString(oldLen)]; if (!deleteSucceeded) { newLenDesc['[[Value]]'] = oldLen + 1; if (!newWritable) { newLenDesc['[[Writable]]'] = false; OrdinaryDefineOwnProperty(A, 'length', newLenDesc); return false; } } } if (!newWritable) { return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false }); } return true; }; es-abstract-1.20.4/2016/ArraySpeciesCreate.js000066400000000000000000000025041431761430200204540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Array = GetIntrinsic('%Array%'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsConstructor = require('./IsConstructor'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate module.exports = function ArraySpeciesCreate(originalArray, length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: length must be an integer >= 0'); } var len = length === 0 ? 0 : length; var C; var isArray = IsArray(originalArray); if (isArray) { C = Get(originalArray, 'constructor'); // TODO: figure out how to make a cross-realm normal Array, a same-realm Array // if (IsConstructor(C)) { // if C is another realm's Array, C = undefined // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ? // } if ($species && Type(C) === 'Object') { C = Get(C, $species); if (C === null) { C = void 0; } } } if (typeof C === 'undefined') { return $Array(len); } if (!IsConstructor(C)) { throw new $TypeError('C must be a constructor'); } return new C(len); // Construct(C, len); }; es-abstract-1.20.4/2016/Call.js000066400000000000000000000011571431761430200156140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsArray = require('./IsArray'); var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%'); // https://ecma-international.org/ecma-262/6.0/#sec-call module.exports = function Call(F, V) { var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } return $apply(F, V, argumentsList); }; es-abstract-1.20.4/2016/CanonicalNumericIndexString.js000066400000000000000000000012161431761430200223260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring module.exports = function CanonicalNumericIndexString(argument) { if (Type(argument) !== 'String') { throw new $TypeError('Assertion failed: `argument` must be a String'); } if (argument === '-0') { return -0; } var n = ToNumber(argument); if (SameValue(ToString(n), argument)) { return n; } return void 0; }; es-abstract-1.20.4/2016/CharacterRange.js000066400000000000000000000014161431761430200176100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = callBound('%String.prototype.charCodeAt%'); var $push = callBound('%Array.prototype.push%'); module.exports = function CharacterRange(A, B) { if (A.length !== 1 || B.length !== 1) { throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); } var a = A[0]; var b = B[0]; var i = $charCodeAt(a, 0); var j = $charCodeAt(b, 0); if (!(i <= j)) { throw new $TypeError('Assertion failed: i is not <= j'); } var arr = []; for (var k = i; k <= j; k += 1) { $push(arr, $fromCharCode(k)); } return arr; }; es-abstract-1.20.4/2016/CompletePropertyDescriptor.js000066400000000000000000000017351431761430200223170ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor module.exports = function CompletePropertyDescriptor(Desc) { /* eslint no-param-reassign: 0 */ assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (!has(Desc, '[[Value]]')) { Desc['[[Value]]'] = void 0; } if (!has(Desc, '[[Writable]]')) { Desc['[[Writable]]'] = false; } } else { if (!has(Desc, '[[Get]]')) { Desc['[[Get]]'] = void 0; } if (!has(Desc, '[[Set]]')) { Desc['[[Set]]'] = void 0; } } if (!has(Desc, '[[Enumerable]]')) { Desc['[[Enumerable]]'] = false; } if (!has(Desc, '[[Configurable]]')) { Desc['[[Configurable]]'] = false; } return Desc; }; es-abstract-1.20.4/2016/CreateDataProperty.js000066400000000000000000000023771431761430200205100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty module.exports = function CreateDataProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var oldDesc = OrdinaryGetOwnProperty(O, P); var extensible = !oldDesc || IsExtensible(O); var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]']; if (nonConfigurable || !extensible) { return false; } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Value]]': V, '[[Writable]]': true } ); }; es-abstract-1.20.4/2016/CreateDataPropertyOrThrow.js000066400000000000000000000013361431761430200220270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var CreateDataProperty = require('./CreateDataProperty'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var success = CreateDataProperty(O, P, V); if (!success) { throw new $TypeError('unable to create data property'); } return success; }; es-abstract-1.20.4/2016/CreateHTML.js000066400000000000000000000016371431761430200166340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $replace = callBound('String.prototype.replace'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createhtml module.exports = function CreateHTML(string, tag, attribute, value) { if (Type(tag) !== 'String' || Type(attribute) !== 'String') { throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings'); } var str = RequireObjectCoercible(string); var S = ToString(str); var p1 = '<' + tag; if (attribute !== '') { var V = ToString(value); var escapedV = $replace(V, /\x22/g, '"'); p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22'; } return p1 + '>' + S + ''; }; es-abstract-1.20.4/2016/CreateIterResultObject.js000066400000000000000000000006601431761430200213140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject module.exports = function CreateIterResultObject(value, done) { if (Type(done) !== 'Boolean') { throw new $TypeError('Assertion failed: Type(done) is not Boolean'); } return { value: value, done: done }; }; es-abstract-1.20.4/2016/CreateListFromArrayLike.js000066400000000000000000000025121431761430200214240ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $indexOf = callBound('Array.prototype.indexOf', true) || callBound('String.prototype.indexOf'); var $push = callBound('Array.prototype.push'); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createlistfromarraylike module.exports = function CreateListFromArrayLike(obj) { var elementTypes = arguments.length > 1 ? arguments[1] : ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object']; if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } if (!IsArray(elementTypes)) { throw new $TypeError('Assertion failed: `elementTypes`, if provided, must be an array'); } var len = ToLength(Get(obj, 'length')); var list = []; var index = 0; while (index < len) { var indexName = ToString(index); var next = Get(obj, indexName); var nextType = Type(next); if ($indexOf(elementTypes, nextType) < 0) { throw new $TypeError('item type ' + nextType + ' is not a valid elementType'); } $push(list, next); index += 1; } return list; }; es-abstract-1.20.4/2016/CreateMethodProperty.js000066400000000000000000000017231431761430200210510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty module.exports = function CreateMethodProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var newDesc = { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': V, '[[Writable]]': true }; return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, newDesc ); }; es-abstract-1.20.4/2016/DateFromTime.js000066400000000000000000000020141431761430200172520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); var MonthFromTime = require('./MonthFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.5 module.exports = function DateFromTime(t) { var m = MonthFromTime(t); var d = DayWithinYear(t); if (m === 0) { return d + 1; } if (m === 1) { return d - 30; } var leap = InLeapYear(t); if (m === 2) { return d - 58 - leap; } if (m === 3) { return d - 89 - leap; } if (m === 4) { return d - 119 - leap; } if (m === 5) { return d - 150 - leap; } if (m === 6) { return d - 180 - leap; } if (m === 7) { return d - 211 - leap; } if (m === 8) { return d - 242 - leap; } if (m === 9) { return d - 272 - leap; } if (m === 10) { return d - 303 - leap; } if (m === 11) { return d - 333 - leap; } throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m); }; es-abstract-1.20.4/2016/Day.js000066400000000000000000000003521431761430200154520ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function Day(t) { return floor(t / msPerDay); }; es-abstract-1.20.4/2016/DayFromYear.js000066400000000000000000000004001431761430200171110ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DayFromYear(y) { return (365 * (y - 1970)) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400); }; es-abstract-1.20.4/2016/DayWithinYear.js000066400000000000000000000004361431761430200174610ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var DayFromYear = require('./DayFromYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function DayWithinYear(t) { return Day(t) - DayFromYear(YearFromTime(t)); }; es-abstract-1.20.4/2016/DaysInYear.js000066400000000000000000000004551431761430200167510ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DaysInYear(y) { if (modulo(y, 4) !== 0) { return 365; } if (modulo(y, 100) !== 0) { return 366; } if (modulo(y, 400) !== 0) { return 365; } return 366; }; es-abstract-1.20.4/2016/DefinePropertyOrThrow.js000066400000000000000000000026721431761430200212300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow module.exports = function DefinePropertyOrThrow(O, P, desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var Desc = isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, desc) ? desc : ToPropertyDescriptor(desc); if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor'); } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); }; es-abstract-1.20.4/2016/DeletePropertyOrThrow.js000066400000000000000000000012731431761430200212340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow module.exports = function DeletePropertyOrThrow(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // eslint-disable-next-line no-param-reassign var success = delete O[P]; if (!success) { throw new $TypeError('Attempt to delete property failed.'); } return success; }; es-abstract-1.20.4/2016/EnumerableOwnNames.js000066400000000000000000000006411431761430200204650ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var keys = require('object-keys'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-enumerableownnames module.exports = function EnumerableOwnNames(O) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } return keys(O); }; es-abstract-1.20.4/2016/FromPropertyDescriptor.js000066400000000000000000000007021431761430200214430ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor module.exports = function FromPropertyDescriptor(Desc) { if (typeof Desc !== 'undefined') { assertRecord(Type, 'Property Descriptor', 'Desc', Desc); } return fromPropertyDescriptor(Desc); }; es-abstract-1.20.4/2016/Get.js000066400000000000000000000011321431761430200154510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var inspect = require('object-inspect'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-get-o-p module.exports = function Get(O, P) { // 7.3.1.1 if (Type(O) !== 'Object') { 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)); } // 7.3.1.3 return O[P]; }; es-abstract-1.20.4/2016/GetIterator.js000066400000000000000000000015301431761430200171650ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var getIteratorMethod = require('../helpers/getIteratorMethod'); var AdvanceStringIndex = require('./AdvanceStringIndex'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsArray = require('./IsArray'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getiterator module.exports = function GetIterator(obj, method) { var actualMethod = method; if (arguments.length < 2) { actualMethod = getIteratorMethod( { AdvanceStringIndex: AdvanceStringIndex, GetMethod: GetMethod, IsArray: IsArray }, obj ); } var iterator = Call(actualMethod, obj); if (Type(iterator) !== 'Object') { throw new $TypeError('iterator must return an object'); } return iterator; }; es-abstract-1.20.4/2016/GetMethod.js000066400000000000000000000012271431761430200166170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-getmethod module.exports = function GetMethod(O, P) { // 7.3.9.1 if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // 7.3.9.2 var func = GetV(O, P); // 7.3.9.4 if (func == null) { return void 0; } // 7.3.9.5 if (!IsCallable(func)) { throw new $TypeError(P + 'is not a function'); } // 7.3.9.6 return func; }; es-abstract-1.20.4/2016/GetOwnPropertyKeys.js000066400000000000000000000014751431761430200205500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%', true); var keys = require('object-keys'); var esType = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys module.exports = function GetOwnPropertyKeys(O, Type) { if (esType(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (Type === 'Symbol') { return $gOPS ? $gOPS(O) : []; } if (Type === 'String') { if (!$gOPN) { return keys(O); } return $gOPN(O); } throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`'); }; es-abstract-1.20.4/2016/GetPrototypeFromConstructor.js000066400000000000000000000016311431761430200224750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Function = GetIntrinsic('%Function%'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic if (!IsConstructor(constructor)) { throw new $TypeError('Assertion failed: `constructor` must be a constructor'); } var proto = Get(constructor, 'prototype'); if (Type(proto) !== 'Object') { if (!(constructor instanceof $Function)) { // ignore other realms, for now throw new $TypeError('cross-realm constructors not currently supported'); } proto = intrinsic; } return proto; }; es-abstract-1.20.4/2016/GetSubstitution.js000066400000000000000000000066741431761430200201260ustar00rootroot00000000000000 'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $parseInt = GetIntrinsic('%parseInt%'); var inspect = require('object-inspect'); var regexTester = require('safe-regex-test'); var callBound = require('call-bind/callBound'); var every = require('../helpers/every'); var isDigit = regexTester(/^[0-9]$/); var $charAt = callBound('String.prototype.charAt'); var $strSlice = callBound('String.prototype.slice'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false var isStringOrHole = function (capture, index, arr) { return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined'); }; // https://ecma-international.org/ecma-262/6.0/#sec-getsubstitution // eslint-disable-next-line max-statements, max-params, max-lines-per-function module.exports = function GetSubstitution(matched, str, position, captures, replacement) { if (Type(matched) !== 'String') { throw new $TypeError('Assertion failed: `matched` must be a String'); } var matchLength = matched.length; if (Type(str) !== 'String') { throw new $TypeError('Assertion failed: `str` must be a String'); } var stringLength = str.length; if (!IsInteger(position) || position < 0 || position > stringLength) { throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position)); } if (!IsArray(captures) || !every(captures, isStringOrHole)) { throw new $TypeError('Assertion failed: `captures` must be a List of Strings, got ' + inspect(captures)); } if (Type(replacement) !== 'String') { throw new $TypeError('Assertion failed: `replacement` must be a String'); } var tailPos = position + matchLength; var m = captures.length; var result = ''; for (var i = 0; i < replacement.length; i += 1) { // if this is a $, and it's not the end of the replacement var current = $charAt(replacement, i); var isLast = (i + 1) >= replacement.length; var nextIsLast = (i + 2) >= replacement.length; if (current === '$' && !isLast) { var next = $charAt(replacement, i + 1); if (next === '$') { result += '$'; i += 1; } else if (next === '&') { result += matched; i += 1; } else if (next === '`') { result += position === 0 ? '' : $strSlice(str, 0, position - 1); i += 1; } else if (next === "'") { result += tailPos >= stringLength ? '' : $strSlice(str, tailPos); i += 1; } else { var nextNext = nextIsLast ? null : $charAt(replacement, i + 2); if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) { // $1 through $9, and not followed by a digit var n = $parseInt(next, 10); // if (n > m, impl-defined) result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1]; i += 1; } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) { // $00 through $99 var nn = next + nextNext; var nnI = $parseInt(nn, 10) - 1; // if nn === '00' or nn > m, impl-defined result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI]; i += 2; } else { result += '$'; } } } else { // the final $, or else not a $ result += $charAt(replacement, i); } } return result; }; es-abstract-1.20.4/2016/GetV.js000066400000000000000000000007321431761430200156040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var ToObject = require('./ToObject'); // https://ecma-international.org/ecma-262/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'); } // 7.3.2.2-3 var O = ToObject(V); // 7.3.2.4 return O[P]; }; es-abstract-1.20.4/2016/HasOwnProperty.js000066400000000000000000000010511431761430200176760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var has = require('has'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty module.exports = function HasOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return has(O, P); }; es-abstract-1.20.4/2016/HasProperty.js000066400000000000000000000010051431761430200172110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty module.exports = function HasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2016/HourFromTime.js000066400000000000000000000005761431761430200173250ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerHour = timeConstants.msPerHour; var HoursPerDay = timeConstants.HoursPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function HourFromTime(t) { return modulo(floor(t / msPerHour), HoursPerDay); }; es-abstract-1.20.4/2016/InLeapYear.js000066400000000000000000000007761431761430200167400ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DaysInYear = require('./DaysInYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function InLeapYear(t) { var days = DaysInYear(YearFromTime(t)); if (days === 365) { return 0; } if (days === 366) { return 1; } throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days); }; es-abstract-1.20.4/2016/InstanceofOperator.js000066400000000000000000000016261431761430200205470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $hasInstance = GetIntrinsic('Symbol.hasInstance', true); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var OrdinaryHasInstance = require('./OrdinaryHasInstance'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator module.exports = function InstanceofOperator(O, C) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var instOfHandler = $hasInstance ? GetMethod(C, $hasInstance) : void 0; if (typeof instOfHandler !== 'undefined') { return ToBoolean(Call(instOfHandler, C, [O])); } if (!IsCallable(C)) { throw new $TypeError('`C` is not Callable'); } return OrdinaryHasInstance(C, O); }; es-abstract-1.20.4/2016/Invoke.js000066400000000000000000000013131431761430200161660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-invoke module.exports = function Invoke(O, P) { if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } var func = GetV(O, P); return Call(func, O, argumentsList); }; es-abstract-1.20.4/2016/IsAccessorDescriptor.js000066400000000000000000000007211431761430200210320ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor module.exports = function IsAccessorDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { return false; } return true; }; es-abstract-1.20.4/2016/IsArray.js000066400000000000000000000001731431761430200163100ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-isarray module.exports = require('../helpers/IsArray'); es-abstract-1.20.4/2016/IsCallable.js000066400000000000000000000001541431761430200167300ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.11 module.exports = require('is-callable'); es-abstract-1.20.4/2016/IsCompatiblePropertyDescriptor.js000066400000000000000000000005571431761430200231230ustar00rootroot00000000000000'use strict'; var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); }; es-abstract-1.20.4/2016/IsConcatSpreadable.js000066400000000000000000000011621431761430200204230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable module.exports = function IsConcatSpreadable(O) { if (Type(O) !== 'Object') { return false; } if ($isConcatSpreadable) { var spreadable = Get(O, $isConcatSpreadable); if (typeof spreadable !== 'undefined') { return ToBoolean(spreadable); } } return IsArray(O); }; es-abstract-1.20.4/2016/IsConstructor.js000066400000000000000000000021751431761430200175630ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('../GetIntrinsic.js'); var $construct = GetIntrinsic('%Reflect.construct%', true); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); try { DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} }); } catch (e) { // Accessor properties aren't supported DefinePropertyOrThrow = null; } // https://ecma-international.org/ecma-262/6.0/#sec-isconstructor if (DefinePropertyOrThrow && $construct) { var isConstructorMarker = {}; var badArrayLike = {}; DefinePropertyOrThrow(badArrayLike, 'length', { '[[Get]]': function () { throw isConstructorMarker; }, '[[Enumerable]]': true }); module.exports = function IsConstructor(argument) { try { // `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`: $construct(argument, badArrayLike); } catch (err) { return err === isConstructorMarker; } }; } else { module.exports = function IsConstructor(argument) { // unfortunately there's no way to truly check this without try/catch `new argument` in old environments return typeof argument === 'function' && !!argument.prototype; }; } es-abstract-1.20.4/2016/IsDataDescriptor.js000066400000000000000000000007201431761430200201400ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor module.exports = function IsDataDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { return false; } return true; }; es-abstract-1.20.4/2016/IsExtensible.js000066400000000000000000000007751431761430200173440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $isExtensible = GetIntrinsic('%Object.isExtensible%', true); var isPrimitive = require('../helpers/isPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o module.exports = $preventExtensions ? function IsExtensible(obj) { return !isPrimitive(obj) && $isExtensible(obj); } : function IsExtensible(obj) { return !isPrimitive(obj); }; es-abstract-1.20.4/2016/IsGenericDescriptor.js000066400000000000000000000010601431761430200206410ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor module.exports = function IsGenericDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) { return true; } return false; }; es-abstract-1.20.4/2016/IsInteger.js000066400000000000000000000007021431761430200166250ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); // https://ecma-international.org/ecma-262/6.0/#sec-isinteger module.exports = function IsInteger(argument) { if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) { return false; } var absValue = abs(argument); return floor(absValue) === absValue; }; es-abstract-1.20.4/2016/IsPromise.js000066400000000000000000000007451431761430200166550ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $PromiseThen = callBound('Promise.prototype.then', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ispromise module.exports = function IsPromise(x) { if (Type(x) !== 'Object') { return false; } if (!$PromiseThen) { // Promises are not supported return false; } try { $PromiseThen(x); // throws if not a promise } catch (e) { return false; } return true; }; es-abstract-1.20.4/2016/IsPropertyDescriptor.js000066400000000000000000000010521431761430200211120ustar00rootroot00000000000000'use strict'; // TODO, semver-major: delete this var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var Type = require('./Type'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); // https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type module.exports = function IsPropertyDescriptor(Desc) { return isPropertyDescriptor({ IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor, Type: Type }, Desc); }; es-abstract-1.20.4/2016/IsPropertyKey.js000066400000000000000000000003171431761430200175270ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { return typeof argument === 'string' || typeof argument === 'symbol'; }; es-abstract-1.20.4/2016/IsRegExp.js000066400000000000000000000010411431761430200164170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $match = GetIntrinsic('%Symbol.match%', true); var hasRegExpMatcher = require('is-regex'); var ToBoolean = require('./ToBoolean'); // https://ecma-international.org/ecma-262/6.0/#sec-isregexp module.exports = function IsRegExp(argument) { if (!argument || typeof argument !== 'object') { return false; } if ($match) { var isRegExp = argument[$match]; if (typeof isRegExp !== 'undefined') { return ToBoolean(isRegExp); } } return hasRegExpMatcher(argument); }; es-abstract-1.20.4/2016/IterableToArrayLike.js000066400000000000000000000021111431761430200205660ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $arrayPush = callBound('Array.prototype.push'); var getIteratorMethod = require('../helpers/getIteratorMethod'); var AdvanceStringIndex = require('./AdvanceStringIndex'); var GetIterator = require('./GetIterator'); var GetMethod = require('./GetMethod'); var IsArray = require('./IsArray'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); var ToObject = require('./ToObject'); var ES = { AdvanceStringIndex: AdvanceStringIndex, GetMethod: GetMethod, IsArray: IsArray }; // https://262.ecma-international.org/7.0/#sec-iterabletoarraylike module.exports = function IterableToArrayLike(items) { var usingIterator = getIteratorMethod(ES, items); if (typeof usingIterator !== 'undefined') { var iterator = GetIterator(items, usingIterator); var values = []; var next = true; while (next) { next = IteratorStep(iterator); if (next) { var nextValue = IteratorValue(next); $arrayPush(values, nextValue); } } return values; } return ToObject(items); }; es-abstract-1.20.4/2016/IteratorClose.js000066400000000000000000000027111431761430200175150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose module.exports = function IteratorClose(iterator, completion) { if (Type(iterator) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterator) is not Object'); } if (!IsCallable(completion)) { throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record'); } var completionThunk = completion; var iteratorReturn = GetMethod(iterator, 'return'); if (typeof iteratorReturn === 'undefined') { return completionThunk(); } var completionRecord; try { var innerResult = Call(iteratorReturn, iterator, []); } catch (e) { // if we hit here, then "e" is the innerResult completion that needs re-throwing // if the completion is of type "throw", this will throw. completionThunk(); completionThunk = null; // ensure it's not called twice. // if not, then return the innerResult completion throw e; } completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does completionThunk = null; // ensure it's not called twice. if (Type(innerResult) !== 'Object') { throw new $TypeError('iterator .return must return an object'); } return completionRecord; }; es-abstract-1.20.4/2016/IteratorComplete.js000066400000000000000000000007621431761430200202240ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete module.exports = function IteratorComplete(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return ToBoolean(Get(iterResult, 'done')); }; es-abstract-1.20.4/2016/IteratorNext.js000066400000000000000000000007551431761430200173740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Invoke = require('./Invoke'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext module.exports = function IteratorNext(iterator, value) { var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]); if (Type(result) !== 'Object') { throw new $TypeError('iterator next must return an object'); } return result; }; es-abstract-1.20.4/2016/IteratorStep.js000066400000000000000000000005411431761430200173620ustar00rootroot00000000000000'use strict'; var IteratorComplete = require('./IteratorComplete'); var IteratorNext = require('./IteratorNext'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep module.exports = function IteratorStep(iterator) { var result = IteratorNext(iterator); var done = IteratorComplete(result); return done === true ? false : result; }; es-abstract-1.20.4/2016/IteratorValue.js000066400000000000000000000006731431761430200175310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue module.exports = function IteratorValue(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return Get(iterResult, 'value'); }; es-abstract-1.20.4/2016/MakeDate.js000066400000000000000000000005101431761430200164040ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.13 module.exports = function MakeDate(day, time) { if (!$isFinite(day) || !$isFinite(time)) { return NaN; } return (day * msPerDay) + time; }; es-abstract-1.20.4/2016/MakeDay.js000066400000000000000000000016251431761430200162540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $DateUTC = GetIntrinsic('%Date.UTC%'); var $isFinite = require('../helpers/isFinite'); var DateFromTime = require('./DateFromTime'); var Day = require('./Day'); var floor = require('./floor'); var modulo = require('./modulo'); var MonthFromTime = require('./MonthFromTime'); var ToInteger = require('./ToInteger'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.12 module.exports = function MakeDay(year, month, date) { if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { return NaN; } var y = ToInteger(year); var m = ToInteger(month); var dt = ToInteger(date); var ym = y + floor(m / 12); var mn = modulo(m, 12); var t = $DateUTC(ym, mn, 1); if (YearFromTime(t) !== ym || MonthFromTime(t) !== mn || DateFromTime(t) !== 1) { return NaN; } return Day(t) + dt - 1; }; es-abstract-1.20.4/2016/MakeTime.js000066400000000000000000000012721431761430200164330ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var msPerMinute = timeConstants.msPerMinute; var msPerHour = timeConstants.msPerHour; var ToInteger = require('./ToInteger'); // https://262.ecma-international.org/5.1/#sec-15.9.1.11 module.exports = function MakeTime(hour, min, sec, ms) { if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { return NaN; } var h = ToInteger(hour); var m = ToInteger(min); var s = ToInteger(sec); var milli = ToInteger(ms); var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; return t; }; es-abstract-1.20.4/2016/MinFromTime.js000066400000000000000000000006141431761430200171240ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerMinute = timeConstants.msPerMinute; var MinutesPerHour = timeConstants.MinutesPerHour; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function MinFromTime(t) { return modulo(floor(t / msPerMinute), MinutesPerHour); }; es-abstract-1.20.4/2016/MonthFromTime.js000066400000000000000000000017661431761430200174770ustar00rootroot00000000000000'use strict'; var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function MonthFromTime(t) { var day = DayWithinYear(t); if (0 <= day && day < 31) { return 0; } var leap = InLeapYear(t); if (31 <= day && day < (59 + leap)) { return 1; } if ((59 + leap) <= day && day < (90 + leap)) { return 2; } if ((90 + leap) <= day && day < (120 + leap)) { return 3; } if ((120 + leap) <= day && day < (151 + leap)) { return 4; } if ((151 + leap) <= day && day < (181 + leap)) { return 5; } if ((181 + leap) <= day && day < (212 + leap)) { return 6; } if ((212 + leap) <= day && day < (243 + leap)) { return 7; } if ((243 + leap) <= day && day < (273 + leap)) { return 8; } if ((273 + leap) <= day && day < (304 + leap)) { return 9; } if ((304 + leap) <= day && day < (334 + leap)) { return 10; } if ((334 + leap) <= day && day < (365 + leap)) { return 11; } }; es-abstract-1.20.4/2016/ObjectCreate.js000066400000000000000000000020111431761430200172610ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ObjectCreate = GetIntrinsic('%Object.create%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var Type = require('./Type'); var hasProto = !({ __proto__: null } instanceof Object); // https://ecma-international.org/ecma-262/6.0/#sec-objectcreate module.exports = function ObjectCreate(proto, internalSlotsList) { if (proto !== null && Type(proto) !== 'Object') { throw new $TypeError('Assertion failed: `proto` must be null or an object'); } var slots = arguments.length < 2 ? [] : internalSlotsList; if (slots.length > 0) { throw new $SyntaxError('es-abstract does not yet support internal slots'); } if ($ObjectCreate) { return $ObjectCreate(proto); } if (hasProto) { return { __proto__: proto }; } if (proto === null) { throw new $SyntaxError('native Object.create support is required to create null objects'); } var T = function T() {}; T.prototype = proto; return new T(); }; es-abstract-1.20.4/2016/ObjectDefineProperties.js000066400000000000000000000027441431761430200213420ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var Get = require('./Get'); var ToObject = require('./ToObject'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var forEach = require('../helpers/forEach'); var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $push = callBound('Array.prototype.push'); // https://262.ecma-international.org/6.0/#sec-objectdefineproperties module.exports = function ObjectDefineProperties(O, Properties) { var props = ToObject(Properties); // step 1 var keys = OwnPropertyKeys(props); // step 2 var descriptors = []; // step 3 forEach(keys, function (nextKey) { // step 4 var propDesc = ToPropertyDescriptor(getOwnPropertyDescriptor(props, nextKey)); // step 4.a if (typeof propDesc !== 'undefined' && propDesc['[[Enumerable]]']) { // step 4.b var descObj = Get(props, nextKey); // step 4.b.i var desc = ToPropertyDescriptor(descObj); // step 4.b.ii $push(descriptors, [nextKey, desc]); // step 4.b.iii } }); forEach(descriptors, function (pair) { // step 5 var P = pair[0]; // step 5.a var desc = pair[1]; // step 5.b desc = FromPropertyDescriptor(desc); // TODO: remove this once DefinePropertyOrThrow is fixed DefinePropertyOrThrow(O, P, desc); // step 5.c }); return O; // step 6 }; es-abstract-1.20.4/2016/OrdinaryCreateFromConstructor.js000066400000000000000000000014501431761430200227420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor'); var IsArray = require('./IsArray'); var ObjectCreate = require('./ObjectCreate'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarycreatefromconstructor module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto); var slots = arguments.length < 3 ? [] : arguments[2]; if (!IsArray(slots)) { throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List'); } return ObjectCreate(proto, slots); }; es-abstract-1.20.4/2016/OrdinaryDefineOwnProperty.js000066400000000000000000000045261431761430200220770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var Type = require('./Type'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!$gOPD) { // ES3/IE 8 fallback if (IsAccessorDescriptor(Desc)) { throw new $SyntaxError('This environment does not support accessor property descriptors.'); } var creatingNormalDataProperty = !(P in O) && Desc['[[Writable]]'] && Desc['[[Enumerable]]'] && Desc['[[Configurable]]'] && '[[Value]]' in Desc; var settingExistingDataProperty = (P in O) && (!('[[Configurable]]' in Desc) || Desc['[[Configurable]]']) && (!('[[Enumerable]]' in Desc) || Desc['[[Enumerable]]']) && (!('[[Writable]]' in Desc) || Desc['[[Writable]]']) && '[[Value]]' in Desc; if (creatingNormalDataProperty || settingExistingDataProperty) { O[P] = Desc['[[Value]]']; // eslint-disable-line no-param-reassign return SameValue(O[P], Desc['[[Value]]']); } throw new $SyntaxError('This environment does not support defining non-writable, non-enumerable, or non-configurable properties'); } var desc = $gOPD(O, P); var current = desc && ToPropertyDescriptor(desc); var extensible = IsExtensible(O); return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current); }; es-abstract-1.20.4/2016/OrdinaryGetOwnProperty.js000066400000000000000000000023511431761430200214160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var has = require('has'); var IsArray = require('./IsArray'); var IsPropertyKey = require('./IsPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty module.exports = function OrdinaryGetOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!has(O, P)) { return void 0; } if (!$gOPD) { // ES3 / IE 8 fallback var arrayLength = IsArray(O) && P === 'length'; var regexLastIndex = IsRegExp(O) && P === 'lastIndex'; return { '[[Configurable]]': !(arrayLength || regexLastIndex), '[[Enumerable]]': $isEnumerable(O, P), '[[Value]]': O[P], '[[Writable]]': true }; } return ToPropertyDescriptor($gOPD(O, P)); }; es-abstract-1.20.4/2016/OrdinaryGetPrototypeOf.js000066400000000000000000000010331431761430200213740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $getProto = require('../helpers/getProto'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarygetprototypeof module.exports = function OrdinaryGetPrototypeOf(O) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!$getProto) { throw new $TypeError('This environment does not support fetching prototypes.'); } return $getProto(O); }; es-abstract-1.20.4/2016/OrdinaryHasInstance.js000066400000000000000000000011631431761430200206460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance module.exports = function OrdinaryHasInstance(C, O) { if (IsCallable(C) === false) { return false; } if (Type(O) !== 'Object') { return false; } var P = Get(C, 'prototype'); if (Type(P) !== 'Object') { throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.'); } return O instanceof C; }; es-abstract-1.20.4/2016/OrdinaryHasProperty.js000066400000000000000000000010231431761430200207210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty module.exports = function OrdinaryHasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2016/OrdinarySetPrototypeOf.js000066400000000000000000000020321431761430200214100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $setProto = require('../helpers/setProto'); var OrdinaryGetPrototypeOf = require('./OrdinaryGetPrototypeOf'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarysetprototypeof module.exports = function OrdinarySetPrototypeOf(O, V) { if (Type(V) !== 'Object' && Type(V) !== 'Null') { throw new $TypeError('Assertion failed: V must be Object or Null'); } /* var extensible = IsExtensible(O); var current = OrdinaryGetPrototypeOf(O); if (SameValue(V, current)) { return true; } if (!extensible) { return false; } */ try { $setProto(O, V); } catch (e) { return false; } return OrdinaryGetPrototypeOf(O) === V; /* var p = V; var done = false; while (!done) { if (p === null) { done = true; } else if (SameValue(p, O)) { return false; } else { if (wat) { done = true; } else { p = p.[[Prototype]]; } } } O.[[Prototype]] = V; return true; */ }; es-abstract-1.20.4/2016/QuoteJSONString.js000066400000000000000000000026161431761430200177200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var $numberToString = callBound('Number.prototype.toString'); var $toLowerCase = callBound('String.prototype.toLowerCase'); var $strSlice = callBound('String.prototype.slice'); var $strSplit = callBound('String.prototype.split'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-quotejsonstring var escapes = { '\u0008': 'b', '\u000C': 'f', '\u000A': 'n', '\u000D': 'r', '\u0009': 't' }; module.exports = function QuoteJSONString(value) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `value` must be a String'); } var product = '"'; if (value) { forEach($strSplit(value), function (C) { if (C === '"' || C === '\\') { product += '\u005C' + C; } else if (C === '\u0008' || C === '\u000C' || C === '\u000A' || C === '\u000D' || C === '\u0009') { var abbrev = escapes[C]; product += '\u005C' + abbrev; } else { var cCharCode = $charCodeAt(C, 0); if (cCharCode < 0x20) { product += '\u005Cu' + $toLowerCase($strSlice('0000' + $numberToString(cCharCode, 16), -4)); } else { product += C; } } }); } product += '"'; return product; }; es-abstract-1.20.4/2016/RegExpCreate.js000066400000000000000000000012031431761430200172470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RegExp = GetIntrinsic('%RegExp%'); // var RegExpAlloc = require('./RegExpAlloc'); // var RegExpInitialize = require('./RegExpInitialize'); var ToString = require('./ToString'); // https://262.ecma-international.org/6.0/#sec-regexpcreate module.exports = function RegExpCreate(P, F) { // var obj = RegExpAlloc($RegExp); // return RegExpInitialize(obj, P, F); // covers spec mechanics; bypass regex brand checking var pattern = typeof P === 'undefined' ? '' : ToString(P); var flags = typeof F === 'undefined' ? '' : ToString(F); return new $RegExp(pattern, flags); }; es-abstract-1.20.4/2016/RegExpExec.js000066400000000000000000000015671431761430200167450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var regexExec = require('call-bind/callBound')('RegExp.prototype.exec'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-regexpexec module.exports = function RegExpExec(R, S) { if (Type(R) !== 'Object') { throw new $TypeError('Assertion failed: `R` must be an Object'); } if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var exec = Get(R, 'exec'); if (IsCallable(exec)) { var result = Call(exec, R, [S]); if (result === null || Type(result) === 'Object') { return result; } throw new $TypeError('"exec" method must return `null` or an Object'); } return regexExec(R, S); }; es-abstract-1.20.4/2016/RequireObjectCoercible.js000066400000000000000000000001061431761430200213050ustar00rootroot00000000000000'use strict'; module.exports = require('../5/CheckObjectCoercible'); es-abstract-1.20.4/2016/SameValue.js000066400000000000000000000004631431761430200166220ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // http://262.ecma-international.org/5.1/#sec-9.12 module.exports = function SameValue(x, y) { if (x === y) { // 0 === -0, but they are not identical. if (x === 0) { return 1 / x === 1 / y; } return true; } return $isNaN(x) && $isNaN(y); }; es-abstract-1.20.4/2016/SameValueNonNumber.js000066400000000000000000000007021431761430200204420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); // https://262.ecma-international.org/7.0/#sec-samevaluenonnumber module.exports = function SameValueNonNumber(x, y) { if (typeof x === 'number' || typeof x !== typeof y) { throw new $TypeError('SameValueNonNumber requires two non-number values of the same type.'); } return SameValue(x, y); }; es-abstract-1.20.4/2016/SameValueZero.js000066400000000000000000000003371431761430200174620ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero module.exports = function SameValueZero(x, y) { return (x === y) || ($isNaN(x) && $isNaN(y)); }; es-abstract-1.20.4/2016/SecFromTime.js000066400000000000000000000006221431761430200171120ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var SecondsPerMinute = timeConstants.SecondsPerMinute; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function SecFromTime(t) { return modulo(floor(t / msPerSecond), SecondsPerMinute); }; es-abstract-1.20.4/2016/Set.js000066400000000000000000000023471431761430200154760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // IE 9 does not throw in strict mode when writability/configurability/extensibility is violated var noThrowOnStrictViolation = (function () { try { delete [].length; return true; } catch (e) { return false; } }()); // https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw module.exports = function Set(O, P, V, Throw) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (Type(Throw) !== 'Boolean') { throw new $TypeError('Assertion failed: `Throw` must be a Boolean'); } if (Throw) { O[P] = V; // eslint-disable-line no-param-reassign if (noThrowOnStrictViolation && !SameValue(O[P], V)) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; } try { O[P] = V; // eslint-disable-line no-param-reassign return noThrowOnStrictViolation ? SameValue(O[P], V) : true; } catch (e) { return false; } }; es-abstract-1.20.4/2016/SetFunctionName.js000066400000000000000000000025451431761430200200050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname module.exports = function SetFunctionName(F, name) { if (typeof F !== 'function') { throw new $TypeError('Assertion failed: `F` must be a function'); } if (!IsExtensible(F) || has(F, 'name')) { throw new $TypeError('Assertion failed: `F` must be extensible, and must not have a `name` own property'); } var nameType = Type(name); if (nameType !== 'Symbol' && nameType !== 'String') { throw new $TypeError('Assertion failed: `name` must be a Symbol or a String'); } if (nameType === 'Symbol') { var description = getSymbolDescription(name); // eslint-disable-next-line no-param-reassign name = typeof description === 'undefined' ? '' : '[' + description + ']'; } if (arguments.length > 2) { var prefix = arguments[2]; // eslint-disable-next-line no-param-reassign name = prefix + ' ' + name; } return DefinePropertyOrThrow(F, 'name', { '[[Value]]': name, '[[Writable]]': false, '[[Enumerable]]': false, '[[Configurable]]': true }); }; es-abstract-1.20.4/2016/SetIntegrityLevel.js000066400000000000000000000035061431761430200203630ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var forEach = require('../helpers/forEach'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel module.exports = function SetIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } if (!$preventExtensions) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.preventExtensions` support'); } var status = $preventExtensions(O); if (!status) { return false; } if (!$gOPN) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support'); } var theKeys = $gOPN(O); if (level === 'sealed') { forEach(theKeys, function (k) { DefinePropertyOrThrow(O, k, { configurable: false }); }); } else if (level === 'frozen') { forEach(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { var desc; if (IsAccessorDescriptor(ToPropertyDescriptor(currentDesc))) { desc = { configurable: false }; } else { desc = { configurable: false, writable: false }; } DefinePropertyOrThrow(O, k, desc); } }); } return true; }; es-abstract-1.20.4/2016/SpeciesConstructor.js000066400000000000000000000015141431761430200205770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor module.exports = function SpeciesConstructor(O, defaultConstructor) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var C = O.constructor; if (typeof C === 'undefined') { return defaultConstructor; } if (Type(C) !== 'Object') { throw new $TypeError('O.constructor is not an Object'); } var S = $species ? C[$species] : void 0; if (S == null) { return defaultConstructor; } if (IsConstructor(S)) { return S; } throw new $TypeError('no constructor found'); }; es-abstract-1.20.4/2016/SplitMatch.js000066400000000000000000000015521431761430200170100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var $charAt = callBound('String.prototype.charAt'); // https://262.ecma-international.org/6.0/#sec-splitmatch module.exports = function SplitMatch(S, q, R) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(q)) { throw new $TypeError('Assertion failed: `q` must be an integer'); } if (Type(R) !== 'String') { throw new $TypeError('Assertion failed: `R` must be a String'); } var r = R.length; var s = S.length; if (q + r > s) { return false; } for (var i = 0; i < r; i += 1) { if ($charAt(S, q + i) !== $charAt(R, i)) { return false; } } return q + r; }; es-abstract-1.20.4/2016/StrictEqualityComparison.js000066400000000000000000000005511431761430200217570ustar00rootroot00000000000000'use strict'; var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.9.6 module.exports = function StrictEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType !== yType) { return false; } if (xType === 'Undefined' || xType === 'Null') { return true; } return x === y; // shortcut for steps 4-7 }; es-abstract-1.20.4/2016/StringCreate.js000066400000000000000000000021351431761430200173300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var $StringPrototype = GetIntrinsic('%String.prototype%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var Type = require('./Type'); var setProto = require('../helpers/setProto'); // https://262.ecma-international.org/6.0/#sec-stringcreate module.exports = function StringCreate(value, prototype) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var S = $Object(value); if (prototype !== $StringPrototype) { if (setProto) { setProto(S, prototype); } else { throw new $SyntaxError('StringCreate: a `proto` argument that is not `String.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } } var length = value.length; DefinePropertyOrThrow(S, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); return S; }; es-abstract-1.20.4/2016/SymbolDescriptiveString.js000066400000000000000000000010161431761430200215710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $SymbolToString = callBound('Symbol.prototype.toString', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring module.exports = function SymbolDescriptiveString(sym) { if (Type(sym) !== 'Symbol') { throw new $TypeError('Assertion failed: `sym` must be a Symbol'); } return $SymbolToString(sym); }; es-abstract-1.20.4/2016/TestIntegrityLevel.js000066400000000000000000000024051431761430200205440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var every = require('../helpers/every'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel module.exports = function TestIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } var status = IsExtensible(O); if (status) { return false; } var theKeys = OwnPropertyKeys(O); return theKeys.length === 0 || every(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { if (currentDesc.configurable) { return false; } if (level === 'frozen' && IsDataDescriptor(ToPropertyDescriptor(currentDesc)) && currentDesc.writable) { return false; } } return true; }); }; es-abstract-1.20.4/2016/TimeClip.js000066400000000000000000000007241431761430200164460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var $Number = GetIntrinsic('%Number%'); var $isFinite = require('../helpers/isFinite'); var abs = require('./abs'); var ToNumber = require('./ToNumber'); // https://262.ecma-international.org/5.1/#sec-15.9.1.14 module.exports = function TimeClip(time) { if (!$isFinite(time) || abs(time) > 8.64e15) { return NaN; } return $Number(new $Date(ToNumber(time))); }; es-abstract-1.20.4/2016/TimeFromYear.js000066400000000000000000000004051431761430200172770ustar00rootroot00000000000000'use strict'; var msPerDay = require('../helpers/timeConstants').msPerDay; var DayFromYear = require('./DayFromYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function TimeFromYear(y) { return msPerDay * DayFromYear(y); }; es-abstract-1.20.4/2016/TimeWithinDay.js000066400000000000000000000003671431761430200174620ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function TimeWithinDay(t) { return modulo(t, msPerDay); }; es-abstract-1.20.4/2016/ToBoolean.js000066400000000000000000000002021431761430200166110ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.2 module.exports = function ToBoolean(value) { return !!value; }; es-abstract-1.20.4/2016/ToDateString.js000066400000000000000000000007621431761430200173110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Date = GetIntrinsic('%Date%'); var $isNaN = require('../helpers/isNaN'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-todatestring module.exports = function ToDateString(tv) { if (Type(tv) !== 'Number') { throw new $TypeError('Assertion failed: `tv` must be a Number'); } if ($isNaN(tv)) { return 'Invalid Date'; } return $Date(tv); }; es-abstract-1.20.4/2016/ToInt16.js000066400000000000000000000004041431761430200161370ustar00rootroot00000000000000'use strict'; var ToUint16 = require('./ToUint16'); // https://ecma-international.org/ecma-262/6.0/#sec-toint16 module.exports = function ToInt16(argument) { var int16bit = ToUint16(argument); return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit; }; es-abstract-1.20.4/2016/ToInt32.js000066400000000000000000000002551431761430200161410ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.5 module.exports = function ToInt32(x) { return ToNumber(x) >> 0; }; es-abstract-1.20.4/2016/ToInt8.js000066400000000000000000000003671431761430200160700ustar00rootroot00000000000000'use strict'; var ToUint8 = require('./ToUint8'); // https://ecma-international.org/ecma-262/6.0/#sec-toint8 module.exports = function ToInt8(argument) { var int8bit = ToUint8(argument); return int8bit >= 0x80 ? int8bit - 0x100 : int8bit; }; es-abstract-1.20.4/2016/ToInteger.js000066400000000000000000000004211431761430200166320ustar00rootroot00000000000000'use strict'; var ES5ToInteger = require('../5/ToInteger'); var ToNumber = require('./ToNumber'); // https://ecma-international.org/ecma-262/6.0/#sec-tointeger module.exports = function ToInteger(value) { var number = ToNumber(value); return ES5ToInteger(number); }; es-abstract-1.20.4/2016/ToLength.js000066400000000000000000000005141431761430200164610ustar00rootroot00000000000000'use strict'; var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var ToInteger = require('./ToInteger'); module.exports = function ToLength(argument) { var len = ToInteger(argument); if (len <= 0) { return 0; } // includes converting -0 to +0 if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } return len; }; es-abstract-1.20.4/2016/ToNumber.js000066400000000000000000000037301431761430200164730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Number = GetIntrinsic('%Number%'); var $RegExp = GetIntrinsic('%RegExp%'); var $parseInteger = GetIntrinsic('%parseInt%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var isPrimitive = require('../helpers/isPrimitive'); var $strSlice = callBound('String.prototype.slice'); var isBinary = regexTester(/^0b[01]+$/i); var isOctal = regexTester(/^0o[0-7]+$/i); var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i); var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); var hasNonWS = regexTester(nonWSregex); // whitespace from: https://es5.github.io/#x15.5.4.20 // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324 var ws = [ '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003', '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028', '\u2029\uFEFF' ].join(''); var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); var $replace = callBound('String.prototype.replace'); var $trim = function (value) { return $replace(value, trimRegex, ''); }; var ToPrimitive = require('./ToPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-tonumber module.exports = function ToNumber(argument) { var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (typeof value === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a number'); } if (typeof value === 'string') { if (isBinary(value)) { return ToNumber($parseInteger($strSlice(value, 2), 2)); } else if (isOctal(value)) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; } var trimmed = $trim(value); if (trimmed !== value) { return ToNumber(trimmed); } } return $Number(value); }; es-abstract-1.20.4/2016/ToObject.js000066400000000000000000000005161431761430200164500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); // https://ecma-international.org/ecma-262/6.0/#sec-toobject module.exports = function ToObject(value) { RequireObjectCoercible(value); return $Object(value); }; es-abstract-1.20.4/2016/ToPrimitive.js000066400000000000000000000004371431761430200172140ustar00rootroot00000000000000'use strict'; var toPrimitive = require('es-to-primitive/es2015'); // https://ecma-international.org/ecma-262/6.0/#sec-toprimitive module.exports = function ToPrimitive(input) { if (arguments.length > 1) { return toPrimitive(input, arguments[1]); } return toPrimitive(input); }; es-abstract-1.20.4/2016/ToPropertyDescriptor.js000066400000000000000000000026541431761430200211320ustar00rootroot00000000000000'use strict'; var has = require('has'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var ToBoolean = require('./ToBoolean'); var IsCallable = require('./IsCallable'); // https://262.ecma-international.org/5.1/#sec-8.10.5 module.exports = function ToPropertyDescriptor(Obj) { if (Type(Obj) !== 'Object') { throw new $TypeError('ToPropertyDescriptor requires an object'); } var desc = {}; if (has(Obj, 'enumerable')) { desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable); } if (has(Obj, 'configurable')) { desc['[[Configurable]]'] = ToBoolean(Obj.configurable); } if (has(Obj, 'value')) { desc['[[Value]]'] = Obj.value; } if (has(Obj, 'writable')) { desc['[[Writable]]'] = ToBoolean(Obj.writable); } if (has(Obj, 'get')) { var getter = Obj.get; if (typeof getter !== 'undefined' && !IsCallable(getter)) { throw new $TypeError('getter must be a function'); } desc['[[Get]]'] = getter; } if (has(Obj, 'set')) { var setter = Obj.set; if (typeof setter !== 'undefined' && !IsCallable(setter)) { throw new $TypeError('setter must be a function'); } desc['[[Set]]'] = setter; } if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); } return desc; }; es-abstract-1.20.4/2016/ToPropertyKey.js000066400000000000000000000006251431761430200175400ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var ToPrimitive = require('./ToPrimitive'); var ToString = require('./ToString'); // https://ecma-international.org/ecma-262/6.0/#sec-topropertykey module.exports = function ToPropertyKey(argument) { var key = ToPrimitive(argument, $String); return typeof key === 'symbol' ? key : ToString(key); }; es-abstract-1.20.4/2016/ToString.js000066400000000000000000000006141431761430200165070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); // https://ecma-international.org/ecma-262/6.0/#sec-tostring module.exports = function ToString(argument) { if (typeof argument === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a string'); } return $String(argument); }; es-abstract-1.20.4/2016/ToUint16.js000066400000000000000000000010641431761430200163270ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // http://262.ecma-international.org/5.1/#sec-9.7 module.exports = function ToUint16(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x10000); }; es-abstract-1.20.4/2016/ToUint32.js000066400000000000000000000002571431761430200163300ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.6 module.exports = function ToUint32(x) { return ToNumber(x) >>> 0; }; es-abstract-1.20.4/2016/ToUint8.js000066400000000000000000000011021431761430200162410ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8 module.exports = function ToUint8(argument) { var number = ToNumber(argument); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x100); }; es-abstract-1.20.4/2016/ToUint8Clamp.js000066400000000000000000000010121431761430200172160ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp module.exports = function ToUint8Clamp(argument) { var number = ToNumber(argument); if ($isNaN(number) || number <= 0) { return 0; } if (number >= 0xFF) { return 0xFF; } var f = floor(argument); if (f + 0.5 < number) { return f + 1; } if (number < f + 0.5) { return f; } if (f % 2 !== 0) { return f + 1; } return f; }; es-abstract-1.20.4/2016/Type.js000066400000000000000000000003711431761430200156570ustar00rootroot00000000000000'use strict'; var ES5Type = require('../5/Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ecmascript-data-types-and-values module.exports = function Type(x) { if (typeof x === 'symbol') { return 'Symbol'; } return ES5Type(x); }; es-abstract-1.20.4/2016/UTF16Decode.js000066400000000000000000000014671431761430200166560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); // https://262.ecma-international.org/7.0/#sec-utf16decode var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); // https://262.ecma-international.org/11.0/#sec-utf16decodesurrogatepair module.exports = function UTF16Decode(lead, trail) { if (!isLeadingSurrogate(lead) || !isTrailingSurrogate(trail)) { throw new $TypeError('Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code'); } // var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; return $fromCharCode(lead) + $fromCharCode(trail); }; es-abstract-1.20.4/2016/UTF16Encoding.js000066400000000000000000000012741431761430200172150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var floor = require('./floor'); var modulo = require('./modulo'); var isCodePoint = require('../helpers/isCodePoint'); // https://262.ecma-international.org/7.0/#sec-utf16encoding module.exports = function UTF16Encoding(cp) { if (!isCodePoint(cp)) { throw new $TypeError('Assertion failed: `cp` must be >= 0 and <= 0x10FFFF'); } if (cp <= 65535) { return $fromCharCode(cp); } var cu1 = floor((cp - 65536) / 1024) + 0xD800; var cu2 = modulo(cp - 65536, 1024) + 0xDC00; return $fromCharCode(cu1) + $fromCharCode(cu2); }; es-abstract-1.20.4/2016/ValidateAndApplyPropertyDescriptor.js000066400000000000000000000121731431761430200237270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var isSamePropertyDescriptor = require('../helpers/isSamePropertyDescriptor'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-validateandapplypropertydescriptor // https://ecma-international.org/ecma-262/8.0/#sec-validateandapplypropertydescriptor // eslint-disable-next-line max-lines-per-function, max-statements, max-params module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) { // this uses the ES2017+ logic, since it fixes a number of bugs in the ES2015 logic. var oType = Type(O); if (oType !== 'Undefined' && oType !== 'Object') { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } if (Type(extensible) !== 'Boolean') { throw new $TypeError('Assertion failed: extensible must be a Boolean'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (Type(current) !== 'Undefined' && !isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } if (oType !== 'Undefined' && !IsPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (Type(current) === 'Undefined') { if (!extensible) { return false; } if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': Desc['[[Configurable]]'], '[[Enumerable]]': Desc['[[Enumerable]]'], '[[Value]]': Desc['[[Value]]'], '[[Writable]]': Desc['[[Writable]]'] } ); } } else { if (!IsAccessorDescriptor(Desc)) { throw new $TypeError('Assertion failed: Desc is not an accessor descriptor'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } } return true; } if (IsGenericDescriptor(Desc) && !('[[Configurable]]' in Desc) && !('[[Enumerable]]' in Desc)) { return true; } if (isSamePropertyDescriptor({ SameValue: SameValue }, Desc, current)) { return true; // removed by ES2017, but should still be correct } // "if every field in Desc is absent, return true" can't really match the assertion that it's a Property Descriptor if (!current['[[Configurable]]']) { if (Desc['[[Configurable]]']) { return false; } if ('[[Enumerable]]' in Desc && !Desc['[[Enumerable]]'] === !!current['[[Enumerable]]']) { return false; } } if (IsGenericDescriptor(Desc)) { // no further validation is required. } else if (IsDataDescriptor(current) !== IsDataDescriptor(Desc)) { if (!current['[[Configurable]]']) { return false; } if (IsDataDescriptor(current)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Get]]': undefined } ); } } else if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Value]]': undefined } ); } } else if (IsDataDescriptor(current) && IsDataDescriptor(Desc)) { if (!current['[[Configurable]]'] && !current['[[Writable]]']) { if ('[[Writable]]' in Desc && Desc['[[Writable]]']) { return false; } if ('[[Value]]' in Desc && !SameValue(Desc['[[Value]]'], current['[[Value]]'])) { return false; } return true; } } else if (IsAccessorDescriptor(current) && IsAccessorDescriptor(Desc)) { if (!current['[[Configurable]]']) { if ('[[Set]]' in Desc && !SameValue(Desc['[[Set]]'], current['[[Set]]'])) { return false; } if ('[[Get]]' in Desc && !SameValue(Desc['[[Get]]'], current['[[Get]]'])) { return false; } return true; } } else { throw new $TypeError('Assertion failed: current and Desc are not both data, both accessors, or one accessor and one data.'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } return true; }; es-abstract-1.20.4/2016/WeekDay.js000066400000000000000000000003201431761430200162610ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.6 module.exports = function WeekDay(t) { return modulo(Day(t) + 4, 7); }; es-abstract-1.20.4/2016/YearFromTime.js000066400000000000000000000006271431761430200173050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var callBound = require('call-bind/callBound'); var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function YearFromTime(t) { // largest y such that this.TimeFromYear(y) <= t return $getUTCFullYear(new $Date(t)); }; es-abstract-1.20.4/2016/abs.js000066400000000000000000000003171431761430200155030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $abs = GetIntrinsic('%Math.abs%'); // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function abs(x) { return $abs(x); }; es-abstract-1.20.4/2016/floor.js000066400000000000000000000003311431761430200160530ustar00rootroot00000000000000'use strict'; // var modulo = require('./modulo'); var $floor = Math.floor; // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function floor(x) { // return x - modulo(x, 1); return $floor(x); }; es-abstract-1.20.4/2016/modulo.js000066400000000000000000000002501431761430200162310ustar00rootroot00000000000000'use strict'; var mod = require('../helpers/mod'); // https://262.ecma-international.org/5.1/#sec-5.2 module.exports = function modulo(x, y) { return mod(x, y); }; es-abstract-1.20.4/2016/msFromTime.js000066400000000000000000000003751431761430200170240ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerSecond = require('../helpers/timeConstants').msPerSecond; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function msFromTime(t) { return modulo(t, msPerSecond); }; es-abstract-1.20.4/2016/thisBooleanValue.js000066400000000000000000000005571431761430200202100ustar00rootroot00000000000000'use strict'; var $BooleanValueOf = require('call-bind/callBound')('Boolean.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-boolean-prototype-object module.exports = function thisBooleanValue(value) { if (Type(value) === 'Boolean') { return value; } return $BooleanValueOf(value); }; es-abstract-1.20.4/2016/thisNumberValue.js000066400000000000000000000006061431761430200200540ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var Type = require('./Type'); var $NumberValueOf = callBound('Number.prototype.valueOf'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object module.exports = function thisNumberValue(value) { if (Type(value) === 'Number') { return value; } return $NumberValueOf(value); }; es-abstract-1.20.4/2016/thisStringValue.js000066400000000000000000000005511431761430200200710ustar00rootroot00000000000000'use strict'; var $StringValueOf = require('call-bind/callBound')('String.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object module.exports = function thisStringValue(value) { if (Type(value) === 'String') { return value; } return $StringValueOf(value); }; es-abstract-1.20.4/2016/thisTimeValue.js000066400000000000000000000004131431761430200175160ustar00rootroot00000000000000'use strict'; var $DateGetTime = require('call-bind/callBound')('Date.prototype.getTime'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-date-prototype-object module.exports = function thisTimeValue(value) { return $DateGetTime(value); }; es-abstract-1.20.4/2017/000077500000000000000000000000001431761430200144005ustar00rootroot00000000000000es-abstract-1.20.4/2017/AbstractEqualityComparison.js000066400000000000000000000022021431761430200222460ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison module.exports = function AbstractEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType === yType) { return x === y; // ES6+ specified this shortcut anyways. } if (x == null && y == null) { return true; } if (xType === 'Number' && yType === 'String') { return AbstractEqualityComparison(x, ToNumber(y)); } if (xType === 'String' && yType === 'Number') { return AbstractEqualityComparison(ToNumber(x), y); } if (xType === 'Boolean') { return AbstractEqualityComparison(ToNumber(x), y); } if (yType === 'Boolean') { return AbstractEqualityComparison(x, ToNumber(y)); } if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') { return AbstractEqualityComparison(x, ToPrimitive(y)); } if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) { return AbstractEqualityComparison(ToPrimitive(x), y); } return false; }; es-abstract-1.20.4/2017/AbstractRelationalComparison.js000066400000000000000000000030661431761430200225540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var isPrefixOf = require('../helpers/isPrefixOf'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.8.5 // eslint-disable-next-line max-statements module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); } var px; var py; if (LeftFirst) { px = ToPrimitive(x, $Number); py = ToPrimitive(y, $Number); } else { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } var bothStrings = Type(px) === 'String' && Type(py) === 'String'; if (!bothStrings) { var nx = ToNumber(px); var ny = ToNumber(py); if ($isNaN(nx) || $isNaN(ny)) { return undefined; } if ($isFinite(nx) && $isFinite(ny) && nx === ny) { return false; } if (nx === Infinity) { return false; } if (ny === Infinity) { return true; } if (ny === -Infinity) { return false; } if (nx === -Infinity) { return true; } return nx < ny; // by now, these are both nonzero, finite, and not equal } if (isPrefixOf(py, px)) { return false; } if (isPrefixOf(px, py)) { return true; } return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f }; es-abstract-1.20.4/2017/AdvanceStringIndex.js000066400000000000000000000024311431761430200204560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = require('call-bind/callBound')('String.prototype.charCodeAt'); // https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex module.exports = function AdvanceStringIndex(S, index, unicode) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53'); } if (Type(unicode) !== 'Boolean') { throw new $TypeError('Assertion failed: `unicode` must be a Boolean'); } if (!unicode) { return index + 1; } var length = S.length; if ((index + 1) >= length) { return index + 1; } var first = $charCodeAt(S, index); if (!isLeadingSurrogate(first)) { return index + 1; } var second = $charCodeAt(S, index + 1); if (!isTrailingSurrogate(second)) { return index + 1; } return index + 2; }; es-abstract-1.20.4/2017/ArrayCreate.js000066400000000000000000000031621431761430200171420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ArrayPrototype = GetIntrinsic('%Array.prototype%'); var $RangeError = GetIntrinsic('%RangeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || ( // eslint-disable-next-line no-proto, no-negated-condition [].__proto__ !== $ArrayPrototype ? null : function (O, proto) { O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign return O; } ); // https://ecma-international.org/ecma-262/6.0/#sec-arraycreate module.exports = function ArrayCreate(length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0'); } if (length > MAX_ARRAY_LENGTH) { throw new $RangeError('length is greater than (2**32 - 1)'); } var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype; var A = []; // steps 5 - 7, and 9 if (proto !== $ArrayPrototype) { // step 8 if (!$setProto) { throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } $setProto(A, proto); } if (length !== 0) { // bypasses the need for step 2 A.length = length; } /* step 10, the above as a shortcut for the below OrdinaryDefineOwnProperty(A, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': true }); */ return A; }; es-abstract-1.20.4/2017/ArraySetLength.js000066400000000000000000000051511431761430200176340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var assign = require('object.assign'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsArray = require('./IsArray'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function ArraySetLength(A, Desc) { if (!IsArray(A)) { throw new $TypeError('Assertion failed: A must be an Array'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!('[[Value]]' in Desc)) { return OrdinaryDefineOwnProperty(A, 'length', Desc); } var newLenDesc = assign({}, Desc); var newLen = ToUint32(Desc['[[Value]]']); var numberLen = ToNumber(Desc['[[Value]]']); if (newLen !== numberLen) { throw new $RangeError('Invalid array length'); } newLenDesc['[[Value]]'] = newLen; var oldLenDesc = OrdinaryGetOwnProperty(A, 'length'); if (!IsDataDescriptor(oldLenDesc)) { throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`'); } var oldLen = oldLenDesc['[[Value]]']; if (newLen >= oldLen) { return OrdinaryDefineOwnProperty(A, 'length', newLenDesc); } if (!oldLenDesc['[[Writable]]']) { return false; } var newWritable; if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) { newWritable = true; } else { newWritable = false; newLenDesc['[[Writable]]'] = true; } var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc); if (!succeeded) { return false; } while (newLen < oldLen) { oldLen -= 1; // eslint-disable-next-line no-param-reassign var deleteSucceeded = delete A[ToString(oldLen)]; if (!deleteSucceeded) { newLenDesc['[[Value]]'] = oldLen + 1; if (!newWritable) { newLenDesc['[[Writable]]'] = false; OrdinaryDefineOwnProperty(A, 'length', newLenDesc); return false; } } } if (!newWritable) { return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false }); } return true; }; es-abstract-1.20.4/2017/ArraySpeciesCreate.js000066400000000000000000000025041431761430200204550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Array = GetIntrinsic('%Array%'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsConstructor = require('./IsConstructor'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate module.exports = function ArraySpeciesCreate(originalArray, length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: length must be an integer >= 0'); } var len = length === 0 ? 0 : length; var C; var isArray = IsArray(originalArray); if (isArray) { C = Get(originalArray, 'constructor'); // TODO: figure out how to make a cross-realm normal Array, a same-realm Array // if (IsConstructor(C)) { // if C is another realm's Array, C = undefined // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ? // } if ($species && Type(C) === 'Object') { C = Get(C, $species); if (C === null) { C = void 0; } } } if (typeof C === 'undefined') { return $Array(len); } if (!IsConstructor(C)) { throw new $TypeError('C must be a constructor'); } return new C(len); // Construct(C, len); }; es-abstract-1.20.4/2017/Call.js000066400000000000000000000011571431761430200156150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsArray = require('./IsArray'); var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%'); // https://ecma-international.org/ecma-262/6.0/#sec-call module.exports = function Call(F, V) { var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } return $apply(F, V, argumentsList); }; es-abstract-1.20.4/2017/CanonicalNumericIndexString.js000066400000000000000000000012161431761430200223270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring module.exports = function CanonicalNumericIndexString(argument) { if (Type(argument) !== 'String') { throw new $TypeError('Assertion failed: `argument` must be a String'); } if (argument === '-0') { return -0; } var n = ToNumber(argument); if (SameValue(ToString(n), argument)) { return n; } return void 0; }; es-abstract-1.20.4/2017/CharacterRange.js000066400000000000000000000014161431761430200176110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = callBound('%String.prototype.charCodeAt%'); var $push = callBound('%Array.prototype.push%'); module.exports = function CharacterRange(A, B) { if (A.length !== 1 || B.length !== 1) { throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); } var a = A[0]; var b = B[0]; var i = $charCodeAt(a, 0); var j = $charCodeAt(b, 0); if (!(i <= j)) { throw new $TypeError('Assertion failed: i is not <= j'); } var arr = []; for (var k = i; k <= j; k += 1) { $push(arr, $fromCharCode(k)); } return arr; }; es-abstract-1.20.4/2017/CompletePropertyDescriptor.js000066400000000000000000000017351431761430200223200ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor module.exports = function CompletePropertyDescriptor(Desc) { /* eslint no-param-reassign: 0 */ assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (!has(Desc, '[[Value]]')) { Desc['[[Value]]'] = void 0; } if (!has(Desc, '[[Writable]]')) { Desc['[[Writable]]'] = false; } } else { if (!has(Desc, '[[Get]]')) { Desc['[[Get]]'] = void 0; } if (!has(Desc, '[[Set]]')) { Desc['[[Set]]'] = void 0; } } if (!has(Desc, '[[Enumerable]]')) { Desc['[[Enumerable]]'] = false; } if (!has(Desc, '[[Configurable]]')) { Desc['[[Configurable]]'] = false; } return Desc; }; es-abstract-1.20.4/2017/CreateDataProperty.js000066400000000000000000000023771431761430200205110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty module.exports = function CreateDataProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var oldDesc = OrdinaryGetOwnProperty(O, P); var extensible = !oldDesc || IsExtensible(O); var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]']; if (nonConfigurable || !extensible) { return false; } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Value]]': V, '[[Writable]]': true } ); }; es-abstract-1.20.4/2017/CreateDataPropertyOrThrow.js000066400000000000000000000013361431761430200220300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var CreateDataProperty = require('./CreateDataProperty'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var success = CreateDataProperty(O, P, V); if (!success) { throw new $TypeError('unable to create data property'); } return success; }; es-abstract-1.20.4/2017/CreateHTML.js000066400000000000000000000016371431761430200166350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $replace = callBound('String.prototype.replace'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createhtml module.exports = function CreateHTML(string, tag, attribute, value) { if (Type(tag) !== 'String' || Type(attribute) !== 'String') { throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings'); } var str = RequireObjectCoercible(string); var S = ToString(str); var p1 = '<' + tag; if (attribute !== '') { var V = ToString(value); var escapedV = $replace(V, /\x22/g, '"'); p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22'; } return p1 + '>' + S + ''; }; es-abstract-1.20.4/2017/CreateIterResultObject.js000066400000000000000000000006601431761430200213150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject module.exports = function CreateIterResultObject(value, done) { if (Type(done) !== 'Boolean') { throw new $TypeError('Assertion failed: Type(done) is not Boolean'); } return { value: value, done: done }; }; es-abstract-1.20.4/2017/CreateListFromArrayLike.js000066400000000000000000000025121431761430200214250ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $indexOf = callBound('Array.prototype.indexOf', true) || callBound('String.prototype.indexOf'); var $push = callBound('Array.prototype.push'); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createlistfromarraylike module.exports = function CreateListFromArrayLike(obj) { var elementTypes = arguments.length > 1 ? arguments[1] : ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object']; if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } if (!IsArray(elementTypes)) { throw new $TypeError('Assertion failed: `elementTypes`, if provided, must be an array'); } var len = ToLength(Get(obj, 'length')); var list = []; var index = 0; while (index < len) { var indexName = ToString(index); var next = Get(obj, indexName); var nextType = Type(next); if ($indexOf(elementTypes, nextType) < 0) { throw new $TypeError('item type ' + nextType + ' is not a valid elementType'); } $push(list, next); index += 1; } return list; }; es-abstract-1.20.4/2017/CreateMethodProperty.js000066400000000000000000000017231431761430200210520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty module.exports = function CreateMethodProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var newDesc = { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': V, '[[Writable]]': true }; return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, newDesc ); }; es-abstract-1.20.4/2017/DateFromTime.js000066400000000000000000000020141431761430200172530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); var MonthFromTime = require('./MonthFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.5 module.exports = function DateFromTime(t) { var m = MonthFromTime(t); var d = DayWithinYear(t); if (m === 0) { return d + 1; } if (m === 1) { return d - 30; } var leap = InLeapYear(t); if (m === 2) { return d - 58 - leap; } if (m === 3) { return d - 89 - leap; } if (m === 4) { return d - 119 - leap; } if (m === 5) { return d - 150 - leap; } if (m === 6) { return d - 180 - leap; } if (m === 7) { return d - 211 - leap; } if (m === 8) { return d - 242 - leap; } if (m === 9) { return d - 272 - leap; } if (m === 10) { return d - 303 - leap; } if (m === 11) { return d - 333 - leap; } throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m); }; es-abstract-1.20.4/2017/Day.js000066400000000000000000000003521431761430200154530ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function Day(t) { return floor(t / msPerDay); }; es-abstract-1.20.4/2017/DayFromYear.js000066400000000000000000000004001431761430200171120ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DayFromYear(y) { return (365 * (y - 1970)) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400); }; es-abstract-1.20.4/2017/DayWithinYear.js000066400000000000000000000004361431761430200174620ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var DayFromYear = require('./DayFromYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function DayWithinYear(t) { return Day(t) - DayFromYear(YearFromTime(t)); }; es-abstract-1.20.4/2017/DaysInYear.js000066400000000000000000000004551431761430200167520ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DaysInYear(y) { if (modulo(y, 4) !== 0) { return 365; } if (modulo(y, 100) !== 0) { return 366; } if (modulo(y, 400) !== 0) { return 365; } return 366; }; es-abstract-1.20.4/2017/DefinePropertyOrThrow.js000066400000000000000000000026721431761430200212310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow module.exports = function DefinePropertyOrThrow(O, P, desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var Desc = isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, desc) ? desc : ToPropertyDescriptor(desc); if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor'); } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); }; es-abstract-1.20.4/2017/DeletePropertyOrThrow.js000066400000000000000000000012731431761430200212350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow module.exports = function DeletePropertyOrThrow(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // eslint-disable-next-line no-param-reassign var success = delete O[P]; if (!success) { throw new $TypeError('Attempt to delete property failed.'); } return success; }; es-abstract-1.20.4/2017/EnumerableOwnProperties.js000066400000000000000000000021251431761430200215560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var objectKeys = require('object-keys'); var callBound = require('call-bind/callBound'); var callBind = require('call-bind'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%')); var forEach = require('../helpers/forEach'); var Type = require('./Type'); // https://262.ecma-international.org/8.0/#sec-enumerableownproperties module.exports = function EnumerableOwnProperties(O, kind) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var keys = objectKeys(O); if (kind === 'key') { return keys; } if (kind === 'value' || kind === 'key+value') { var results = []; forEach(keys, function (key) { if ($isEnumerable(O, key)) { $pushApply(results, [ kind === 'value' ? O[key] : [key, O[key]] ]); } }); return results; } throw new $TypeError('Assertion failed: "kind" is not "key", "value", or "key+value": ' + kind); }; es-abstract-1.20.4/2017/FromPropertyDescriptor.js000066400000000000000000000007021431761430200214440ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor module.exports = function FromPropertyDescriptor(Desc) { if (typeof Desc !== 'undefined') { assertRecord(Type, 'Property Descriptor', 'Desc', Desc); } return fromPropertyDescriptor(Desc); }; es-abstract-1.20.4/2017/Get.js000066400000000000000000000011321431761430200154520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var inspect = require('object-inspect'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-get-o-p module.exports = function Get(O, P) { // 7.3.1.1 if (Type(O) !== 'Object') { 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)); } // 7.3.1.3 return O[P]; }; es-abstract-1.20.4/2017/GetIterator.js000066400000000000000000000015301431761430200171660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var getIteratorMethod = require('../helpers/getIteratorMethod'); var AdvanceStringIndex = require('./AdvanceStringIndex'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsArray = require('./IsArray'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getiterator module.exports = function GetIterator(obj, method) { var actualMethod = method; if (arguments.length < 2) { actualMethod = getIteratorMethod( { AdvanceStringIndex: AdvanceStringIndex, GetMethod: GetMethod, IsArray: IsArray }, obj ); } var iterator = Call(actualMethod, obj); if (Type(iterator) !== 'Object') { throw new $TypeError('iterator must return an object'); } return iterator; }; es-abstract-1.20.4/2017/GetMethod.js000066400000000000000000000012271431761430200166200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-getmethod module.exports = function GetMethod(O, P) { // 7.3.9.1 if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // 7.3.9.2 var func = GetV(O, P); // 7.3.9.4 if (func == null) { return void 0; } // 7.3.9.5 if (!IsCallable(func)) { throw new $TypeError(P + 'is not a function'); } // 7.3.9.6 return func; }; es-abstract-1.20.4/2017/GetOwnPropertyKeys.js000066400000000000000000000014751431761430200205510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%', true); var keys = require('object-keys'); var esType = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys module.exports = function GetOwnPropertyKeys(O, Type) { if (esType(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (Type === 'Symbol') { return $gOPS ? $gOPS(O) : []; } if (Type === 'String') { if (!$gOPN) { return keys(O); } return $gOPN(O); } throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`'); }; es-abstract-1.20.4/2017/GetPrototypeFromConstructor.js000066400000000000000000000016311431761430200224760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Function = GetIntrinsic('%Function%'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic if (!IsConstructor(constructor)) { throw new $TypeError('Assertion failed: `constructor` must be a constructor'); } var proto = Get(constructor, 'prototype'); if (Type(proto) !== 'Object') { if (!(constructor instanceof $Function)) { // ignore other realms, for now throw new $TypeError('cross-realm constructors not currently supported'); } proto = intrinsic; } return proto; }; es-abstract-1.20.4/2017/GetSubstitution.js000066400000000000000000000066741431761430200201270ustar00rootroot00000000000000 'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $parseInt = GetIntrinsic('%parseInt%'); var inspect = require('object-inspect'); var regexTester = require('safe-regex-test'); var callBound = require('call-bind/callBound'); var every = require('../helpers/every'); var isDigit = regexTester(/^[0-9]$/); var $charAt = callBound('String.prototype.charAt'); var $strSlice = callBound('String.prototype.slice'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false var isStringOrHole = function (capture, index, arr) { return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined'); }; // https://ecma-international.org/ecma-262/6.0/#sec-getsubstitution // eslint-disable-next-line max-statements, max-params, max-lines-per-function module.exports = function GetSubstitution(matched, str, position, captures, replacement) { if (Type(matched) !== 'String') { throw new $TypeError('Assertion failed: `matched` must be a String'); } var matchLength = matched.length; if (Type(str) !== 'String') { throw new $TypeError('Assertion failed: `str` must be a String'); } var stringLength = str.length; if (!IsInteger(position) || position < 0 || position > stringLength) { throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position)); } if (!IsArray(captures) || !every(captures, isStringOrHole)) { throw new $TypeError('Assertion failed: `captures` must be a List of Strings, got ' + inspect(captures)); } if (Type(replacement) !== 'String') { throw new $TypeError('Assertion failed: `replacement` must be a String'); } var tailPos = position + matchLength; var m = captures.length; var result = ''; for (var i = 0; i < replacement.length; i += 1) { // if this is a $, and it's not the end of the replacement var current = $charAt(replacement, i); var isLast = (i + 1) >= replacement.length; var nextIsLast = (i + 2) >= replacement.length; if (current === '$' && !isLast) { var next = $charAt(replacement, i + 1); if (next === '$') { result += '$'; i += 1; } else if (next === '&') { result += matched; i += 1; } else if (next === '`') { result += position === 0 ? '' : $strSlice(str, 0, position - 1); i += 1; } else if (next === "'") { result += tailPos >= stringLength ? '' : $strSlice(str, tailPos); i += 1; } else { var nextNext = nextIsLast ? null : $charAt(replacement, i + 2); if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) { // $1 through $9, and not followed by a digit var n = $parseInt(next, 10); // if (n > m, impl-defined) result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1]; i += 1; } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) { // $00 through $99 var nn = next + nextNext; var nnI = $parseInt(nn, 10) - 1; // if nn === '00' or nn > m, impl-defined result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI]; i += 2; } else { result += '$'; } } } else { // the final $, or else not a $ result += $charAt(replacement, i); } } return result; }; es-abstract-1.20.4/2017/GetV.js000066400000000000000000000007321431761430200156050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var ToObject = require('./ToObject'); // https://ecma-international.org/ecma-262/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'); } // 7.3.2.2-3 var O = ToObject(V); // 7.3.2.4 return O[P]; }; es-abstract-1.20.4/2017/HasOwnProperty.js000066400000000000000000000010511431761430200176770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var has = require('has'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty module.exports = function HasOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return has(O, P); }; es-abstract-1.20.4/2017/HasProperty.js000066400000000000000000000010051431761430200172120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty module.exports = function HasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2017/HourFromTime.js000066400000000000000000000005761431761430200173260ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerHour = timeConstants.msPerHour; var HoursPerDay = timeConstants.HoursPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function HourFromTime(t) { return modulo(floor(t / msPerHour), HoursPerDay); }; es-abstract-1.20.4/2017/InLeapYear.js000066400000000000000000000007761431761430200167410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DaysInYear = require('./DaysInYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function InLeapYear(t) { var days = DaysInYear(YearFromTime(t)); if (days === 365) { return 0; } if (days === 366) { return 1; } throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days); }; es-abstract-1.20.4/2017/InstanceofOperator.js000066400000000000000000000016261431761430200205500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $hasInstance = GetIntrinsic('Symbol.hasInstance', true); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var OrdinaryHasInstance = require('./OrdinaryHasInstance'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator module.exports = function InstanceofOperator(O, C) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var instOfHandler = $hasInstance ? GetMethod(C, $hasInstance) : void 0; if (typeof instOfHandler !== 'undefined') { return ToBoolean(Call(instOfHandler, C, [O])); } if (!IsCallable(C)) { throw new $TypeError('`C` is not Callable'); } return OrdinaryHasInstance(C, O); }; es-abstract-1.20.4/2017/Invoke.js000066400000000000000000000013131431761430200161670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-invoke module.exports = function Invoke(O, P) { if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } var func = GetV(O, P); return Call(func, O, argumentsList); }; es-abstract-1.20.4/2017/IsAccessorDescriptor.js000066400000000000000000000007211431761430200210330ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor module.exports = function IsAccessorDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { return false; } return true; }; es-abstract-1.20.4/2017/IsArray.js000066400000000000000000000001731431761430200163110ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-isarray module.exports = require('../helpers/IsArray'); es-abstract-1.20.4/2017/IsCallable.js000066400000000000000000000001541431761430200167310ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.11 module.exports = require('is-callable'); es-abstract-1.20.4/2017/IsCompatiblePropertyDescriptor.js000066400000000000000000000005571431761430200231240ustar00rootroot00000000000000'use strict'; var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); }; es-abstract-1.20.4/2017/IsConcatSpreadable.js000066400000000000000000000011621431761430200204240ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable module.exports = function IsConcatSpreadable(O) { if (Type(O) !== 'Object') { return false; } if ($isConcatSpreadable) { var spreadable = Get(O, $isConcatSpreadable); if (typeof spreadable !== 'undefined') { return ToBoolean(spreadable); } } return IsArray(O); }; es-abstract-1.20.4/2017/IsConstructor.js000066400000000000000000000021751431761430200175640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('../GetIntrinsic.js'); var $construct = GetIntrinsic('%Reflect.construct%', true); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); try { DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} }); } catch (e) { // Accessor properties aren't supported DefinePropertyOrThrow = null; } // https://ecma-international.org/ecma-262/6.0/#sec-isconstructor if (DefinePropertyOrThrow && $construct) { var isConstructorMarker = {}; var badArrayLike = {}; DefinePropertyOrThrow(badArrayLike, 'length', { '[[Get]]': function () { throw isConstructorMarker; }, '[[Enumerable]]': true }); module.exports = function IsConstructor(argument) { try { // `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`: $construct(argument, badArrayLike); } catch (err) { return err === isConstructorMarker; } }; } else { module.exports = function IsConstructor(argument) { // unfortunately there's no way to truly check this without try/catch `new argument` in old environments return typeof argument === 'function' && !!argument.prototype; }; } es-abstract-1.20.4/2017/IsDataDescriptor.js000066400000000000000000000007201431761430200201410ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor module.exports = function IsDataDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { return false; } return true; }; es-abstract-1.20.4/2017/IsExtensible.js000066400000000000000000000007751431761430200173450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $isExtensible = GetIntrinsic('%Object.isExtensible%', true); var isPrimitive = require('../helpers/isPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o module.exports = $preventExtensions ? function IsExtensible(obj) { return !isPrimitive(obj) && $isExtensible(obj); } : function IsExtensible(obj) { return !isPrimitive(obj); }; es-abstract-1.20.4/2017/IsGenericDescriptor.js000066400000000000000000000010601431761430200206420ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor module.exports = function IsGenericDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) { return true; } return false; }; es-abstract-1.20.4/2017/IsInteger.js000066400000000000000000000007021431761430200166260ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); // https://ecma-international.org/ecma-262/6.0/#sec-isinteger module.exports = function IsInteger(argument) { if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) { return false; } var absValue = abs(argument); return floor(absValue) === absValue; }; es-abstract-1.20.4/2017/IsPromise.js000066400000000000000000000007451431761430200166560ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $PromiseThen = callBound('Promise.prototype.then', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ispromise module.exports = function IsPromise(x) { if (Type(x) !== 'Object') { return false; } if (!$PromiseThen) { // Promises are not supported return false; } try { $PromiseThen(x); // throws if not a promise } catch (e) { return false; } return true; }; es-abstract-1.20.4/2017/IsPropertyDescriptor.js000066400000000000000000000010521431761430200211130ustar00rootroot00000000000000'use strict'; // TODO, semver-major: delete this var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var Type = require('./Type'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); // https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type module.exports = function IsPropertyDescriptor(Desc) { return isPropertyDescriptor({ IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor, Type: Type }, Desc); }; es-abstract-1.20.4/2017/IsPropertyKey.js000066400000000000000000000003171431761430200175300ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { return typeof argument === 'string' || typeof argument === 'symbol'; }; es-abstract-1.20.4/2017/IsRegExp.js000066400000000000000000000010411431761430200164200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $match = GetIntrinsic('%Symbol.match%', true); var hasRegExpMatcher = require('is-regex'); var ToBoolean = require('./ToBoolean'); // https://ecma-international.org/ecma-262/6.0/#sec-isregexp module.exports = function IsRegExp(argument) { if (!argument || typeof argument !== 'object') { return false; } if ($match) { var isRegExp = argument[$match]; if (typeof isRegExp !== 'undefined') { return ToBoolean(isRegExp); } } return hasRegExpMatcher(argument); }; es-abstract-1.20.4/2017/IsSharedArrayBuffer.js000066400000000000000000000007151431761430200205740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var isSharedArrayBuffer = require('is-shared-array-buffer'); // https://262.ecma-international.org/8.0/#sec-issharedarraybuffer module.exports = function IsSharedArrayBuffer(obj) { if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } return isSharedArrayBuffer(obj); }; es-abstract-1.20.4/2017/IterableToList.js000066400000000000000000000011531431761430200176240ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $arrayPush = callBound('Array.prototype.push'); var GetIterator = require('./GetIterator'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); // https://262.ecma-international.org/8.0/#sec-iterabletolist module.exports = function IterableToList(items, method) { var iterator = GetIterator(items, method); var values = []; var next = true; while (next) { next = IteratorStep(iterator); if (next) { var nextValue = IteratorValue(next); $arrayPush(values, nextValue); } } return values; }; es-abstract-1.20.4/2017/IteratorClose.js000066400000000000000000000027111431761430200175160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose module.exports = function IteratorClose(iterator, completion) { if (Type(iterator) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterator) is not Object'); } if (!IsCallable(completion)) { throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record'); } var completionThunk = completion; var iteratorReturn = GetMethod(iterator, 'return'); if (typeof iteratorReturn === 'undefined') { return completionThunk(); } var completionRecord; try { var innerResult = Call(iteratorReturn, iterator, []); } catch (e) { // if we hit here, then "e" is the innerResult completion that needs re-throwing // if the completion is of type "throw", this will throw. completionThunk(); completionThunk = null; // ensure it's not called twice. // if not, then return the innerResult completion throw e; } completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does completionThunk = null; // ensure it's not called twice. if (Type(innerResult) !== 'Object') { throw new $TypeError('iterator .return must return an object'); } return completionRecord; }; es-abstract-1.20.4/2017/IteratorComplete.js000066400000000000000000000007621431761430200202250ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete module.exports = function IteratorComplete(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return ToBoolean(Get(iterResult, 'done')); }; es-abstract-1.20.4/2017/IteratorNext.js000066400000000000000000000007551431761430200173750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Invoke = require('./Invoke'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext module.exports = function IteratorNext(iterator, value) { var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]); if (Type(result) !== 'Object') { throw new $TypeError('iterator next must return an object'); } return result; }; es-abstract-1.20.4/2017/IteratorStep.js000066400000000000000000000005411431761430200173630ustar00rootroot00000000000000'use strict'; var IteratorComplete = require('./IteratorComplete'); var IteratorNext = require('./IteratorNext'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep module.exports = function IteratorStep(iterator) { var result = IteratorNext(iterator); var done = IteratorComplete(result); return done === true ? false : result; }; es-abstract-1.20.4/2017/IteratorValue.js000066400000000000000000000006731431761430200175320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue module.exports = function IteratorValue(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return Get(iterResult, 'value'); }; es-abstract-1.20.4/2017/MakeDate.js000066400000000000000000000005101431761430200164050ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.13 module.exports = function MakeDate(day, time) { if (!$isFinite(day) || !$isFinite(time)) { return NaN; } return (day * msPerDay) + time; }; es-abstract-1.20.4/2017/MakeDay.js000066400000000000000000000016251431761430200162550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $DateUTC = GetIntrinsic('%Date.UTC%'); var $isFinite = require('../helpers/isFinite'); var DateFromTime = require('./DateFromTime'); var Day = require('./Day'); var floor = require('./floor'); var modulo = require('./modulo'); var MonthFromTime = require('./MonthFromTime'); var ToInteger = require('./ToInteger'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.12 module.exports = function MakeDay(year, month, date) { if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { return NaN; } var y = ToInteger(year); var m = ToInteger(month); var dt = ToInteger(date); var ym = y + floor(m / 12); var mn = modulo(m, 12); var t = $DateUTC(ym, mn, 1); if (YearFromTime(t) !== ym || MonthFromTime(t) !== mn || DateFromTime(t) !== 1) { return NaN; } return Day(t) + dt - 1; }; es-abstract-1.20.4/2017/MakeTime.js000066400000000000000000000012721431761430200164340ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var msPerMinute = timeConstants.msPerMinute; var msPerHour = timeConstants.msPerHour; var ToInteger = require('./ToInteger'); // https://262.ecma-international.org/5.1/#sec-15.9.1.11 module.exports = function MakeTime(hour, min, sec, ms) { if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { return NaN; } var h = ToInteger(hour); var m = ToInteger(min); var s = ToInteger(sec); var milli = ToInteger(ms); var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; return t; }; es-abstract-1.20.4/2017/MinFromTime.js000066400000000000000000000006141431761430200171250ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerMinute = timeConstants.msPerMinute; var MinutesPerHour = timeConstants.MinutesPerHour; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function MinFromTime(t) { return modulo(floor(t / msPerMinute), MinutesPerHour); }; es-abstract-1.20.4/2017/MonthFromTime.js000066400000000000000000000017661431761430200175000ustar00rootroot00000000000000'use strict'; var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function MonthFromTime(t) { var day = DayWithinYear(t); if (0 <= day && day < 31) { return 0; } var leap = InLeapYear(t); if (31 <= day && day < (59 + leap)) { return 1; } if ((59 + leap) <= day && day < (90 + leap)) { return 2; } if ((90 + leap) <= day && day < (120 + leap)) { return 3; } if ((120 + leap) <= day && day < (151 + leap)) { return 4; } if ((151 + leap) <= day && day < (181 + leap)) { return 5; } if ((181 + leap) <= day && day < (212 + leap)) { return 6; } if ((212 + leap) <= day && day < (243 + leap)) { return 7; } if ((243 + leap) <= day && day < (273 + leap)) { return 8; } if ((273 + leap) <= day && day < (304 + leap)) { return 9; } if ((304 + leap) <= day && day < (334 + leap)) { return 10; } if ((334 + leap) <= day && day < (365 + leap)) { return 11; } }; es-abstract-1.20.4/2017/ObjectCreate.js000066400000000000000000000020111431761430200172620ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ObjectCreate = GetIntrinsic('%Object.create%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var Type = require('./Type'); var hasProto = !({ __proto__: null } instanceof Object); // https://ecma-international.org/ecma-262/6.0/#sec-objectcreate module.exports = function ObjectCreate(proto, internalSlotsList) { if (proto !== null && Type(proto) !== 'Object') { throw new $TypeError('Assertion failed: `proto` must be null or an object'); } var slots = arguments.length < 2 ? [] : internalSlotsList; if (slots.length > 0) { throw new $SyntaxError('es-abstract does not yet support internal slots'); } if ($ObjectCreate) { return $ObjectCreate(proto); } if (hasProto) { return { __proto__: proto }; } if (proto === null) { throw new $SyntaxError('native Object.create support is required to create null objects'); } var T = function T() {}; T.prototype = proto; return new T(); }; es-abstract-1.20.4/2017/ObjectDefineProperties.js000066400000000000000000000027441431761430200213430ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var Get = require('./Get'); var ToObject = require('./ToObject'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var forEach = require('../helpers/forEach'); var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $push = callBound('Array.prototype.push'); // https://262.ecma-international.org/6.0/#sec-objectdefineproperties module.exports = function ObjectDefineProperties(O, Properties) { var props = ToObject(Properties); // step 1 var keys = OwnPropertyKeys(props); // step 2 var descriptors = []; // step 3 forEach(keys, function (nextKey) { // step 4 var propDesc = ToPropertyDescriptor(getOwnPropertyDescriptor(props, nextKey)); // step 4.a if (typeof propDesc !== 'undefined' && propDesc['[[Enumerable]]']) { // step 4.b var descObj = Get(props, nextKey); // step 4.b.i var desc = ToPropertyDescriptor(descObj); // step 4.b.ii $push(descriptors, [nextKey, desc]); // step 4.b.iii } }); forEach(descriptors, function (pair) { // step 5 var P = pair[0]; // step 5.a var desc = pair[1]; // step 5.b desc = FromPropertyDescriptor(desc); // TODO: remove this once DefinePropertyOrThrow is fixed DefinePropertyOrThrow(O, P, desc); // step 5.c }); return O; // step 6 }; es-abstract-1.20.4/2017/OrdinaryCreateFromConstructor.js000066400000000000000000000014501431761430200227430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor'); var IsArray = require('./IsArray'); var ObjectCreate = require('./ObjectCreate'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarycreatefromconstructor module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto); var slots = arguments.length < 3 ? [] : arguments[2]; if (!IsArray(slots)) { throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List'); } return ObjectCreate(proto, slots); }; es-abstract-1.20.4/2017/OrdinaryDefineOwnProperty.js000066400000000000000000000045261431761430200221000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var Type = require('./Type'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!$gOPD) { // ES3/IE 8 fallback if (IsAccessorDescriptor(Desc)) { throw new $SyntaxError('This environment does not support accessor property descriptors.'); } var creatingNormalDataProperty = !(P in O) && Desc['[[Writable]]'] && Desc['[[Enumerable]]'] && Desc['[[Configurable]]'] && '[[Value]]' in Desc; var settingExistingDataProperty = (P in O) && (!('[[Configurable]]' in Desc) || Desc['[[Configurable]]']) && (!('[[Enumerable]]' in Desc) || Desc['[[Enumerable]]']) && (!('[[Writable]]' in Desc) || Desc['[[Writable]]']) && '[[Value]]' in Desc; if (creatingNormalDataProperty || settingExistingDataProperty) { O[P] = Desc['[[Value]]']; // eslint-disable-line no-param-reassign return SameValue(O[P], Desc['[[Value]]']); } throw new $SyntaxError('This environment does not support defining non-writable, non-enumerable, or non-configurable properties'); } var desc = $gOPD(O, P); var current = desc && ToPropertyDescriptor(desc); var extensible = IsExtensible(O); return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current); }; es-abstract-1.20.4/2017/OrdinaryGetOwnProperty.js000066400000000000000000000023511431761430200214170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var has = require('has'); var IsArray = require('./IsArray'); var IsPropertyKey = require('./IsPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty module.exports = function OrdinaryGetOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!has(O, P)) { return void 0; } if (!$gOPD) { // ES3 / IE 8 fallback var arrayLength = IsArray(O) && P === 'length'; var regexLastIndex = IsRegExp(O) && P === 'lastIndex'; return { '[[Configurable]]': !(arrayLength || regexLastIndex), '[[Enumerable]]': $isEnumerable(O, P), '[[Value]]': O[P], '[[Writable]]': true }; } return ToPropertyDescriptor($gOPD(O, P)); }; es-abstract-1.20.4/2017/OrdinaryGetPrototypeOf.js000066400000000000000000000010331431761430200213750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $getProto = require('../helpers/getProto'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarygetprototypeof module.exports = function OrdinaryGetPrototypeOf(O) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!$getProto) { throw new $TypeError('This environment does not support fetching prototypes.'); } return $getProto(O); }; es-abstract-1.20.4/2017/OrdinaryHasInstance.js000066400000000000000000000011631431761430200206470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance module.exports = function OrdinaryHasInstance(C, O) { if (IsCallable(C) === false) { return false; } if (Type(O) !== 'Object') { return false; } var P = Get(C, 'prototype'); if (Type(P) !== 'Object') { throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.'); } return O instanceof C; }; es-abstract-1.20.4/2017/OrdinaryHasProperty.js000066400000000000000000000010231431761430200207220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty module.exports = function OrdinaryHasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2017/OrdinarySetPrototypeOf.js000066400000000000000000000020321431761430200214110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $setProto = require('../helpers/setProto'); var OrdinaryGetPrototypeOf = require('./OrdinaryGetPrototypeOf'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarysetprototypeof module.exports = function OrdinarySetPrototypeOf(O, V) { if (Type(V) !== 'Object' && Type(V) !== 'Null') { throw new $TypeError('Assertion failed: V must be Object or Null'); } /* var extensible = IsExtensible(O); var current = OrdinaryGetPrototypeOf(O); if (SameValue(V, current)) { return true; } if (!extensible) { return false; } */ try { $setProto(O, V); } catch (e) { return false; } return OrdinaryGetPrototypeOf(O) === V; /* var p = V; var done = false; while (!done) { if (p === null) { done = true; } else if (SameValue(p, O)) { return false; } else { if (wat) { done = true; } else { p = p.[[Prototype]]; } } } O.[[Prototype]] = V; return true; */ }; es-abstract-1.20.4/2017/OrdinaryToPrimitive.js000066400000000000000000000020511431761430200207170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); var inspect = require('object-inspect'); // https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive module.exports = function OrdinaryToPrimitive(O, hint) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); } var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; for (var i = 0; i < methodNames.length; i += 1) { var name = methodNames[i]; var method = Get(O, name); if (IsCallable(method)) { var result = Call(method, O); if (Type(result) !== 'Object') { return result; } } } throw new $TypeError('No primitive value for ' + inspect(O)); }; es-abstract-1.20.4/2017/QuoteJSONString.js000066400000000000000000000026161431761430200177210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var $numberToString = callBound('Number.prototype.toString'); var $toLowerCase = callBound('String.prototype.toLowerCase'); var $strSlice = callBound('String.prototype.slice'); var $strSplit = callBound('String.prototype.split'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-quotejsonstring var escapes = { '\u0008': 'b', '\u000C': 'f', '\u000A': 'n', '\u000D': 'r', '\u0009': 't' }; module.exports = function QuoteJSONString(value) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `value` must be a String'); } var product = '"'; if (value) { forEach($strSplit(value), function (C) { if (C === '"' || C === '\\') { product += '\u005C' + C; } else if (C === '\u0008' || C === '\u000C' || C === '\u000A' || C === '\u000D' || C === '\u0009') { var abbrev = escapes[C]; product += '\u005C' + abbrev; } else { var cCharCode = $charCodeAt(C, 0); if (cCharCode < 0x20) { product += '\u005Cu' + $toLowerCase($strSlice('0000' + $numberToString(cCharCode, 16), -4)); } else { product += C; } } }); } product += '"'; return product; }; es-abstract-1.20.4/2017/RegExpCreate.js000066400000000000000000000012031431761430200172500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RegExp = GetIntrinsic('%RegExp%'); // var RegExpAlloc = require('./RegExpAlloc'); // var RegExpInitialize = require('./RegExpInitialize'); var ToString = require('./ToString'); // https://262.ecma-international.org/6.0/#sec-regexpcreate module.exports = function RegExpCreate(P, F) { // var obj = RegExpAlloc($RegExp); // return RegExpInitialize(obj, P, F); // covers spec mechanics; bypass regex brand checking var pattern = typeof P === 'undefined' ? '' : ToString(P); var flags = typeof F === 'undefined' ? '' : ToString(F); return new $RegExp(pattern, flags); }; es-abstract-1.20.4/2017/RegExpExec.js000066400000000000000000000015671431761430200167460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var regexExec = require('call-bind/callBound')('RegExp.prototype.exec'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-regexpexec module.exports = function RegExpExec(R, S) { if (Type(R) !== 'Object') { throw new $TypeError('Assertion failed: `R` must be an Object'); } if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var exec = Get(R, 'exec'); if (IsCallable(exec)) { var result = Call(exec, R, [S]); if (result === null || Type(result) === 'Object') { return result; } throw new $TypeError('"exec" method must return `null` or an Object'); } return regexExec(R, S); }; es-abstract-1.20.4/2017/RequireObjectCoercible.js000066400000000000000000000001061431761430200213060ustar00rootroot00000000000000'use strict'; module.exports = require('../5/CheckObjectCoercible'); es-abstract-1.20.4/2017/SameValue.js000066400000000000000000000004631431761430200166230ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // http://262.ecma-international.org/5.1/#sec-9.12 module.exports = function SameValue(x, y) { if (x === y) { // 0 === -0, but they are not identical. if (x === 0) { return 1 / x === 1 / y; } return true; } return $isNaN(x) && $isNaN(y); }; es-abstract-1.20.4/2017/SameValueNonNumber.js000066400000000000000000000007021431761430200204430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); // https://262.ecma-international.org/7.0/#sec-samevaluenonnumber module.exports = function SameValueNonNumber(x, y) { if (typeof x === 'number' || typeof x !== typeof y) { throw new $TypeError('SameValueNonNumber requires two non-number values of the same type.'); } return SameValue(x, y); }; es-abstract-1.20.4/2017/SameValueZero.js000066400000000000000000000003371431761430200174630ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero module.exports = function SameValueZero(x, y) { return (x === y) || ($isNaN(x) && $isNaN(y)); }; es-abstract-1.20.4/2017/SecFromTime.js000066400000000000000000000006221431761430200171130ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var SecondsPerMinute = timeConstants.SecondsPerMinute; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function SecFromTime(t) { return modulo(floor(t / msPerSecond), SecondsPerMinute); }; es-abstract-1.20.4/2017/Set.js000066400000000000000000000023471431761430200154770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // IE 9 does not throw in strict mode when writability/configurability/extensibility is violated var noThrowOnStrictViolation = (function () { try { delete [].length; return true; } catch (e) { return false; } }()); // https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw module.exports = function Set(O, P, V, Throw) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (Type(Throw) !== 'Boolean') { throw new $TypeError('Assertion failed: `Throw` must be a Boolean'); } if (Throw) { O[P] = V; // eslint-disable-line no-param-reassign if (noThrowOnStrictViolation && !SameValue(O[P], V)) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; } try { O[P] = V; // eslint-disable-line no-param-reassign return noThrowOnStrictViolation ? SameValue(O[P], V) : true; } catch (e) { return false; } }; es-abstract-1.20.4/2017/SetFunctionName.js000066400000000000000000000025451431761430200200060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname module.exports = function SetFunctionName(F, name) { if (typeof F !== 'function') { throw new $TypeError('Assertion failed: `F` must be a function'); } if (!IsExtensible(F) || has(F, 'name')) { throw new $TypeError('Assertion failed: `F` must be extensible, and must not have a `name` own property'); } var nameType = Type(name); if (nameType !== 'Symbol' && nameType !== 'String') { throw new $TypeError('Assertion failed: `name` must be a Symbol or a String'); } if (nameType === 'Symbol') { var description = getSymbolDescription(name); // eslint-disable-next-line no-param-reassign name = typeof description === 'undefined' ? '' : '[' + description + ']'; } if (arguments.length > 2) { var prefix = arguments[2]; // eslint-disable-next-line no-param-reassign name = prefix + ' ' + name; } return DefinePropertyOrThrow(F, 'name', { '[[Value]]': name, '[[Writable]]': false, '[[Enumerable]]': false, '[[Configurable]]': true }); }; es-abstract-1.20.4/2017/SetIntegrityLevel.js000066400000000000000000000035061431761430200203640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var forEach = require('../helpers/forEach'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel module.exports = function SetIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } if (!$preventExtensions) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.preventExtensions` support'); } var status = $preventExtensions(O); if (!status) { return false; } if (!$gOPN) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support'); } var theKeys = $gOPN(O); if (level === 'sealed') { forEach(theKeys, function (k) { DefinePropertyOrThrow(O, k, { configurable: false }); }); } else if (level === 'frozen') { forEach(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { var desc; if (IsAccessorDescriptor(ToPropertyDescriptor(currentDesc))) { desc = { configurable: false }; } else { desc = { configurable: false, writable: false }; } DefinePropertyOrThrow(O, k, desc); } }); } return true; }; es-abstract-1.20.4/2017/SpeciesConstructor.js000066400000000000000000000015141431761430200206000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor module.exports = function SpeciesConstructor(O, defaultConstructor) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var C = O.constructor; if (typeof C === 'undefined') { return defaultConstructor; } if (Type(C) !== 'Object') { throw new $TypeError('O.constructor is not an Object'); } var S = $species ? C[$species] : void 0; if (S == null) { return defaultConstructor; } if (IsConstructor(S)) { return S; } throw new $TypeError('no constructor found'); }; es-abstract-1.20.4/2017/SplitMatch.js000066400000000000000000000015521431761430200170110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var $charAt = callBound('String.prototype.charAt'); // https://262.ecma-international.org/6.0/#sec-splitmatch module.exports = function SplitMatch(S, q, R) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(q)) { throw new $TypeError('Assertion failed: `q` must be an integer'); } if (Type(R) !== 'String') { throw new $TypeError('Assertion failed: `R` must be a String'); } var r = R.length; var s = S.length; if (q + r > s) { return false; } for (var i = 0; i < r; i += 1) { if ($charAt(S, q + i) !== $charAt(R, i)) { return false; } } return q + r; }; es-abstract-1.20.4/2017/StrictEqualityComparison.js000066400000000000000000000005511431761430200217600ustar00rootroot00000000000000'use strict'; var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.9.6 module.exports = function StrictEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType !== yType) { return false; } if (xType === 'Undefined' || xType === 'Null') { return true; } return x === y; // shortcut for steps 4-7 }; es-abstract-1.20.4/2017/StringCreate.js000066400000000000000000000021351431761430200173310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var $StringPrototype = GetIntrinsic('%String.prototype%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var Type = require('./Type'); var setProto = require('../helpers/setProto'); // https://262.ecma-international.org/6.0/#sec-stringcreate module.exports = function StringCreate(value, prototype) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var S = $Object(value); if (prototype !== $StringPrototype) { if (setProto) { setProto(S, prototype); } else { throw new $SyntaxError('StringCreate: a `proto` argument that is not `String.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } } var length = value.length; DefinePropertyOrThrow(S, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); return S; }; es-abstract-1.20.4/2017/StringGetOwnProperty.js000066400000000000000000000025461431761430200211040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charAt = callBound('String.prototype.charAt'); var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsInteger = require('./IsInteger'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); var isNegativeZero = require('is-negative-zero'); // https://262.ecma-international.org/8.0/#sec-stringgetownproperty module.exports = function StringGetOwnProperty(S, P) { var str; if (Type(S) === 'Object') { try { str = $stringToString(S); } catch (e) { /**/ } } if (Type(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 (Type(P) !== 'String') { return void undefined; } var index = CanonicalNumericIndexString(P); var len = str.length; if (typeof index === 'undefined' || !IsInteger(index) || isNegativeZero(index) || index < 0 || len <= index) { return void undefined; } var resultStr = $charAt(S, index); return { '[[Configurable]]': false, '[[Enumerable]]': true, '[[Value]]': resultStr, '[[Writable]]': false }; }; es-abstract-1.20.4/2017/SymbolDescriptiveString.js000066400000000000000000000010161431761430200215720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $SymbolToString = callBound('Symbol.prototype.toString', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring module.exports = function SymbolDescriptiveString(sym) { if (Type(sym) !== 'Symbol') { throw new $TypeError('Assertion failed: `sym` must be a Symbol'); } return $SymbolToString(sym); }; es-abstract-1.20.4/2017/TestIntegrityLevel.js000066400000000000000000000024051431761430200205450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var every = require('../helpers/every'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel module.exports = function TestIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } var status = IsExtensible(O); if (status) { return false; } var theKeys = OwnPropertyKeys(O); return theKeys.length === 0 || every(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { if (currentDesc.configurable) { return false; } if (level === 'frozen' && IsDataDescriptor(ToPropertyDescriptor(currentDesc)) && currentDesc.writable) { return false; } } return true; }); }; es-abstract-1.20.4/2017/TimeClip.js000066400000000000000000000007241431761430200164470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var $Number = GetIntrinsic('%Number%'); var $isFinite = require('../helpers/isFinite'); var abs = require('./abs'); var ToNumber = require('./ToNumber'); // https://262.ecma-international.org/5.1/#sec-15.9.1.14 module.exports = function TimeClip(time) { if (!$isFinite(time) || abs(time) > 8.64e15) { return NaN; } return $Number(new $Date(ToNumber(time))); }; es-abstract-1.20.4/2017/TimeFromYear.js000066400000000000000000000004051431761430200173000ustar00rootroot00000000000000'use strict'; var msPerDay = require('../helpers/timeConstants').msPerDay; var DayFromYear = require('./DayFromYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function TimeFromYear(y) { return msPerDay * DayFromYear(y); }; es-abstract-1.20.4/2017/TimeWithinDay.js000066400000000000000000000003671431761430200174630ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function TimeWithinDay(t) { return modulo(t, msPerDay); }; es-abstract-1.20.4/2017/ToBoolean.js000066400000000000000000000002021431761430200166120ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.2 module.exports = function ToBoolean(value) { return !!value; }; es-abstract-1.20.4/2017/ToDateString.js000066400000000000000000000007621431761430200173120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Date = GetIntrinsic('%Date%'); var $isNaN = require('../helpers/isNaN'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-todatestring module.exports = function ToDateString(tv) { if (Type(tv) !== 'Number') { throw new $TypeError('Assertion failed: `tv` must be a Number'); } if ($isNaN(tv)) { return 'Invalid Date'; } return $Date(tv); }; es-abstract-1.20.4/2017/ToIndex.js000066400000000000000000000012341431761430200163100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var ToInteger = require('./ToInteger'); var ToLength = require('./ToLength'); var SameValueZero = require('./SameValueZero'); // https://262.ecma-international.org/8.0/#sec-toindex module.exports = function ToIndex(value) { if (typeof value === 'undefined') { return 0; } var integerIndex = ToInteger(value); if (integerIndex < 0) { throw new $RangeError('index must be >= 0'); } var index = ToLength(integerIndex); if (!SameValueZero(integerIndex, index)) { throw new $RangeError('index must be >= 0 and < 2 ** 53 - 1'); } return index; }; es-abstract-1.20.4/2017/ToInt16.js000066400000000000000000000004041431761430200161400ustar00rootroot00000000000000'use strict'; var ToUint16 = require('./ToUint16'); // https://ecma-international.org/ecma-262/6.0/#sec-toint16 module.exports = function ToInt16(argument) { var int16bit = ToUint16(argument); return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit; }; es-abstract-1.20.4/2017/ToInt32.js000066400000000000000000000002551431761430200161420ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.5 module.exports = function ToInt32(x) { return ToNumber(x) >> 0; }; es-abstract-1.20.4/2017/ToInt8.js000066400000000000000000000003671431761430200160710ustar00rootroot00000000000000'use strict'; var ToUint8 = require('./ToUint8'); // https://ecma-international.org/ecma-262/6.0/#sec-toint8 module.exports = function ToInt8(argument) { var int8bit = ToUint8(argument); return int8bit >= 0x80 ? int8bit - 0x100 : int8bit; }; es-abstract-1.20.4/2017/ToInteger.js000066400000000000000000000004211431761430200166330ustar00rootroot00000000000000'use strict'; var ES5ToInteger = require('../5/ToInteger'); var ToNumber = require('./ToNumber'); // https://ecma-international.org/ecma-262/6.0/#sec-tointeger module.exports = function ToInteger(value) { var number = ToNumber(value); return ES5ToInteger(number); }; es-abstract-1.20.4/2017/ToLength.js000066400000000000000000000005141431761430200164620ustar00rootroot00000000000000'use strict'; var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var ToInteger = require('./ToInteger'); module.exports = function ToLength(argument) { var len = ToInteger(argument); if (len <= 0) { return 0; } // includes converting -0 to +0 if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } return len; }; es-abstract-1.20.4/2017/ToNumber.js000066400000000000000000000037301431761430200164740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Number = GetIntrinsic('%Number%'); var $RegExp = GetIntrinsic('%RegExp%'); var $parseInteger = GetIntrinsic('%parseInt%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var isPrimitive = require('../helpers/isPrimitive'); var $strSlice = callBound('String.prototype.slice'); var isBinary = regexTester(/^0b[01]+$/i); var isOctal = regexTester(/^0o[0-7]+$/i); var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i); var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); var hasNonWS = regexTester(nonWSregex); // whitespace from: https://es5.github.io/#x15.5.4.20 // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324 var ws = [ '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003', '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028', '\u2029\uFEFF' ].join(''); var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); var $replace = callBound('String.prototype.replace'); var $trim = function (value) { return $replace(value, trimRegex, ''); }; var ToPrimitive = require('./ToPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-tonumber module.exports = function ToNumber(argument) { var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (typeof value === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a number'); } if (typeof value === 'string') { if (isBinary(value)) { return ToNumber($parseInteger($strSlice(value, 2), 2)); } else if (isOctal(value)) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; } var trimmed = $trim(value); if (trimmed !== value) { return ToNumber(trimmed); } } return $Number(value); }; es-abstract-1.20.4/2017/ToObject.js000066400000000000000000000005161431761430200164510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); // https://ecma-international.org/ecma-262/6.0/#sec-toobject module.exports = function ToObject(value) { RequireObjectCoercible(value); return $Object(value); }; es-abstract-1.20.4/2017/ToPrimitive.js000066400000000000000000000004371431761430200172150ustar00rootroot00000000000000'use strict'; var toPrimitive = require('es-to-primitive/es2015'); // https://ecma-international.org/ecma-262/6.0/#sec-toprimitive module.exports = function ToPrimitive(input) { if (arguments.length > 1) { return toPrimitive(input, arguments[1]); } return toPrimitive(input); }; es-abstract-1.20.4/2017/ToPropertyDescriptor.js000066400000000000000000000026541431761430200211330ustar00rootroot00000000000000'use strict'; var has = require('has'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var ToBoolean = require('./ToBoolean'); var IsCallable = require('./IsCallable'); // https://262.ecma-international.org/5.1/#sec-8.10.5 module.exports = function ToPropertyDescriptor(Obj) { if (Type(Obj) !== 'Object') { throw new $TypeError('ToPropertyDescriptor requires an object'); } var desc = {}; if (has(Obj, 'enumerable')) { desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable); } if (has(Obj, 'configurable')) { desc['[[Configurable]]'] = ToBoolean(Obj.configurable); } if (has(Obj, 'value')) { desc['[[Value]]'] = Obj.value; } if (has(Obj, 'writable')) { desc['[[Writable]]'] = ToBoolean(Obj.writable); } if (has(Obj, 'get')) { var getter = Obj.get; if (typeof getter !== 'undefined' && !IsCallable(getter)) { throw new $TypeError('getter must be a function'); } desc['[[Get]]'] = getter; } if (has(Obj, 'set')) { var setter = Obj.set; if (typeof setter !== 'undefined' && !IsCallable(setter)) { throw new $TypeError('setter must be a function'); } desc['[[Set]]'] = setter; } if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); } return desc; }; es-abstract-1.20.4/2017/ToPropertyKey.js000066400000000000000000000006251431761430200175410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var ToPrimitive = require('./ToPrimitive'); var ToString = require('./ToString'); // https://ecma-international.org/ecma-262/6.0/#sec-topropertykey module.exports = function ToPropertyKey(argument) { var key = ToPrimitive(argument, $String); return typeof key === 'symbol' ? key : ToString(key); }; es-abstract-1.20.4/2017/ToString.js000066400000000000000000000006141431761430200165100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); // https://ecma-international.org/ecma-262/6.0/#sec-tostring module.exports = function ToString(argument) { if (typeof argument === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a string'); } return $String(argument); }; es-abstract-1.20.4/2017/ToUint16.js000066400000000000000000000010641431761430200163300ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // http://262.ecma-international.org/5.1/#sec-9.7 module.exports = function ToUint16(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x10000); }; es-abstract-1.20.4/2017/ToUint32.js000066400000000000000000000002571431761430200163310ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.6 module.exports = function ToUint32(x) { return ToNumber(x) >>> 0; }; es-abstract-1.20.4/2017/ToUint8.js000066400000000000000000000011021431761430200162420ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8 module.exports = function ToUint8(argument) { var number = ToNumber(argument); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x100); }; es-abstract-1.20.4/2017/ToUint8Clamp.js000066400000000000000000000010121431761430200172170ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp module.exports = function ToUint8Clamp(argument) { var number = ToNumber(argument); if ($isNaN(number) || number <= 0) { return 0; } if (number >= 0xFF) { return 0xFF; } var f = floor(argument); if (f + 0.5 < number) { return f + 1; } if (number < f + 0.5) { return f; } if (f % 2 !== 0) { return f + 1; } return f; }; es-abstract-1.20.4/2017/Type.js000066400000000000000000000003711431761430200156600ustar00rootroot00000000000000'use strict'; var ES5Type = require('../5/Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ecmascript-data-types-and-values module.exports = function Type(x) { if (typeof x === 'symbol') { return 'Symbol'; } return ES5Type(x); }; es-abstract-1.20.4/2017/UTF16Decode.js000066400000000000000000000014671431761430200166570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); // https://262.ecma-international.org/7.0/#sec-utf16decode var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); // https://262.ecma-international.org/11.0/#sec-utf16decodesurrogatepair module.exports = function UTF16Decode(lead, trail) { if (!isLeadingSurrogate(lead) || !isTrailingSurrogate(trail)) { throw new $TypeError('Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code'); } // var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; return $fromCharCode(lead) + $fromCharCode(trail); }; es-abstract-1.20.4/2017/UTF16Encoding.js000066400000000000000000000012741431761430200172160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var floor = require('./floor'); var modulo = require('./modulo'); var isCodePoint = require('../helpers/isCodePoint'); // https://262.ecma-international.org/7.0/#sec-utf16encoding module.exports = function UTF16Encoding(cp) { if (!isCodePoint(cp)) { throw new $TypeError('Assertion failed: `cp` must be >= 0 and <= 0x10FFFF'); } if (cp <= 65535) { return $fromCharCode(cp); } var cu1 = floor((cp - 65536) / 1024) + 0xD800; var cu2 = modulo(cp - 65536, 1024) + 0xDC00; return $fromCharCode(cu1) + $fromCharCode(cu2); }; es-abstract-1.20.4/2017/ValidateAndApplyPropertyDescriptor.js000066400000000000000000000121731431761430200237300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var isSamePropertyDescriptor = require('../helpers/isSamePropertyDescriptor'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-validateandapplypropertydescriptor // https://ecma-international.org/ecma-262/8.0/#sec-validateandapplypropertydescriptor // eslint-disable-next-line max-lines-per-function, max-statements, max-params module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) { // this uses the ES2017+ logic, since it fixes a number of bugs in the ES2015 logic. var oType = Type(O); if (oType !== 'Undefined' && oType !== 'Object') { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } if (Type(extensible) !== 'Boolean') { throw new $TypeError('Assertion failed: extensible must be a Boolean'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (Type(current) !== 'Undefined' && !isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } if (oType !== 'Undefined' && !IsPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (Type(current) === 'Undefined') { if (!extensible) { return false; } if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': Desc['[[Configurable]]'], '[[Enumerable]]': Desc['[[Enumerable]]'], '[[Value]]': Desc['[[Value]]'], '[[Writable]]': Desc['[[Writable]]'] } ); } } else { if (!IsAccessorDescriptor(Desc)) { throw new $TypeError('Assertion failed: Desc is not an accessor descriptor'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } } return true; } if (IsGenericDescriptor(Desc) && !('[[Configurable]]' in Desc) && !('[[Enumerable]]' in Desc)) { return true; } if (isSamePropertyDescriptor({ SameValue: SameValue }, Desc, current)) { return true; // removed by ES2017, but should still be correct } // "if every field in Desc is absent, return true" can't really match the assertion that it's a Property Descriptor if (!current['[[Configurable]]']) { if (Desc['[[Configurable]]']) { return false; } if ('[[Enumerable]]' in Desc && !Desc['[[Enumerable]]'] === !!current['[[Enumerable]]']) { return false; } } if (IsGenericDescriptor(Desc)) { // no further validation is required. } else if (IsDataDescriptor(current) !== IsDataDescriptor(Desc)) { if (!current['[[Configurable]]']) { return false; } if (IsDataDescriptor(current)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Get]]': undefined } ); } } else if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Value]]': undefined } ); } } else if (IsDataDescriptor(current) && IsDataDescriptor(Desc)) { if (!current['[[Configurable]]'] && !current['[[Writable]]']) { if ('[[Writable]]' in Desc && Desc['[[Writable]]']) { return false; } if ('[[Value]]' in Desc && !SameValue(Desc['[[Value]]'], current['[[Value]]'])) { return false; } return true; } } else if (IsAccessorDescriptor(current) && IsAccessorDescriptor(Desc)) { if (!current['[[Configurable]]']) { if ('[[Set]]' in Desc && !SameValue(Desc['[[Set]]'], current['[[Set]]'])) { return false; } if ('[[Get]]' in Desc && !SameValue(Desc['[[Get]]'], current['[[Get]]'])) { return false; } return true; } } else { throw new $TypeError('Assertion failed: current and Desc are not both data, both accessors, or one accessor and one data.'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } return true; }; es-abstract-1.20.4/2017/WeekDay.js000066400000000000000000000003201431761430200162620ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.6 module.exports = function WeekDay(t) { return modulo(Day(t) + 4, 7); }; es-abstract-1.20.4/2017/YearFromTime.js000066400000000000000000000006271431761430200173060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var callBound = require('call-bind/callBound'); var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function YearFromTime(t) { // largest y such that this.TimeFromYear(y) <= t return $getUTCFullYear(new $Date(t)); }; es-abstract-1.20.4/2017/abs.js000066400000000000000000000003171431761430200155040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $abs = GetIntrinsic('%Math.abs%'); // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function abs(x) { return $abs(x); }; es-abstract-1.20.4/2017/floor.js000066400000000000000000000003311431761430200160540ustar00rootroot00000000000000'use strict'; // var modulo = require('./modulo'); var $floor = Math.floor; // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function floor(x) { // return x - modulo(x, 1); return $floor(x); }; es-abstract-1.20.4/2017/modulo.js000066400000000000000000000002501431761430200162320ustar00rootroot00000000000000'use strict'; var mod = require('../helpers/mod'); // https://262.ecma-international.org/5.1/#sec-5.2 module.exports = function modulo(x, y) { return mod(x, y); }; es-abstract-1.20.4/2017/msFromTime.js000066400000000000000000000003751431761430200170250ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerSecond = require('../helpers/timeConstants').msPerSecond; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function msFromTime(t) { return modulo(t, msPerSecond); }; es-abstract-1.20.4/2017/thisBooleanValue.js000066400000000000000000000005571431761430200202110ustar00rootroot00000000000000'use strict'; var $BooleanValueOf = require('call-bind/callBound')('Boolean.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-boolean-prototype-object module.exports = function thisBooleanValue(value) { if (Type(value) === 'Boolean') { return value; } return $BooleanValueOf(value); }; es-abstract-1.20.4/2017/thisNumberValue.js000066400000000000000000000006061431761430200200550ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var Type = require('./Type'); var $NumberValueOf = callBound('Number.prototype.valueOf'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object module.exports = function thisNumberValue(value) { if (Type(value) === 'Number') { return value; } return $NumberValueOf(value); }; es-abstract-1.20.4/2017/thisStringValue.js000066400000000000000000000005511431761430200200720ustar00rootroot00000000000000'use strict'; var $StringValueOf = require('call-bind/callBound')('String.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object module.exports = function thisStringValue(value) { if (Type(value) === 'String') { return value; } return $StringValueOf(value); }; es-abstract-1.20.4/2017/thisTimeValue.js000066400000000000000000000004131431761430200175170ustar00rootroot00000000000000'use strict'; var $DateGetTime = require('call-bind/callBound')('Date.prototype.getTime'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-date-prototype-object module.exports = function thisTimeValue(value) { return $DateGetTime(value); }; es-abstract-1.20.4/2018/000077500000000000000000000000001431761430200144015ustar00rootroot00000000000000es-abstract-1.20.4/2018/AbstractEqualityComparison.js000066400000000000000000000022021431761430200222470ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison module.exports = function AbstractEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType === yType) { return x === y; // ES6+ specified this shortcut anyways. } if (x == null && y == null) { return true; } if (xType === 'Number' && yType === 'String') { return AbstractEqualityComparison(x, ToNumber(y)); } if (xType === 'String' && yType === 'Number') { return AbstractEqualityComparison(ToNumber(x), y); } if (xType === 'Boolean') { return AbstractEqualityComparison(ToNumber(x), y); } if (yType === 'Boolean') { return AbstractEqualityComparison(x, ToNumber(y)); } if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') { return AbstractEqualityComparison(x, ToPrimitive(y)); } if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) { return AbstractEqualityComparison(ToPrimitive(x), y); } return false; }; es-abstract-1.20.4/2018/AbstractRelationalComparison.js000066400000000000000000000027751431761430200225630ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var IsStringPrefix = require('./IsStringPrefix'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); } var px; var py; if (LeftFirst) { px = ToPrimitive(x, $Number); py = ToPrimitive(y, $Number); } else { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } if (Type(px) === 'String' && Type(py) === 'String') { if (IsStringPrefix(py, px)) { return false; } if (IsStringPrefix(px, py)) { return true; } return px < py; // both strings, neither a prefix of the other. shortcut for steps 3 c-f } var nx = ToNumber(px); var ny = ToNumber(py); if ($isNaN(nx) || $isNaN(ny)) { return undefined; } if ($isFinite(nx) && $isFinite(ny) && nx === ny) { return false; } if (nx === Infinity) { return false; } if (ny === Infinity) { return true; } if (ny === -Infinity) { return false; } if (nx === -Infinity) { return true; } return nx < ny; // by now, these are both nonzero, finite, and not equal }; es-abstract-1.20.4/2018/AdvanceStringIndex.js000066400000000000000000000024311431761430200204570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = require('call-bind/callBound')('String.prototype.charCodeAt'); // https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex module.exports = function AdvanceStringIndex(S, index, unicode) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53'); } if (Type(unicode) !== 'Boolean') { throw new $TypeError('Assertion failed: `unicode` must be a Boolean'); } if (!unicode) { return index + 1; } var length = S.length; if ((index + 1) >= length) { return index + 1; } var first = $charCodeAt(S, index); if (!isLeadingSurrogate(first)) { return index + 1; } var second = $charCodeAt(S, index + 1); if (!isTrailingSurrogate(second)) { return index + 1; } return index + 2; }; es-abstract-1.20.4/2018/ArrayCreate.js000066400000000000000000000031621431761430200171430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ArrayPrototype = GetIntrinsic('%Array.prototype%'); var $RangeError = GetIntrinsic('%RangeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || ( // eslint-disable-next-line no-proto, no-negated-condition [].__proto__ !== $ArrayPrototype ? null : function (O, proto) { O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign return O; } ); // https://ecma-international.org/ecma-262/6.0/#sec-arraycreate module.exports = function ArrayCreate(length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0'); } if (length > MAX_ARRAY_LENGTH) { throw new $RangeError('length is greater than (2**32 - 1)'); } var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype; var A = []; // steps 5 - 7, and 9 if (proto !== $ArrayPrototype) { // step 8 if (!$setProto) { throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } $setProto(A, proto); } if (length !== 0) { // bypasses the need for step 2 A.length = length; } /* step 10, the above as a shortcut for the below OrdinaryDefineOwnProperty(A, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': true }); */ return A; }; es-abstract-1.20.4/2018/ArraySetLength.js000066400000000000000000000051511431761430200176350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var assign = require('object.assign'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsArray = require('./IsArray'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function ArraySetLength(A, Desc) { if (!IsArray(A)) { throw new $TypeError('Assertion failed: A must be an Array'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!('[[Value]]' in Desc)) { return OrdinaryDefineOwnProperty(A, 'length', Desc); } var newLenDesc = assign({}, Desc); var newLen = ToUint32(Desc['[[Value]]']); var numberLen = ToNumber(Desc['[[Value]]']); if (newLen !== numberLen) { throw new $RangeError('Invalid array length'); } newLenDesc['[[Value]]'] = newLen; var oldLenDesc = OrdinaryGetOwnProperty(A, 'length'); if (!IsDataDescriptor(oldLenDesc)) { throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`'); } var oldLen = oldLenDesc['[[Value]]']; if (newLen >= oldLen) { return OrdinaryDefineOwnProperty(A, 'length', newLenDesc); } if (!oldLenDesc['[[Writable]]']) { return false; } var newWritable; if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) { newWritable = true; } else { newWritable = false; newLenDesc['[[Writable]]'] = true; } var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc); if (!succeeded) { return false; } while (newLen < oldLen) { oldLen -= 1; // eslint-disable-next-line no-param-reassign var deleteSucceeded = delete A[ToString(oldLen)]; if (!deleteSucceeded) { newLenDesc['[[Value]]'] = oldLen + 1; if (!newWritable) { newLenDesc['[[Writable]]'] = false; OrdinaryDefineOwnProperty(A, 'length', newLenDesc); return false; } } } if (!newWritable) { return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false }); } return true; }; es-abstract-1.20.4/2018/ArraySpeciesCreate.js000066400000000000000000000025041431761430200204560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Array = GetIntrinsic('%Array%'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsConstructor = require('./IsConstructor'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate module.exports = function ArraySpeciesCreate(originalArray, length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: length must be an integer >= 0'); } var len = length === 0 ? 0 : length; var C; var isArray = IsArray(originalArray); if (isArray) { C = Get(originalArray, 'constructor'); // TODO: figure out how to make a cross-realm normal Array, a same-realm Array // if (IsConstructor(C)) { // if C is another realm's Array, C = undefined // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ? // } if ($species && Type(C) === 'Object') { C = Get(C, $species); if (C === null) { C = void 0; } } } if (typeof C === 'undefined') { return $Array(len); } if (!IsConstructor(C)) { throw new $TypeError('C must be a constructor'); } return new C(len); // Construct(C, len); }; es-abstract-1.20.4/2018/Call.js000066400000000000000000000011571431761430200156160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsArray = require('./IsArray'); var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%'); // https://ecma-international.org/ecma-262/6.0/#sec-call module.exports = function Call(F, V) { var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } return $apply(F, V, argumentsList); }; es-abstract-1.20.4/2018/CanonicalNumericIndexString.js000066400000000000000000000012161431761430200223300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring module.exports = function CanonicalNumericIndexString(argument) { if (Type(argument) !== 'String') { throw new $TypeError('Assertion failed: `argument` must be a String'); } if (argument === '-0') { return -0; } var n = ToNumber(argument); if (SameValue(ToString(n), argument)) { return n; } return void 0; }; es-abstract-1.20.4/2018/CharacterRange.js000066400000000000000000000014161431761430200176120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = callBound('%String.prototype.charCodeAt%'); var $push = callBound('%Array.prototype.push%'); module.exports = function CharacterRange(A, B) { if (A.length !== 1 || B.length !== 1) { throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); } var a = A[0]; var b = B[0]; var i = $charCodeAt(a, 0); var j = $charCodeAt(b, 0); if (!(i <= j)) { throw new $TypeError('Assertion failed: i is not <= j'); } var arr = []; for (var k = i; k <= j; k += 1) { $push(arr, $fromCharCode(k)); } return arr; }; es-abstract-1.20.4/2018/CompletePropertyDescriptor.js000066400000000000000000000017351431761430200223210ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor module.exports = function CompletePropertyDescriptor(Desc) { /* eslint no-param-reassign: 0 */ assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (!has(Desc, '[[Value]]')) { Desc['[[Value]]'] = void 0; } if (!has(Desc, '[[Writable]]')) { Desc['[[Writable]]'] = false; } } else { if (!has(Desc, '[[Get]]')) { Desc['[[Get]]'] = void 0; } if (!has(Desc, '[[Set]]')) { Desc['[[Set]]'] = void 0; } } if (!has(Desc, '[[Enumerable]]')) { Desc['[[Enumerable]]'] = false; } if (!has(Desc, '[[Configurable]]')) { Desc['[[Configurable]]'] = false; } return Desc; }; es-abstract-1.20.4/2018/CopyDataProperties.js000066400000000000000000000037101431761430200205210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var CreateDataProperty = require('./CreateDataProperty'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-copydataproperties module.exports = function CopyDataProperties(target, source, excludedItems) { if (Type(target) !== 'Object') { throw new $TypeError('Assertion failed: "target" must be an Object'); } if (!IsArray(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])) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } } if (typeof source === 'undefined' || source === null) { return target; } var fromObj = ToObject(source); var sourceKeys = OwnPropertyKeys(fromObj); forEach(sourceKeys, function (nextKey) { var excluded = false; forEach(excludedItems, function (e) { if (SameValue(e, nextKey) === true) { excluded = true; } }); var enumerable = $isEnumerable(fromObj, nextKey) || ( // this is to handle string keys being non-enumerable in older engines typeof source === 'string' && nextKey >= 0 && IsInteger(ToNumber(nextKey)) ); if (excluded === false && enumerable) { var propValue = Get(fromObj, nextKey); CreateDataProperty(target, nextKey, propValue); } }); return target; }; es-abstract-1.20.4/2018/CreateDataProperty.js000066400000000000000000000023771431761430200205120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty module.exports = function CreateDataProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var oldDesc = OrdinaryGetOwnProperty(O, P); var extensible = !oldDesc || IsExtensible(O); var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]']; if (nonConfigurable || !extensible) { return false; } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Value]]': V, '[[Writable]]': true } ); }; es-abstract-1.20.4/2018/CreateDataPropertyOrThrow.js000066400000000000000000000013361431761430200220310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var CreateDataProperty = require('./CreateDataProperty'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var success = CreateDataProperty(O, P, V); if (!success) { throw new $TypeError('unable to create data property'); } return success; }; es-abstract-1.20.4/2018/CreateHTML.js000066400000000000000000000016371431761430200166360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $replace = callBound('String.prototype.replace'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createhtml module.exports = function CreateHTML(string, tag, attribute, value) { if (Type(tag) !== 'String' || Type(attribute) !== 'String') { throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings'); } var str = RequireObjectCoercible(string); var S = ToString(str); var p1 = '<' + tag; if (attribute !== '') { var V = ToString(value); var escapedV = $replace(V, /\x22/g, '"'); p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22'; } return p1 + '>' + S + ''; }; es-abstract-1.20.4/2018/CreateIterResultObject.js000066400000000000000000000006601431761430200213160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject module.exports = function CreateIterResultObject(value, done) { if (Type(done) !== 'Boolean') { throw new $TypeError('Assertion failed: Type(done) is not Boolean'); } return { value: value, done: done }; }; es-abstract-1.20.4/2018/CreateListFromArrayLike.js000066400000000000000000000025121431761430200214260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $indexOf = callBound('Array.prototype.indexOf', true) || callBound('String.prototype.indexOf'); var $push = callBound('Array.prototype.push'); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createlistfromarraylike module.exports = function CreateListFromArrayLike(obj) { var elementTypes = arguments.length > 1 ? arguments[1] : ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object']; if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } if (!IsArray(elementTypes)) { throw new $TypeError('Assertion failed: `elementTypes`, if provided, must be an array'); } var len = ToLength(Get(obj, 'length')); var list = []; var index = 0; while (index < len) { var indexName = ToString(index); var next = Get(obj, indexName); var nextType = Type(next); if ($indexOf(elementTypes, nextType) < 0) { throw new $TypeError('item type ' + nextType + ' is not a valid elementType'); } $push(list, next); index += 1; } return list; }; es-abstract-1.20.4/2018/CreateMethodProperty.js000066400000000000000000000017231431761430200210530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty module.exports = function CreateMethodProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var newDesc = { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': V, '[[Writable]]': true }; return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, newDesc ); }; es-abstract-1.20.4/2018/DateFromTime.js000066400000000000000000000020141431761430200172540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); var MonthFromTime = require('./MonthFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.5 module.exports = function DateFromTime(t) { var m = MonthFromTime(t); var d = DayWithinYear(t); if (m === 0) { return d + 1; } if (m === 1) { return d - 30; } var leap = InLeapYear(t); if (m === 2) { return d - 58 - leap; } if (m === 3) { return d - 89 - leap; } if (m === 4) { return d - 119 - leap; } if (m === 5) { return d - 150 - leap; } if (m === 6) { return d - 180 - leap; } if (m === 7) { return d - 211 - leap; } if (m === 8) { return d - 242 - leap; } if (m === 9) { return d - 272 - leap; } if (m === 10) { return d - 303 - leap; } if (m === 11) { return d - 333 - leap; } throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m); }; es-abstract-1.20.4/2018/DateString.js000066400000000000000000000020371431761430200170050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; var $isNaN = require('../helpers/isNaN'); var padTimeComponent = require('../helpers/padTimeComponent'); var Type = require('./Type'); var WeekDay = require('./WeekDay'); var MonthFromTime = require('./MonthFromTime'); var YearFromTime = require('./YearFromTime'); var DateFromTime = require('./DateFromTime'); // https://262.ecma-international.org/9.0/#sec-datestring module.exports = function DateString(tv) { if (Type(tv) !== 'Number' || $isNaN(tv)) { throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); } var weekday = weekdays[WeekDay(tv)]; var month = months[MonthFromTime(tv)]; var day = padTimeComponent(DateFromTime(tv)); var year = padTimeComponent(YearFromTime(tv), 4); return weekday + '\x20' + month + '\x20' + day + '\x20' + year; }; es-abstract-1.20.4/2018/Day.js000066400000000000000000000003521431761430200154540ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function Day(t) { return floor(t / msPerDay); }; es-abstract-1.20.4/2018/DayFromYear.js000066400000000000000000000004001431761430200171130ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DayFromYear(y) { return (365 * (y - 1970)) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400); }; es-abstract-1.20.4/2018/DayWithinYear.js000066400000000000000000000004361431761430200174630ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var DayFromYear = require('./DayFromYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function DayWithinYear(t) { return Day(t) - DayFromYear(YearFromTime(t)); }; es-abstract-1.20.4/2018/DaysInYear.js000066400000000000000000000004551431761430200167530ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DaysInYear(y) { if (modulo(y, 4) !== 0) { return 365; } if (modulo(y, 100) !== 0) { return 366; } if (modulo(y, 400) !== 0) { return 365; } return 366; }; es-abstract-1.20.4/2018/DefinePropertyOrThrow.js000066400000000000000000000026721431761430200212320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow module.exports = function DefinePropertyOrThrow(O, P, desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var Desc = isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, desc) ? desc : ToPropertyDescriptor(desc); if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor'); } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); }; es-abstract-1.20.4/2018/DeletePropertyOrThrow.js000066400000000000000000000012731431761430200212360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow module.exports = function DeletePropertyOrThrow(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // eslint-disable-next-line no-param-reassign var success = delete O[P]; if (!success) { throw new $TypeError('Attempt to delete property failed.'); } return success; }; es-abstract-1.20.4/2018/EnumerableOwnPropertyNames.js000066400000000000000000000021301431761430200222270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var objectKeys = require('object-keys'); var callBound = require('call-bind/callBound'); var callBind = require('call-bind'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%')); var forEach = require('../helpers/forEach'); var Type = require('./Type'); // https://262.ecma-international.org/8.0/#sec-enumerableownproperties module.exports = function EnumerableOwnPropertyNames(O, kind) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var keys = objectKeys(O); if (kind === 'key') { return keys; } if (kind === 'value' || kind === 'key+value') { var results = []; forEach(keys, function (key) { if ($isEnumerable(O, key)) { $pushApply(results, [ kind === 'value' ? O[key] : [key, O[key]] ]); } }); return results; } throw new $TypeError('Assertion failed: "kind" is not "key", "value", or "key+value": ' + kind); }; es-abstract-1.20.4/2018/FromPropertyDescriptor.js000066400000000000000000000007021431761430200214450ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor module.exports = function FromPropertyDescriptor(Desc) { if (typeof Desc !== 'undefined') { assertRecord(Type, 'Property Descriptor', 'Desc', Desc); } return fromPropertyDescriptor(Desc); }; es-abstract-1.20.4/2018/Get.js000066400000000000000000000011321431761430200154530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var inspect = require('object-inspect'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-get-o-p module.exports = function Get(O, P) { // 7.3.1.1 if (Type(O) !== 'Object') { 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)); } // 7.3.1.3 return O[P]; }; es-abstract-1.20.4/2018/GetIterator.js000066400000000000000000000015301431761430200171670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var getIteratorMethod = require('../helpers/getIteratorMethod'); var AdvanceStringIndex = require('./AdvanceStringIndex'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsArray = require('./IsArray'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getiterator module.exports = function GetIterator(obj, method) { var actualMethod = method; if (arguments.length < 2) { actualMethod = getIteratorMethod( { AdvanceStringIndex: AdvanceStringIndex, GetMethod: GetMethod, IsArray: IsArray }, obj ); } var iterator = Call(actualMethod, obj); if (Type(iterator) !== 'Object') { throw new $TypeError('iterator must return an object'); } return iterator; }; es-abstract-1.20.4/2018/GetMethod.js000066400000000000000000000012271431761430200166210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-getmethod module.exports = function GetMethod(O, P) { // 7.3.9.1 if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // 7.3.9.2 var func = GetV(O, P); // 7.3.9.4 if (func == null) { return void 0; } // 7.3.9.5 if (!IsCallable(func)) { throw new $TypeError(P + 'is not a function'); } // 7.3.9.6 return func; }; es-abstract-1.20.4/2018/GetOwnPropertyKeys.js000066400000000000000000000014751431761430200205520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%', true); var keys = require('object-keys'); var esType = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys module.exports = function GetOwnPropertyKeys(O, Type) { if (esType(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (Type === 'Symbol') { return $gOPS ? $gOPS(O) : []; } if (Type === 'String') { if (!$gOPN) { return keys(O); } return $gOPN(O); } throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`'); }; es-abstract-1.20.4/2018/GetPrototypeFromConstructor.js000066400000000000000000000016311431761430200224770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Function = GetIntrinsic('%Function%'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic if (!IsConstructor(constructor)) { throw new $TypeError('Assertion failed: `constructor` must be a constructor'); } var proto = Get(constructor, 'prototype'); if (Type(proto) !== 'Object') { if (!(constructor instanceof $Function)) { // ignore other realms, for now throw new $TypeError('cross-realm constructors not currently supported'); } proto = intrinsic; } return proto; }; es-abstract-1.20.4/2018/GetSubstitution.js000066400000000000000000000104721431761430200201170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var every = require('../helpers/every'); var $charAt = callBound('String.prototype.charAt'); var $strSlice = callBound('String.prototype.slice'); var $indexOf = callBound('String.prototype.indexOf'); var $parseInt = parseInt; var isDigit = regexTester(/^[0-9]$/); var inspect = require('object-inspect'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); var ToObject = require('./ToObject'); var ToString = require('./ToString'); var Type = require('./Type'); var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false var isStringOrHole = function (capture, index, arr) { return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined'); }; // http://262.ecma-international.org/9.0/#sec-getsubstitution // eslint-disable-next-line max-statements, max-params, max-lines-per-function module.exports = function GetSubstitution(matched, str, position, captures, namedCaptures, replacement) { if (Type(matched) !== 'String') { throw new $TypeError('Assertion failed: `matched` must be a String'); } var matchLength = matched.length; if (Type(str) !== 'String') { throw new $TypeError('Assertion failed: `str` must be a String'); } var stringLength = str.length; if (!IsInteger(position) || position < 0 || position > stringLength) { throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position)); } if (!IsArray(captures) || !every(captures, isStringOrHole)) { throw new $TypeError('Assertion failed: `captures` must be a List of Strings, got ' + inspect(captures)); } if (Type(replacement) !== 'String') { throw new $TypeError('Assertion failed: `replacement` must be a String'); } var tailPos = position + matchLength; var m = captures.length; if (Type(namedCaptures) !== 'Undefined') { namedCaptures = ToObject(namedCaptures); // eslint-disable-line no-param-reassign } var result = ''; for (var i = 0; i < replacement.length; i += 1) { // if this is a $, and it's not the end of the replacement var current = $charAt(replacement, i); var isLast = (i + 1) >= replacement.length; var nextIsLast = (i + 2) >= replacement.length; if (current === '$' && !isLast) { var next = $charAt(replacement, i + 1); if (next === '$') { result += '$'; i += 1; } else if (next === '&') { result += matched; i += 1; } else if (next === '`') { result += position === 0 ? '' : $strSlice(str, 0, position - 1); i += 1; } else if (next === "'") { result += tailPos >= stringLength ? '' : $strSlice(str, tailPos); i += 1; } else { var nextNext = nextIsLast ? null : $charAt(replacement, i + 2); if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) { // $1 through $9, and not followed by a digit var n = $parseInt(next, 10); // if (n > m, impl-defined) result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1]; i += 1; } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) { // $00 through $99 var nn = next + nextNext; var nnI = $parseInt(nn, 10) - 1; // if nn === '00' or nn > m, impl-defined result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI]; i += 2; } else if (next === '<') { // eslint-disable-next-line max-depth if (Type(namedCaptures) === 'Undefined') { result += '$<'; i += 2; } else { var endIndex = $indexOf(replacement, '>', i); // eslint-disable-next-line max-depth if (endIndex > -1) { var groupName = $strSlice(replacement, i + '$<'.length, endIndex); var capture = Get(namedCaptures, groupName); // eslint-disable-next-line max-depth if (Type(capture) !== 'Undefined') { result += ToString(capture); } i += ('<' + groupName + '>').length; } } } else { result += '$'; } } } else { // the final $, or else not a $ result += $charAt(replacement, i); } } return result; }; es-abstract-1.20.4/2018/GetV.js000066400000000000000000000007321431761430200156060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var ToObject = require('./ToObject'); // https://ecma-international.org/ecma-262/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'); } // 7.3.2.2-3 var O = ToObject(V); // 7.3.2.4 return O[P]; }; es-abstract-1.20.4/2018/HasOwnProperty.js000066400000000000000000000010511431761430200177000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var has = require('has'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty module.exports = function HasOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return has(O, P); }; es-abstract-1.20.4/2018/HasProperty.js000066400000000000000000000010051431761430200172130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty module.exports = function HasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2018/HourFromTime.js000066400000000000000000000005761431761430200173270ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerHour = timeConstants.msPerHour; var HoursPerDay = timeConstants.HoursPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function HourFromTime(t) { return modulo(floor(t / msPerHour), HoursPerDay); }; es-abstract-1.20.4/2018/InLeapYear.js000066400000000000000000000007761431761430200167420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DaysInYear = require('./DaysInYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function InLeapYear(t) { var days = DaysInYear(YearFromTime(t)); if (days === 365) { return 0; } if (days === 366) { return 1; } throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days); }; es-abstract-1.20.4/2018/InstanceofOperator.js000066400000000000000000000016261431761430200205510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $hasInstance = GetIntrinsic('Symbol.hasInstance', true); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var OrdinaryHasInstance = require('./OrdinaryHasInstance'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator module.exports = function InstanceofOperator(O, C) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var instOfHandler = $hasInstance ? GetMethod(C, $hasInstance) : void 0; if (typeof instOfHandler !== 'undefined') { return ToBoolean(Call(instOfHandler, C, [O])); } if (!IsCallable(C)) { throw new $TypeError('`C` is not Callable'); } return OrdinaryHasInstance(C, O); }; es-abstract-1.20.4/2018/Invoke.js000066400000000000000000000013131431761430200161700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-invoke module.exports = function Invoke(O, P) { if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } var func = GetV(O, P); return Call(func, O, argumentsList); }; es-abstract-1.20.4/2018/IsAccessorDescriptor.js000066400000000000000000000007211431761430200210340ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor module.exports = function IsAccessorDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { return false; } return true; }; es-abstract-1.20.4/2018/IsArray.js000066400000000000000000000001731431761430200163120ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-isarray module.exports = require('../helpers/IsArray'); es-abstract-1.20.4/2018/IsCallable.js000066400000000000000000000001541431761430200167320ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.11 module.exports = require('is-callable'); es-abstract-1.20.4/2018/IsCompatiblePropertyDescriptor.js000066400000000000000000000005571431761430200231250ustar00rootroot00000000000000'use strict'; var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); }; es-abstract-1.20.4/2018/IsConcatSpreadable.js000066400000000000000000000011621431761430200204250ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable module.exports = function IsConcatSpreadable(O) { if (Type(O) !== 'Object') { return false; } if ($isConcatSpreadable) { var spreadable = Get(O, $isConcatSpreadable); if (typeof spreadable !== 'undefined') { return ToBoolean(spreadable); } } return IsArray(O); }; es-abstract-1.20.4/2018/IsConstructor.js000066400000000000000000000021751431761430200175650ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('../GetIntrinsic.js'); var $construct = GetIntrinsic('%Reflect.construct%', true); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); try { DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} }); } catch (e) { // Accessor properties aren't supported DefinePropertyOrThrow = null; } // https://ecma-international.org/ecma-262/6.0/#sec-isconstructor if (DefinePropertyOrThrow && $construct) { var isConstructorMarker = {}; var badArrayLike = {}; DefinePropertyOrThrow(badArrayLike, 'length', { '[[Get]]': function () { throw isConstructorMarker; }, '[[Enumerable]]': true }); module.exports = function IsConstructor(argument) { try { // `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`: $construct(argument, badArrayLike); } catch (err) { return err === isConstructorMarker; } }; } else { module.exports = function IsConstructor(argument) { // unfortunately there's no way to truly check this without try/catch `new argument` in old environments return typeof argument === 'function' && !!argument.prototype; }; } es-abstract-1.20.4/2018/IsDataDescriptor.js000066400000000000000000000007201431761430200201420ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor module.exports = function IsDataDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { return false; } return true; }; es-abstract-1.20.4/2018/IsExtensible.js000066400000000000000000000007751431761430200173460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $isExtensible = GetIntrinsic('%Object.isExtensible%', true); var isPrimitive = require('../helpers/isPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o module.exports = $preventExtensions ? function IsExtensible(obj) { return !isPrimitive(obj) && $isExtensible(obj); } : function IsExtensible(obj) { return !isPrimitive(obj); }; es-abstract-1.20.4/2018/IsGenericDescriptor.js000066400000000000000000000010601431761430200206430ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor module.exports = function IsGenericDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) { return true; } return false; }; es-abstract-1.20.4/2018/IsInteger.js000066400000000000000000000007021431761430200166270ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); // https://ecma-international.org/ecma-262/6.0/#sec-isinteger module.exports = function IsInteger(argument) { if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) { return false; } var absValue = abs(argument); return floor(absValue) === absValue; }; es-abstract-1.20.4/2018/IsPromise.js000066400000000000000000000007451431761430200166570ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $PromiseThen = callBound('Promise.prototype.then', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ispromise module.exports = function IsPromise(x) { if (Type(x) !== 'Object') { return false; } if (!$PromiseThen) { // Promises are not supported return false; } try { $PromiseThen(x); // throws if not a promise } catch (e) { return false; } return true; }; es-abstract-1.20.4/2018/IsPropertyKey.js000066400000000000000000000003171431761430200175310ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { return typeof argument === 'string' || typeof argument === 'symbol'; }; es-abstract-1.20.4/2018/IsRegExp.js000066400000000000000000000010411431761430200164210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $match = GetIntrinsic('%Symbol.match%', true); var hasRegExpMatcher = require('is-regex'); var ToBoolean = require('./ToBoolean'); // https://ecma-international.org/ecma-262/6.0/#sec-isregexp module.exports = function IsRegExp(argument) { if (!argument || typeof argument !== 'object') { return false; } if ($match) { var isRegExp = argument[$match]; if (typeof isRegExp !== 'undefined') { return ToBoolean(isRegExp); } } return hasRegExpMatcher(argument); }; es-abstract-1.20.4/2018/IsSharedArrayBuffer.js000066400000000000000000000007151431761430200205750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var isSharedArrayBuffer = require('is-shared-array-buffer'); // https://262.ecma-international.org/8.0/#sec-issharedarraybuffer module.exports = function IsSharedArrayBuffer(obj) { if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } return isSharedArrayBuffer(obj); }; es-abstract-1.20.4/2018/IsStringPrefix.js000066400000000000000000000016541431761430200176650ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPrefixOf = require('../helpers/isPrefixOf'); // var callBound = require('call-bind/callBound'); // var $charAt = callBound('String.prototype.charAt'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-isstringprefix module.exports = function IsStringPrefix(p, q) { if (Type(p) !== 'String') { throw new $TypeError('Assertion failed: "p" must be a String'); } if (Type(q) !== 'String') { throw new $TypeError('Assertion failed: "q" must be a String'); } return isPrefixOf(p, q); /* if (p === q || p === '') { return true; } var pLength = p.length; var qLength = q.length; if (pLength >= qLength) { return false; } // assert: pLength < qLength for (var i = 0; i < pLength; i += 1) { if ($charAt(p, i) !== $charAt(q, i)) { return false; } } return true; */ }; es-abstract-1.20.4/2018/IterableToList.js000066400000000000000000000011531431761430200176250ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $arrayPush = callBound('Array.prototype.push'); var GetIterator = require('./GetIterator'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); // https://262.ecma-international.org/8.0/#sec-iterabletolist module.exports = function IterableToList(items, method) { var iterator = GetIterator(items, method); var values = []; var next = true; while (next) { next = IteratorStep(iterator); if (next) { var nextValue = IteratorValue(next); $arrayPush(values, nextValue); } } return values; }; es-abstract-1.20.4/2018/IteratorClose.js000066400000000000000000000027111431761430200175170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose module.exports = function IteratorClose(iterator, completion) { if (Type(iterator) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterator) is not Object'); } if (!IsCallable(completion)) { throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record'); } var completionThunk = completion; var iteratorReturn = GetMethod(iterator, 'return'); if (typeof iteratorReturn === 'undefined') { return completionThunk(); } var completionRecord; try { var innerResult = Call(iteratorReturn, iterator, []); } catch (e) { // if we hit here, then "e" is the innerResult completion that needs re-throwing // if the completion is of type "throw", this will throw. completionThunk(); completionThunk = null; // ensure it's not called twice. // if not, then return the innerResult completion throw e; } completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does completionThunk = null; // ensure it's not called twice. if (Type(innerResult) !== 'Object') { throw new $TypeError('iterator .return must return an object'); } return completionRecord; }; es-abstract-1.20.4/2018/IteratorComplete.js000066400000000000000000000007621431761430200202260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete module.exports = function IteratorComplete(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return ToBoolean(Get(iterResult, 'done')); }; es-abstract-1.20.4/2018/IteratorNext.js000066400000000000000000000007551431761430200173760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Invoke = require('./Invoke'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext module.exports = function IteratorNext(iterator, value) { var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]); if (Type(result) !== 'Object') { throw new $TypeError('iterator next must return an object'); } return result; }; es-abstract-1.20.4/2018/IteratorStep.js000066400000000000000000000005411431761430200173640ustar00rootroot00000000000000'use strict'; var IteratorComplete = require('./IteratorComplete'); var IteratorNext = require('./IteratorNext'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep module.exports = function IteratorStep(iterator) { var result = IteratorNext(iterator); var done = IteratorComplete(result); return done === true ? false : result; }; es-abstract-1.20.4/2018/IteratorValue.js000066400000000000000000000006731431761430200175330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue module.exports = function IteratorValue(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return Get(iterResult, 'value'); }; es-abstract-1.20.4/2018/MakeDate.js000066400000000000000000000005101431761430200164060ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.13 module.exports = function MakeDate(day, time) { if (!$isFinite(day) || !$isFinite(time)) { return NaN; } return (day * msPerDay) + time; }; es-abstract-1.20.4/2018/MakeDay.js000066400000000000000000000016251431761430200162560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $DateUTC = GetIntrinsic('%Date.UTC%'); var $isFinite = require('../helpers/isFinite'); var DateFromTime = require('./DateFromTime'); var Day = require('./Day'); var floor = require('./floor'); var modulo = require('./modulo'); var MonthFromTime = require('./MonthFromTime'); var ToInteger = require('./ToInteger'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.12 module.exports = function MakeDay(year, month, date) { if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { return NaN; } var y = ToInteger(year); var m = ToInteger(month); var dt = ToInteger(date); var ym = y + floor(m / 12); var mn = modulo(m, 12); var t = $DateUTC(ym, mn, 1); if (YearFromTime(t) !== ym || MonthFromTime(t) !== mn || DateFromTime(t) !== 1) { return NaN; } return Day(t) + dt - 1; }; es-abstract-1.20.4/2018/MakeTime.js000066400000000000000000000012721431761430200164350ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var msPerMinute = timeConstants.msPerMinute; var msPerHour = timeConstants.msPerHour; var ToInteger = require('./ToInteger'); // https://262.ecma-international.org/5.1/#sec-15.9.1.11 module.exports = function MakeTime(hour, min, sec, ms) { if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { return NaN; } var h = ToInteger(hour); var m = ToInteger(min); var s = ToInteger(sec); var milli = ToInteger(ms); var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; return t; }; es-abstract-1.20.4/2018/MinFromTime.js000066400000000000000000000006141431761430200171260ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerMinute = timeConstants.msPerMinute; var MinutesPerHour = timeConstants.MinutesPerHour; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function MinFromTime(t) { return modulo(floor(t / msPerMinute), MinutesPerHour); }; es-abstract-1.20.4/2018/MonthFromTime.js000066400000000000000000000017661431761430200175010ustar00rootroot00000000000000'use strict'; var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function MonthFromTime(t) { var day = DayWithinYear(t); if (0 <= day && day < 31) { return 0; } var leap = InLeapYear(t); if (31 <= day && day < (59 + leap)) { return 1; } if ((59 + leap) <= day && day < (90 + leap)) { return 2; } if ((90 + leap) <= day && day < (120 + leap)) { return 3; } if ((120 + leap) <= day && day < (151 + leap)) { return 4; } if ((151 + leap) <= day && day < (181 + leap)) { return 5; } if ((181 + leap) <= day && day < (212 + leap)) { return 6; } if ((212 + leap) <= day && day < (243 + leap)) { return 7; } if ((243 + leap) <= day && day < (273 + leap)) { return 8; } if ((273 + leap) <= day && day < (304 + leap)) { return 9; } if ((304 + leap) <= day && day < (334 + leap)) { return 10; } if ((334 + leap) <= day && day < (365 + leap)) { return 11; } }; es-abstract-1.20.4/2018/NumberToString.js000066400000000000000000000006601431761430200176630ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-tostring-applied-to-the-number-type module.exports = function NumberToString(m) { if (Type(m) !== 'Number') { throw new $TypeError('Assertion failed: "m" must be a String'); } return $String(m); }; es-abstract-1.20.4/2018/ObjectCreate.js000066400000000000000000000020111431761430200172630ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ObjectCreate = GetIntrinsic('%Object.create%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var Type = require('./Type'); var hasProto = !({ __proto__: null } instanceof Object); // https://ecma-international.org/ecma-262/6.0/#sec-objectcreate module.exports = function ObjectCreate(proto, internalSlotsList) { if (proto !== null && Type(proto) !== 'Object') { throw new $TypeError('Assertion failed: `proto` must be null or an object'); } var slots = arguments.length < 2 ? [] : internalSlotsList; if (slots.length > 0) { throw new $SyntaxError('es-abstract does not yet support internal slots'); } if ($ObjectCreate) { return $ObjectCreate(proto); } if (hasProto) { return { __proto__: proto }; } if (proto === null) { throw new $SyntaxError('native Object.create support is required to create null objects'); } var T = function T() {}; T.prototype = proto; return new T(); }; es-abstract-1.20.4/2018/ObjectDefineProperties.js000066400000000000000000000027441431761430200213440ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var Get = require('./Get'); var ToObject = require('./ToObject'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var forEach = require('../helpers/forEach'); var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $push = callBound('Array.prototype.push'); // https://262.ecma-international.org/6.0/#sec-objectdefineproperties module.exports = function ObjectDefineProperties(O, Properties) { var props = ToObject(Properties); // step 1 var keys = OwnPropertyKeys(props); // step 2 var descriptors = []; // step 3 forEach(keys, function (nextKey) { // step 4 var propDesc = ToPropertyDescriptor(getOwnPropertyDescriptor(props, nextKey)); // step 4.a if (typeof propDesc !== 'undefined' && propDesc['[[Enumerable]]']) { // step 4.b var descObj = Get(props, nextKey); // step 4.b.i var desc = ToPropertyDescriptor(descObj); // step 4.b.ii $push(descriptors, [nextKey, desc]); // step 4.b.iii } }); forEach(descriptors, function (pair) { // step 5 var P = pair[0]; // step 5.a var desc = pair[1]; // step 5.b desc = FromPropertyDescriptor(desc); // TODO: remove this once DefinePropertyOrThrow is fixed DefinePropertyOrThrow(O, P, desc); // step 5.c }); return O; // step 6 }; es-abstract-1.20.4/2018/OrdinaryCreateFromConstructor.js000066400000000000000000000014501431761430200227440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor'); var IsArray = require('./IsArray'); var ObjectCreate = require('./ObjectCreate'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarycreatefromconstructor module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto); var slots = arguments.length < 3 ? [] : arguments[2]; if (!IsArray(slots)) { throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List'); } return ObjectCreate(proto, slots); }; es-abstract-1.20.4/2018/OrdinaryDefineOwnProperty.js000066400000000000000000000045261431761430200221010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var Type = require('./Type'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!$gOPD) { // ES3/IE 8 fallback if (IsAccessorDescriptor(Desc)) { throw new $SyntaxError('This environment does not support accessor property descriptors.'); } var creatingNormalDataProperty = !(P in O) && Desc['[[Writable]]'] && Desc['[[Enumerable]]'] && Desc['[[Configurable]]'] && '[[Value]]' in Desc; var settingExistingDataProperty = (P in O) && (!('[[Configurable]]' in Desc) || Desc['[[Configurable]]']) && (!('[[Enumerable]]' in Desc) || Desc['[[Enumerable]]']) && (!('[[Writable]]' in Desc) || Desc['[[Writable]]']) && '[[Value]]' in Desc; if (creatingNormalDataProperty || settingExistingDataProperty) { O[P] = Desc['[[Value]]']; // eslint-disable-line no-param-reassign return SameValue(O[P], Desc['[[Value]]']); } throw new $SyntaxError('This environment does not support defining non-writable, non-enumerable, or non-configurable properties'); } var desc = $gOPD(O, P); var current = desc && ToPropertyDescriptor(desc); var extensible = IsExtensible(O); return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current); }; es-abstract-1.20.4/2018/OrdinaryGetOwnProperty.js000066400000000000000000000023511431761430200214200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var has = require('has'); var IsArray = require('./IsArray'); var IsPropertyKey = require('./IsPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty module.exports = function OrdinaryGetOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!has(O, P)) { return void 0; } if (!$gOPD) { // ES3 / IE 8 fallback var arrayLength = IsArray(O) && P === 'length'; var regexLastIndex = IsRegExp(O) && P === 'lastIndex'; return { '[[Configurable]]': !(arrayLength || regexLastIndex), '[[Enumerable]]': $isEnumerable(O, P), '[[Value]]': O[P], '[[Writable]]': true }; } return ToPropertyDescriptor($gOPD(O, P)); }; es-abstract-1.20.4/2018/OrdinaryGetPrototypeOf.js000066400000000000000000000010331431761430200213760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $getProto = require('../helpers/getProto'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarygetprototypeof module.exports = function OrdinaryGetPrototypeOf(O) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!$getProto) { throw new $TypeError('This environment does not support fetching prototypes.'); } return $getProto(O); }; es-abstract-1.20.4/2018/OrdinaryHasInstance.js000066400000000000000000000011631431761430200206500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance module.exports = function OrdinaryHasInstance(C, O) { if (IsCallable(C) === false) { return false; } if (Type(O) !== 'Object') { return false; } var P = Get(C, 'prototype'); if (Type(P) !== 'Object') { throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.'); } return O instanceof C; }; es-abstract-1.20.4/2018/OrdinaryHasProperty.js000066400000000000000000000010231431761430200207230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty module.exports = function OrdinaryHasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2018/OrdinarySetPrototypeOf.js000066400000000000000000000020321431761430200214120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $setProto = require('../helpers/setProto'); var OrdinaryGetPrototypeOf = require('./OrdinaryGetPrototypeOf'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarysetprototypeof module.exports = function OrdinarySetPrototypeOf(O, V) { if (Type(V) !== 'Object' && Type(V) !== 'Null') { throw new $TypeError('Assertion failed: V must be Object or Null'); } /* var extensible = IsExtensible(O); var current = OrdinaryGetPrototypeOf(O); if (SameValue(V, current)) { return true; } if (!extensible) { return false; } */ try { $setProto(O, V); } catch (e) { return false; } return OrdinaryGetPrototypeOf(O) === V; /* var p = V; var done = false; while (!done) { if (p === null) { done = true; } else if (SameValue(p, O)) { return false; } else { if (wat) { done = true; } else { p = p.[[Prototype]]; } } } O.[[Prototype]] = V; return true; */ }; es-abstract-1.20.4/2018/OrdinaryToPrimitive.js000066400000000000000000000020511431761430200207200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); var inspect = require('object-inspect'); // https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive module.exports = function OrdinaryToPrimitive(O, hint) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); } var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; for (var i = 0; i < methodNames.length; i += 1) { var name = methodNames[i]; var method = Get(O, name); if (IsCallable(method)) { var result = Call(method, O); if (Type(result) !== 'Object') { return result; } } } throw new $TypeError('No primitive value for ' + inspect(O)); }; es-abstract-1.20.4/2018/PromiseResolve.js000066400000000000000000000007111431761430200177140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBind = require('call-bind'); var $resolve = GetIntrinsic('%Promise.resolve%', true); var $PromiseResolve = $resolve && callBind($resolve); // https://262.ecma-international.org/9.0/#sec-promise-resolve module.exports = function PromiseResolve(C, x) { if (!$PromiseResolve) { throw new SyntaxError('This environment does not support Promises.'); } return $PromiseResolve(C, x); }; es-abstract-1.20.4/2018/QuoteJSONString.js000066400000000000000000000020631431761430200177160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var $strSplit = callBound('String.prototype.split'); var Type = require('./Type'); var UnicodeEscape = require('./UnicodeEscape'); var has = require('has'); // https://262.ecma-international.org/9.0/#sec-quotejsonstring var escapes = { '\u0008': '\\b', '\u0009': '\\t', '\u000A': '\\n', '\u000C': '\\f', '\u000D': '\\r', '\u0022': '\\"', '\u005c': '\\\\' }; module.exports = function QuoteJSONString(value) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `value` must be a String'); } var product = '"'; if (value) { forEach($strSplit(value), function (C) { if (has(escapes, C)) { product += escapes[C]; } else if ($charCodeAt(C, 0) < 0x20) { product += UnicodeEscape(C); } else { product += C; } }); } product += '"'; return product; }; es-abstract-1.20.4/2018/RegExpCreate.js000066400000000000000000000012031431761430200172510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RegExp = GetIntrinsic('%RegExp%'); // var RegExpAlloc = require('./RegExpAlloc'); // var RegExpInitialize = require('./RegExpInitialize'); var ToString = require('./ToString'); // https://262.ecma-international.org/6.0/#sec-regexpcreate module.exports = function RegExpCreate(P, F) { // var obj = RegExpAlloc($RegExp); // return RegExpInitialize(obj, P, F); // covers spec mechanics; bypass regex brand checking var pattern = typeof P === 'undefined' ? '' : ToString(P); var flags = typeof F === 'undefined' ? '' : ToString(F); return new $RegExp(pattern, flags); }; es-abstract-1.20.4/2018/RegExpExec.js000066400000000000000000000015671431761430200167470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var regexExec = require('call-bind/callBound')('RegExp.prototype.exec'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-regexpexec module.exports = function RegExpExec(R, S) { if (Type(R) !== 'Object') { throw new $TypeError('Assertion failed: `R` must be an Object'); } if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var exec = Get(R, 'exec'); if (IsCallable(exec)) { var result = Call(exec, R, [S]); if (result === null || Type(result) === 'Object') { return result; } throw new $TypeError('"exec" method must return `null` or an Object'); } return regexExec(R, S); }; es-abstract-1.20.4/2018/RequireObjectCoercible.js000066400000000000000000000001061431761430200213070ustar00rootroot00000000000000'use strict'; module.exports = require('../5/CheckObjectCoercible'); es-abstract-1.20.4/2018/SameValue.js000066400000000000000000000004631431761430200166240ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // http://262.ecma-international.org/5.1/#sec-9.12 module.exports = function SameValue(x, y) { if (x === y) { // 0 === -0, but they are not identical. if (x === 0) { return 1 / x === 1 / y; } return true; } return $isNaN(x) && $isNaN(y); }; es-abstract-1.20.4/2018/SameValueNonNumber.js000066400000000000000000000007021431761430200204440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); // https://262.ecma-international.org/7.0/#sec-samevaluenonnumber module.exports = function SameValueNonNumber(x, y) { if (typeof x === 'number' || typeof x !== typeof y) { throw new $TypeError('SameValueNonNumber requires two non-number values of the same type.'); } return SameValue(x, y); }; es-abstract-1.20.4/2018/SameValueZero.js000066400000000000000000000003371431761430200174640ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero module.exports = function SameValueZero(x, y) { return (x === y) || ($isNaN(x) && $isNaN(y)); }; es-abstract-1.20.4/2018/SecFromTime.js000066400000000000000000000006221431761430200171140ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var SecondsPerMinute = timeConstants.SecondsPerMinute; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function SecFromTime(t) { return modulo(floor(t / msPerSecond), SecondsPerMinute); }; es-abstract-1.20.4/2018/Set.js000066400000000000000000000023471431761430200155000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // IE 9 does not throw in strict mode when writability/configurability/extensibility is violated var noThrowOnStrictViolation = (function () { try { delete [].length; return true; } catch (e) { return false; } }()); // https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw module.exports = function Set(O, P, V, Throw) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (Type(Throw) !== 'Boolean') { throw new $TypeError('Assertion failed: `Throw` must be a Boolean'); } if (Throw) { O[P] = V; // eslint-disable-line no-param-reassign if (noThrowOnStrictViolation && !SameValue(O[P], V)) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; } try { O[P] = V; // eslint-disable-line no-param-reassign return noThrowOnStrictViolation ? SameValue(O[P], V) : true; } catch (e) { return false; } }; es-abstract-1.20.4/2018/SetFunctionLength.js000066400000000000000000000020271431761430200203430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var HasOwnProperty = require('./HasOwnProperty'); var IsExtensible = require('./IsExtensible'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-setfunctionlength module.exports = function SetFunctionLength(F, length) { if (typeof F !== 'function' || !IsExtensible(F) || HasOwnProperty(F, 'length')) { throw new $TypeError('Assertion failed: `F` must be an extensible function and lack an own `length` property'); } if (Type(length) !== 'Number') { throw new $TypeError('Assertion failed: `length` must be a Number'); } if (length < 0 || !IsInteger(length)) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0'); } return DefinePropertyOrThrow(F, 'length', { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); }; es-abstract-1.20.4/2018/SetFunctionName.js000066400000000000000000000025451431761430200200070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname module.exports = function SetFunctionName(F, name) { if (typeof F !== 'function') { throw new $TypeError('Assertion failed: `F` must be a function'); } if (!IsExtensible(F) || has(F, 'name')) { throw new $TypeError('Assertion failed: `F` must be extensible, and must not have a `name` own property'); } var nameType = Type(name); if (nameType !== 'Symbol' && nameType !== 'String') { throw new $TypeError('Assertion failed: `name` must be a Symbol or a String'); } if (nameType === 'Symbol') { var description = getSymbolDescription(name); // eslint-disable-next-line no-param-reassign name = typeof description === 'undefined' ? '' : '[' + description + ']'; } if (arguments.length > 2) { var prefix = arguments[2]; // eslint-disable-next-line no-param-reassign name = prefix + ' ' + name; } return DefinePropertyOrThrow(F, 'name', { '[[Value]]': name, '[[Writable]]': false, '[[Enumerable]]': false, '[[Configurable]]': true }); }; es-abstract-1.20.4/2018/SetIntegrityLevel.js000066400000000000000000000035061431761430200203650ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var forEach = require('../helpers/forEach'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel module.exports = function SetIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } if (!$preventExtensions) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.preventExtensions` support'); } var status = $preventExtensions(O); if (!status) { return false; } if (!$gOPN) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support'); } var theKeys = $gOPN(O); if (level === 'sealed') { forEach(theKeys, function (k) { DefinePropertyOrThrow(O, k, { configurable: false }); }); } else if (level === 'frozen') { forEach(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { var desc; if (IsAccessorDescriptor(ToPropertyDescriptor(currentDesc))) { desc = { configurable: false }; } else { desc = { configurable: false, writable: false }; } DefinePropertyOrThrow(O, k, desc); } }); } return true; }; es-abstract-1.20.4/2018/SpeciesConstructor.js000066400000000000000000000015141431761430200206010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor module.exports = function SpeciesConstructor(O, defaultConstructor) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var C = O.constructor; if (typeof C === 'undefined') { return defaultConstructor; } if (Type(C) !== 'Object') { throw new $TypeError('O.constructor is not an Object'); } var S = $species ? C[$species] : void 0; if (S == null) { return defaultConstructor; } if (IsConstructor(S)) { return S; } throw new $TypeError('no constructor found'); }; es-abstract-1.20.4/2018/SplitMatch.js000066400000000000000000000015521431761430200170120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var $charAt = callBound('String.prototype.charAt'); // https://262.ecma-international.org/6.0/#sec-splitmatch module.exports = function SplitMatch(S, q, R) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(q)) { throw new $TypeError('Assertion failed: `q` must be an integer'); } if (Type(R) !== 'String') { throw new $TypeError('Assertion failed: `R` must be a String'); } var r = R.length; var s = S.length; if (q + r > s) { return false; } for (var i = 0; i < r; i += 1) { if ($charAt(S, q + i) !== $charAt(R, i)) { return false; } } return q + r; }; es-abstract-1.20.4/2018/StrictEqualityComparison.js000066400000000000000000000005511431761430200217610ustar00rootroot00000000000000'use strict'; var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.9.6 module.exports = function StrictEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType !== yType) { return false; } if (xType === 'Undefined' || xType === 'Null') { return true; } return x === y; // shortcut for steps 4-7 }; es-abstract-1.20.4/2018/StringCreate.js000066400000000000000000000021351431761430200173320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var $StringPrototype = GetIntrinsic('%String.prototype%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var Type = require('./Type'); var setProto = require('../helpers/setProto'); // https://262.ecma-international.org/6.0/#sec-stringcreate module.exports = function StringCreate(value, prototype) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var S = $Object(value); if (prototype !== $StringPrototype) { if (setProto) { setProto(S, prototype); } else { throw new $SyntaxError('StringCreate: a `proto` argument that is not `String.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } } var length = value.length; DefinePropertyOrThrow(S, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); return S; }; es-abstract-1.20.4/2018/StringGetOwnProperty.js000066400000000000000000000025461431761430200211050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charAt = callBound('String.prototype.charAt'); var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsInteger = require('./IsInteger'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); var isNegativeZero = require('is-negative-zero'); // https://262.ecma-international.org/8.0/#sec-stringgetownproperty module.exports = function StringGetOwnProperty(S, P) { var str; if (Type(S) === 'Object') { try { str = $stringToString(S); } catch (e) { /**/ } } if (Type(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 (Type(P) !== 'String') { return void undefined; } var index = CanonicalNumericIndexString(P); var len = str.length; if (typeof index === 'undefined' || !IsInteger(index) || isNegativeZero(index) || index < 0 || len <= index) { return void undefined; } var resultStr = $charAt(S, index); return { '[[Configurable]]': false, '[[Enumerable]]': true, '[[Value]]': resultStr, '[[Writable]]': false }; }; es-abstract-1.20.4/2018/SymbolDescriptiveString.js000066400000000000000000000010161431761430200215730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $SymbolToString = callBound('Symbol.prototype.toString', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring module.exports = function SymbolDescriptiveString(sym) { if (Type(sym) !== 'Symbol') { throw new $TypeError('Assertion failed: `sym` must be a Symbol'); } return $SymbolToString(sym); }; es-abstract-1.20.4/2018/TestIntegrityLevel.js000066400000000000000000000024051431761430200205460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var every = require('../helpers/every'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel module.exports = function TestIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } var status = IsExtensible(O); if (status) { return false; } var theKeys = OwnPropertyKeys(O); return theKeys.length === 0 || every(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { if (currentDesc.configurable) { return false; } if (level === 'frozen' && IsDataDescriptor(ToPropertyDescriptor(currentDesc)) && currentDesc.writable) { return false; } } return true; }); }; es-abstract-1.20.4/2018/TimeClip.js000066400000000000000000000007241431761430200164500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var $Number = GetIntrinsic('%Number%'); var $isFinite = require('../helpers/isFinite'); var abs = require('./abs'); var ToNumber = require('./ToNumber'); // https://262.ecma-international.org/5.1/#sec-15.9.1.14 module.exports = function TimeClip(time) { if (!$isFinite(time) || abs(time) > 8.64e15) { return NaN; } return $Number(new $Date(ToNumber(time))); }; es-abstract-1.20.4/2018/TimeFromYear.js000066400000000000000000000004051431761430200173010ustar00rootroot00000000000000'use strict'; var msPerDay = require('../helpers/timeConstants').msPerDay; var DayFromYear = require('./DayFromYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function TimeFromYear(y) { return msPerDay * DayFromYear(y); }; es-abstract-1.20.4/2018/TimeString.js000066400000000000000000000014501431761430200170240ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var padTimeComponent = require('../helpers/padTimeComponent'); var HourFromTime = require('./HourFromTime'); var MinFromTime = require('./MinFromTime'); var SecFromTime = require('./SecFromTime'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-timestring module.exports = function TimeString(tv) { if (Type(tv) !== 'Number' || $isNaN(tv)) { throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); } var hour = HourFromTime(tv); var minute = MinFromTime(tv); var second = SecFromTime(tv); return padTimeComponent(hour) + ':' + padTimeComponent(minute) + ':' + padTimeComponent(second) + '\x20GMT'; }; es-abstract-1.20.4/2018/TimeWithinDay.js000066400000000000000000000003671431761430200174640ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function TimeWithinDay(t) { return modulo(t, msPerDay); }; es-abstract-1.20.4/2018/ToBoolean.js000066400000000000000000000002021431761430200166130ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.2 module.exports = function ToBoolean(value) { return !!value; }; es-abstract-1.20.4/2018/ToDateString.js000066400000000000000000000007621431761430200173130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Date = GetIntrinsic('%Date%'); var $isNaN = require('../helpers/isNaN'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-todatestring module.exports = function ToDateString(tv) { if (Type(tv) !== 'Number') { throw new $TypeError('Assertion failed: `tv` must be a Number'); } if ($isNaN(tv)) { return 'Invalid Date'; } return $Date(tv); }; es-abstract-1.20.4/2018/ToIndex.js000066400000000000000000000012341431761430200163110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var ToInteger = require('./ToInteger'); var ToLength = require('./ToLength'); var SameValueZero = require('./SameValueZero'); // https://262.ecma-international.org/8.0/#sec-toindex module.exports = function ToIndex(value) { if (typeof value === 'undefined') { return 0; } var integerIndex = ToInteger(value); if (integerIndex < 0) { throw new $RangeError('index must be >= 0'); } var index = ToLength(integerIndex); if (!SameValueZero(integerIndex, index)) { throw new $RangeError('index must be >= 0 and < 2 ** 53 - 1'); } return index; }; es-abstract-1.20.4/2018/ToInt16.js000066400000000000000000000004041431761430200161410ustar00rootroot00000000000000'use strict'; var ToUint16 = require('./ToUint16'); // https://ecma-international.org/ecma-262/6.0/#sec-toint16 module.exports = function ToInt16(argument) { var int16bit = ToUint16(argument); return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit; }; es-abstract-1.20.4/2018/ToInt32.js000066400000000000000000000002551431761430200161430ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.5 module.exports = function ToInt32(x) { return ToNumber(x) >> 0; }; es-abstract-1.20.4/2018/ToInt8.js000066400000000000000000000003671431761430200160720ustar00rootroot00000000000000'use strict'; var ToUint8 = require('./ToUint8'); // https://ecma-international.org/ecma-262/6.0/#sec-toint8 module.exports = function ToInt8(argument) { var int8bit = ToUint8(argument); return int8bit >= 0x80 ? int8bit - 0x100 : int8bit; }; es-abstract-1.20.4/2018/ToInteger.js000066400000000000000000000004211431761430200166340ustar00rootroot00000000000000'use strict'; var ES5ToInteger = require('../5/ToInteger'); var ToNumber = require('./ToNumber'); // https://ecma-international.org/ecma-262/6.0/#sec-tointeger module.exports = function ToInteger(value) { var number = ToNumber(value); return ES5ToInteger(number); }; es-abstract-1.20.4/2018/ToLength.js000066400000000000000000000005141431761430200164630ustar00rootroot00000000000000'use strict'; var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var ToInteger = require('./ToInteger'); module.exports = function ToLength(argument) { var len = ToInteger(argument); if (len <= 0) { return 0; } // includes converting -0 to +0 if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } return len; }; es-abstract-1.20.4/2018/ToNumber.js000066400000000000000000000037301431761430200164750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Number = GetIntrinsic('%Number%'); var $RegExp = GetIntrinsic('%RegExp%'); var $parseInteger = GetIntrinsic('%parseInt%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var isPrimitive = require('../helpers/isPrimitive'); var $strSlice = callBound('String.prototype.slice'); var isBinary = regexTester(/^0b[01]+$/i); var isOctal = regexTester(/^0o[0-7]+$/i); var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i); var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); var hasNonWS = regexTester(nonWSregex); // whitespace from: https://es5.github.io/#x15.5.4.20 // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324 var ws = [ '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003', '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028', '\u2029\uFEFF' ].join(''); var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); var $replace = callBound('String.prototype.replace'); var $trim = function (value) { return $replace(value, trimRegex, ''); }; var ToPrimitive = require('./ToPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-tonumber module.exports = function ToNumber(argument) { var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (typeof value === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a number'); } if (typeof value === 'string') { if (isBinary(value)) { return ToNumber($parseInteger($strSlice(value, 2), 2)); } else if (isOctal(value)) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; } var trimmed = $trim(value); if (trimmed !== value) { return ToNumber(trimmed); } } return $Number(value); }; es-abstract-1.20.4/2018/ToObject.js000066400000000000000000000005161431761430200164520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); // https://ecma-international.org/ecma-262/6.0/#sec-toobject module.exports = function ToObject(value) { RequireObjectCoercible(value); return $Object(value); }; es-abstract-1.20.4/2018/ToPrimitive.js000066400000000000000000000004371431761430200172160ustar00rootroot00000000000000'use strict'; var toPrimitive = require('es-to-primitive/es2015'); // https://ecma-international.org/ecma-262/6.0/#sec-toprimitive module.exports = function ToPrimitive(input) { if (arguments.length > 1) { return toPrimitive(input, arguments[1]); } return toPrimitive(input); }; es-abstract-1.20.4/2018/ToPropertyDescriptor.js000066400000000000000000000026541431761430200211340ustar00rootroot00000000000000'use strict'; var has = require('has'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var ToBoolean = require('./ToBoolean'); var IsCallable = require('./IsCallable'); // https://262.ecma-international.org/5.1/#sec-8.10.5 module.exports = function ToPropertyDescriptor(Obj) { if (Type(Obj) !== 'Object') { throw new $TypeError('ToPropertyDescriptor requires an object'); } var desc = {}; if (has(Obj, 'enumerable')) { desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable); } if (has(Obj, 'configurable')) { desc['[[Configurable]]'] = ToBoolean(Obj.configurable); } if (has(Obj, 'value')) { desc['[[Value]]'] = Obj.value; } if (has(Obj, 'writable')) { desc['[[Writable]]'] = ToBoolean(Obj.writable); } if (has(Obj, 'get')) { var getter = Obj.get; if (typeof getter !== 'undefined' && !IsCallable(getter)) { throw new $TypeError('getter must be a function'); } desc['[[Get]]'] = getter; } if (has(Obj, 'set')) { var setter = Obj.set; if (typeof setter !== 'undefined' && !IsCallable(setter)) { throw new $TypeError('setter must be a function'); } desc['[[Set]]'] = setter; } if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); } return desc; }; es-abstract-1.20.4/2018/ToPropertyKey.js000066400000000000000000000006251431761430200175420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var ToPrimitive = require('./ToPrimitive'); var ToString = require('./ToString'); // https://ecma-international.org/ecma-262/6.0/#sec-topropertykey module.exports = function ToPropertyKey(argument) { var key = ToPrimitive(argument, $String); return typeof key === 'symbol' ? key : ToString(key); }; es-abstract-1.20.4/2018/ToString.js000066400000000000000000000006141431761430200165110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); // https://ecma-international.org/ecma-262/6.0/#sec-tostring module.exports = function ToString(argument) { if (typeof argument === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a string'); } return $String(argument); }; es-abstract-1.20.4/2018/ToUint16.js000066400000000000000000000010641431761430200163310ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // http://262.ecma-international.org/5.1/#sec-9.7 module.exports = function ToUint16(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x10000); }; es-abstract-1.20.4/2018/ToUint32.js000066400000000000000000000002571431761430200163320ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.6 module.exports = function ToUint32(x) { return ToNumber(x) >>> 0; }; es-abstract-1.20.4/2018/ToUint8.js000066400000000000000000000011021431761430200162430ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8 module.exports = function ToUint8(argument) { var number = ToNumber(argument); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x100); }; es-abstract-1.20.4/2018/ToUint8Clamp.js000066400000000000000000000010121431761430200172200ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp module.exports = function ToUint8Clamp(argument) { var number = ToNumber(argument); if ($isNaN(number) || number <= 0) { return 0; } if (number >= 0xFF) { return 0xFF; } var f = floor(argument); if (f + 0.5 < number) { return f + 1; } if (number < f + 0.5) { return f; } if (f % 2 !== 0) { return f + 1; } return f; }; es-abstract-1.20.4/2018/Type.js000066400000000000000000000003711431761430200156610ustar00rootroot00000000000000'use strict'; var ES5Type = require('../5/Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ecmascript-data-types-and-values module.exports = function Type(x) { if (typeof x === 'symbol') { return 'Symbol'; } return ES5Type(x); }; es-abstract-1.20.4/2018/UTF16Decode.js000066400000000000000000000014671431761430200166600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); // https://262.ecma-international.org/7.0/#sec-utf16decode var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); // https://262.ecma-international.org/11.0/#sec-utf16decodesurrogatepair module.exports = function UTF16Decode(lead, trail) { if (!isLeadingSurrogate(lead) || !isTrailingSurrogate(trail)) { throw new $TypeError('Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code'); } // var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; return $fromCharCode(lead) + $fromCharCode(trail); }; es-abstract-1.20.4/2018/UTF16Encoding.js000066400000000000000000000012741431761430200172170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var floor = require('./floor'); var modulo = require('./modulo'); var isCodePoint = require('../helpers/isCodePoint'); // https://262.ecma-international.org/7.0/#sec-utf16encoding module.exports = function UTF16Encoding(cp) { if (!isCodePoint(cp)) { throw new $TypeError('Assertion failed: `cp` must be >= 0 and <= 0x10FFFF'); } if (cp <= 65535) { return $fromCharCode(cp); } var cu1 = floor((cp - 65536) / 1024) + 0xD800; var cu2 = modulo(cp - 65536, 1024) + 0xDC00; return $fromCharCode(cu1) + $fromCharCode(cu2); }; es-abstract-1.20.4/2018/UnicodeEscape.js000066400000000000000000000015161431761430200174510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var $numberToString = callBound('Number.prototype.toString'); var $toLowerCase = callBound('String.prototype.toLowerCase'); var $strSlice = callBound('String.prototype.slice'); // https://262.ecma-international.org/9.0/#sec-unicodeescape module.exports = function UnicodeEscape(C) { if (typeof C !== 'string' || C.length !== 1) { throw new $TypeError('Assertion failed: `C` must be a single code unit'); } var n = $charCodeAt(C, 0); if (n > 0xFFFF) { throw new $TypeError('`Assertion failed: numeric value of `C` must be <= 0xFFFF'); } return '\\u' + $strSlice('0000' + $toLowerCase($numberToString(n, 16)), -4); }; es-abstract-1.20.4/2018/ValidateAndApplyPropertyDescriptor.js000066400000000000000000000121731431761430200237310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var isSamePropertyDescriptor = require('../helpers/isSamePropertyDescriptor'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-validateandapplypropertydescriptor // https://ecma-international.org/ecma-262/8.0/#sec-validateandapplypropertydescriptor // eslint-disable-next-line max-lines-per-function, max-statements, max-params module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) { // this uses the ES2017+ logic, since it fixes a number of bugs in the ES2015 logic. var oType = Type(O); if (oType !== 'Undefined' && oType !== 'Object') { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } if (Type(extensible) !== 'Boolean') { throw new $TypeError('Assertion failed: extensible must be a Boolean'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (Type(current) !== 'Undefined' && !isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } if (oType !== 'Undefined' && !IsPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (Type(current) === 'Undefined') { if (!extensible) { return false; } if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': Desc['[[Configurable]]'], '[[Enumerable]]': Desc['[[Enumerable]]'], '[[Value]]': Desc['[[Value]]'], '[[Writable]]': Desc['[[Writable]]'] } ); } } else { if (!IsAccessorDescriptor(Desc)) { throw new $TypeError('Assertion failed: Desc is not an accessor descriptor'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } } return true; } if (IsGenericDescriptor(Desc) && !('[[Configurable]]' in Desc) && !('[[Enumerable]]' in Desc)) { return true; } if (isSamePropertyDescriptor({ SameValue: SameValue }, Desc, current)) { return true; // removed by ES2017, but should still be correct } // "if every field in Desc is absent, return true" can't really match the assertion that it's a Property Descriptor if (!current['[[Configurable]]']) { if (Desc['[[Configurable]]']) { return false; } if ('[[Enumerable]]' in Desc && !Desc['[[Enumerable]]'] === !!current['[[Enumerable]]']) { return false; } } if (IsGenericDescriptor(Desc)) { // no further validation is required. } else if (IsDataDescriptor(current) !== IsDataDescriptor(Desc)) { if (!current['[[Configurable]]']) { return false; } if (IsDataDescriptor(current)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Get]]': undefined } ); } } else if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Value]]': undefined } ); } } else if (IsDataDescriptor(current) && IsDataDescriptor(Desc)) { if (!current['[[Configurable]]'] && !current['[[Writable]]']) { if ('[[Writable]]' in Desc && Desc['[[Writable]]']) { return false; } if ('[[Value]]' in Desc && !SameValue(Desc['[[Value]]'], current['[[Value]]'])) { return false; } return true; } } else if (IsAccessorDescriptor(current) && IsAccessorDescriptor(Desc)) { if (!current['[[Configurable]]']) { if ('[[Set]]' in Desc && !SameValue(Desc['[[Set]]'], current['[[Set]]'])) { return false; } if ('[[Get]]' in Desc && !SameValue(Desc['[[Get]]'], current['[[Get]]'])) { return false; } return true; } } else { throw new $TypeError('Assertion failed: current and Desc are not both data, both accessors, or one accessor and one data.'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } return true; }; es-abstract-1.20.4/2018/WeekDay.js000066400000000000000000000003201431761430200162630ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.6 module.exports = function WeekDay(t) { return modulo(Day(t) + 4, 7); }; es-abstract-1.20.4/2018/YearFromTime.js000066400000000000000000000006271431761430200173070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var callBound = require('call-bind/callBound'); var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function YearFromTime(t) { // largest y such that this.TimeFromYear(y) <= t return $getUTCFullYear(new $Date(t)); }; es-abstract-1.20.4/2018/abs.js000066400000000000000000000003171431761430200155050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $abs = GetIntrinsic('%Math.abs%'); // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function abs(x) { return $abs(x); }; es-abstract-1.20.4/2018/floor.js000066400000000000000000000003311431761430200160550ustar00rootroot00000000000000'use strict'; // var modulo = require('./modulo'); var $floor = Math.floor; // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function floor(x) { // return x - modulo(x, 1); return $floor(x); }; es-abstract-1.20.4/2018/modulo.js000066400000000000000000000002501431761430200162330ustar00rootroot00000000000000'use strict'; var mod = require('../helpers/mod'); // https://262.ecma-international.org/5.1/#sec-5.2 module.exports = function modulo(x, y) { return mod(x, y); }; es-abstract-1.20.4/2018/msFromTime.js000066400000000000000000000003751431761430200170260ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerSecond = require('../helpers/timeConstants').msPerSecond; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function msFromTime(t) { return modulo(t, msPerSecond); }; es-abstract-1.20.4/2018/thisBooleanValue.js000066400000000000000000000005571431761430200202120ustar00rootroot00000000000000'use strict'; var $BooleanValueOf = require('call-bind/callBound')('Boolean.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-boolean-prototype-object module.exports = function thisBooleanValue(value) { if (Type(value) === 'Boolean') { return value; } return $BooleanValueOf(value); }; es-abstract-1.20.4/2018/thisNumberValue.js000066400000000000000000000006061431761430200200560ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var Type = require('./Type'); var $NumberValueOf = callBound('Number.prototype.valueOf'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object module.exports = function thisNumberValue(value) { if (Type(value) === 'Number') { return value; } return $NumberValueOf(value); }; es-abstract-1.20.4/2018/thisStringValue.js000066400000000000000000000005511431761430200200730ustar00rootroot00000000000000'use strict'; var $StringValueOf = require('call-bind/callBound')('String.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object module.exports = function thisStringValue(value) { if (Type(value) === 'String') { return value; } return $StringValueOf(value); }; es-abstract-1.20.4/2018/thisSymbolValue.js000066400000000000000000000010021431761430200200620ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-thissymbolvalue module.exports = function thisSymbolValue(value) { if (!$SymbolValueOf) { throw new SyntaxError('Symbols are not supported; thisSymbolValue requires that `value` be a Symbol or a Symbol object'); } if (Type(value) === 'Symbol') { return value; } return $SymbolValueOf(value); }; es-abstract-1.20.4/2018/thisTimeValue.js000066400000000000000000000004131431761430200175200ustar00rootroot00000000000000'use strict'; var $DateGetTime = require('call-bind/callBound')('Date.prototype.getTime'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-date-prototype-object module.exports = function thisTimeValue(value) { return $DateGetTime(value); }; es-abstract-1.20.4/2019/000077500000000000000000000000001431761430200144025ustar00rootroot00000000000000es-abstract-1.20.4/2019/AbstractEqualityComparison.js000066400000000000000000000022021431761430200222500ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison module.exports = function AbstractEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType === yType) { return x === y; // ES6+ specified this shortcut anyways. } if (x == null && y == null) { return true; } if (xType === 'Number' && yType === 'String') { return AbstractEqualityComparison(x, ToNumber(y)); } if (xType === 'String' && yType === 'Number') { return AbstractEqualityComparison(ToNumber(x), y); } if (xType === 'Boolean') { return AbstractEqualityComparison(ToNumber(x), y); } if (yType === 'Boolean') { return AbstractEqualityComparison(x, ToNumber(y)); } if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') { return AbstractEqualityComparison(x, ToPrimitive(y)); } if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) { return AbstractEqualityComparison(ToPrimitive(x), y); } return false; }; es-abstract-1.20.4/2019/AbstractRelationalComparison.js000066400000000000000000000027751431761430200225640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var IsStringPrefix = require('./IsStringPrefix'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); } var px; var py; if (LeftFirst) { px = ToPrimitive(x, $Number); py = ToPrimitive(y, $Number); } else { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } if (Type(px) === 'String' && Type(py) === 'String') { if (IsStringPrefix(py, px)) { return false; } if (IsStringPrefix(px, py)) { return true; } return px < py; // both strings, neither a prefix of the other. shortcut for steps 3 c-f } var nx = ToNumber(px); var ny = ToNumber(py); if ($isNaN(nx) || $isNaN(ny)) { return undefined; } if ($isFinite(nx) && $isFinite(ny) && nx === ny) { return false; } if (nx === Infinity) { return false; } if (ny === Infinity) { return true; } if (ny === -Infinity) { return false; } if (nx === -Infinity) { return true; } return nx < ny; // by now, these are both nonzero, finite, and not equal }; es-abstract-1.20.4/2019/AddEntriesFromIterable.js000066400000000000000000000027571431761430200212710ustar00rootroot00000000000000'use strict'; var inspect = require('object-inspect'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var GetIterator = require('./GetIterator'); var IsCallable = require('./IsCallable'); var IteratorClose = require('./IteratorClose'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); var Type = require('./Type'); // https://262.ecma-international.org/10.0//#sec-add-entries-from-iterable module.exports = function AddEntriesFromIterable(target, iterable, adder) { if (!IsCallable(adder)) { throw new $TypeError('Assertion failed: `adder` is not callable'); } if (iterable == null) { throw new $TypeError('Assertion failed: `iterable` is present, and not nullish'); } var iteratorRecord = GetIterator(iterable); while (true) { // eslint-disable-line no-constant-condition var next = IteratorStep(iteratorRecord); if (!next) { return target; } var nextItem = IteratorValue(next); if (Type(nextItem) !== 'Object') { var error = new $TypeError('iterator next must return an Object, got ' + inspect(nextItem)); return IteratorClose( iteratorRecord, function () { throw error; } // eslint-disable-line no-loop-func ); } try { var k = Get(nextItem, '0'); var v = Get(nextItem, '1'); Call(adder, target, [k, v]); } catch (e) { return IteratorClose( iteratorRecord, function () { throw e; } ); } } }; es-abstract-1.20.4/2019/AdvanceStringIndex.js000066400000000000000000000024311431761430200204600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = require('call-bind/callBound')('String.prototype.charCodeAt'); // https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex module.exports = function AdvanceStringIndex(S, index, unicode) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53'); } if (Type(unicode) !== 'Boolean') { throw new $TypeError('Assertion failed: `unicode` must be a Boolean'); } if (!unicode) { return index + 1; } var length = S.length; if ((index + 1) >= length) { return index + 1; } var first = $charCodeAt(S, index); if (!isLeadingSurrogate(first)) { return index + 1; } var second = $charCodeAt(S, index + 1); if (!isTrailingSurrogate(second)) { return index + 1; } return index + 2; }; es-abstract-1.20.4/2019/ArrayCreate.js000066400000000000000000000031621431761430200171440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ArrayPrototype = GetIntrinsic('%Array.prototype%'); var $RangeError = GetIntrinsic('%RangeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || ( // eslint-disable-next-line no-proto, no-negated-condition [].__proto__ !== $ArrayPrototype ? null : function (O, proto) { O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign return O; } ); // https://ecma-international.org/ecma-262/6.0/#sec-arraycreate module.exports = function ArrayCreate(length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0'); } if (length > MAX_ARRAY_LENGTH) { throw new $RangeError('length is greater than (2**32 - 1)'); } var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype; var A = []; // steps 5 - 7, and 9 if (proto !== $ArrayPrototype) { // step 8 if (!$setProto) { throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } $setProto(A, proto); } if (length !== 0) { // bypasses the need for step 2 A.length = length; } /* step 10, the above as a shortcut for the below OrdinaryDefineOwnProperty(A, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': true }); */ return A; }; es-abstract-1.20.4/2019/ArraySetLength.js000066400000000000000000000051511431761430200176360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var assign = require('object.assign'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsArray = require('./IsArray'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function ArraySetLength(A, Desc) { if (!IsArray(A)) { throw new $TypeError('Assertion failed: A must be an Array'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!('[[Value]]' in Desc)) { return OrdinaryDefineOwnProperty(A, 'length', Desc); } var newLenDesc = assign({}, Desc); var newLen = ToUint32(Desc['[[Value]]']); var numberLen = ToNumber(Desc['[[Value]]']); if (newLen !== numberLen) { throw new $RangeError('Invalid array length'); } newLenDesc['[[Value]]'] = newLen; var oldLenDesc = OrdinaryGetOwnProperty(A, 'length'); if (!IsDataDescriptor(oldLenDesc)) { throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`'); } var oldLen = oldLenDesc['[[Value]]']; if (newLen >= oldLen) { return OrdinaryDefineOwnProperty(A, 'length', newLenDesc); } if (!oldLenDesc['[[Writable]]']) { return false; } var newWritable; if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) { newWritable = true; } else { newWritable = false; newLenDesc['[[Writable]]'] = true; } var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc); if (!succeeded) { return false; } while (newLen < oldLen) { oldLen -= 1; // eslint-disable-next-line no-param-reassign var deleteSucceeded = delete A[ToString(oldLen)]; if (!deleteSucceeded) { newLenDesc['[[Value]]'] = oldLen + 1; if (!newWritable) { newLenDesc['[[Writable]]'] = false; OrdinaryDefineOwnProperty(A, 'length', newLenDesc); return false; } } } if (!newWritable) { return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false }); } return true; }; es-abstract-1.20.4/2019/ArraySpeciesCreate.js000066400000000000000000000025041431761430200204570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Array = GetIntrinsic('%Array%'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsConstructor = require('./IsConstructor'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate module.exports = function ArraySpeciesCreate(originalArray, length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: length must be an integer >= 0'); } var len = length === 0 ? 0 : length; var C; var isArray = IsArray(originalArray); if (isArray) { C = Get(originalArray, 'constructor'); // TODO: figure out how to make a cross-realm normal Array, a same-realm Array // if (IsConstructor(C)) { // if C is another realm's Array, C = undefined // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ? // } if ($species && Type(C) === 'Object') { C = Get(C, $species); if (C === null) { C = void 0; } } } if (typeof C === 'undefined') { return $Array(len); } if (!IsConstructor(C)) { throw new $TypeError('C must be a constructor'); } return new C(len); // Construct(C, len); }; es-abstract-1.20.4/2019/Call.js000066400000000000000000000011571431761430200156170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsArray = require('./IsArray'); var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%'); // https://ecma-international.org/ecma-262/6.0/#sec-call module.exports = function Call(F, V) { var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } return $apply(F, V, argumentsList); }; es-abstract-1.20.4/2019/CanonicalNumericIndexString.js000066400000000000000000000012161431761430200223310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring module.exports = function CanonicalNumericIndexString(argument) { if (Type(argument) !== 'String') { throw new $TypeError('Assertion failed: `argument` must be a String'); } if (argument === '-0') { return -0; } var n = ToNumber(argument); if (SameValue(ToString(n), argument)) { return n; } return void 0; }; es-abstract-1.20.4/2019/CharacterRange.js000066400000000000000000000014161431761430200176130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = callBound('%String.prototype.charCodeAt%'); var $push = callBound('%Array.prototype.push%'); module.exports = function CharacterRange(A, B) { if (A.length !== 1 || B.length !== 1) { throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); } var a = A[0]; var b = B[0]; var i = $charCodeAt(a, 0); var j = $charCodeAt(b, 0); if (!(i <= j)) { throw new $TypeError('Assertion failed: i is not <= j'); } var arr = []; for (var k = i; k <= j; k += 1) { $push(arr, $fromCharCode(k)); } return arr; }; es-abstract-1.20.4/2019/CompletePropertyDescriptor.js000066400000000000000000000017351431761430200223220ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor module.exports = function CompletePropertyDescriptor(Desc) { /* eslint no-param-reassign: 0 */ assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (!has(Desc, '[[Value]]')) { Desc['[[Value]]'] = void 0; } if (!has(Desc, '[[Writable]]')) { Desc['[[Writable]]'] = false; } } else { if (!has(Desc, '[[Get]]')) { Desc['[[Get]]'] = void 0; } if (!has(Desc, '[[Set]]')) { Desc['[[Set]]'] = void 0; } } if (!has(Desc, '[[Enumerable]]')) { Desc['[[Enumerable]]'] = false; } if (!has(Desc, '[[Configurable]]')) { Desc['[[Configurable]]'] = false; } return Desc; }; es-abstract-1.20.4/2019/CopyDataProperties.js000066400000000000000000000037101431761430200205220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var CreateDataProperty = require('./CreateDataProperty'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-copydataproperties module.exports = function CopyDataProperties(target, source, excludedItems) { if (Type(target) !== 'Object') { throw new $TypeError('Assertion failed: "target" must be an Object'); } if (!IsArray(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])) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } } if (typeof source === 'undefined' || source === null) { return target; } var fromObj = ToObject(source); var sourceKeys = OwnPropertyKeys(fromObj); forEach(sourceKeys, function (nextKey) { var excluded = false; forEach(excludedItems, function (e) { if (SameValue(e, nextKey) === true) { excluded = true; } }); var enumerable = $isEnumerable(fromObj, nextKey) || ( // this is to handle string keys being non-enumerable in older engines typeof source === 'string' && nextKey >= 0 && IsInteger(ToNumber(nextKey)) ); if (excluded === false && enumerable) { var propValue = Get(fromObj, nextKey); CreateDataProperty(target, nextKey, propValue); } }); return target; }; es-abstract-1.20.4/2019/CreateDataProperty.js000066400000000000000000000023771431761430200205130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty module.exports = function CreateDataProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var oldDesc = OrdinaryGetOwnProperty(O, P); var extensible = !oldDesc || IsExtensible(O); var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]']; if (nonConfigurable || !extensible) { return false; } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Value]]': V, '[[Writable]]': true } ); }; es-abstract-1.20.4/2019/CreateDataPropertyOrThrow.js000066400000000000000000000013361431761430200220320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var CreateDataProperty = require('./CreateDataProperty'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var success = CreateDataProperty(O, P, V); if (!success) { throw new $TypeError('unable to create data property'); } return success; }; es-abstract-1.20.4/2019/CreateHTML.js000066400000000000000000000016371431761430200166370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $replace = callBound('String.prototype.replace'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createhtml module.exports = function CreateHTML(string, tag, attribute, value) { if (Type(tag) !== 'String' || Type(attribute) !== 'String') { throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings'); } var str = RequireObjectCoercible(string); var S = ToString(str); var p1 = '<' + tag; if (attribute !== '') { var V = ToString(value); var escapedV = $replace(V, /\x22/g, '"'); p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22'; } return p1 + '>' + S + ''; }; es-abstract-1.20.4/2019/CreateIterResultObject.js000066400000000000000000000006601431761430200213170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject module.exports = function CreateIterResultObject(value, done) { if (Type(done) !== 'Boolean') { throw new $TypeError('Assertion failed: Type(done) is not Boolean'); } return { value: value, done: done }; }; es-abstract-1.20.4/2019/CreateListFromArrayLike.js000066400000000000000000000025121431761430200214270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $indexOf = callBound('Array.prototype.indexOf', true) || callBound('String.prototype.indexOf'); var $push = callBound('Array.prototype.push'); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createlistfromarraylike module.exports = function CreateListFromArrayLike(obj) { var elementTypes = arguments.length > 1 ? arguments[1] : ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object']; if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } if (!IsArray(elementTypes)) { throw new $TypeError('Assertion failed: `elementTypes`, if provided, must be an array'); } var len = ToLength(Get(obj, 'length')); var list = []; var index = 0; while (index < len) { var indexName = ToString(index); var next = Get(obj, indexName); var nextType = Type(next); if ($indexOf(elementTypes, nextType) < 0) { throw new $TypeError('item type ' + nextType + ' is not a valid elementType'); } $push(list, next); index += 1; } return list; }; es-abstract-1.20.4/2019/CreateMethodProperty.js000066400000000000000000000017231431761430200210540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty module.exports = function CreateMethodProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var newDesc = { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': V, '[[Writable]]': true }; return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, newDesc ); }; es-abstract-1.20.4/2019/DateFromTime.js000066400000000000000000000020141431761430200172550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); var MonthFromTime = require('./MonthFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.5 module.exports = function DateFromTime(t) { var m = MonthFromTime(t); var d = DayWithinYear(t); if (m === 0) { return d + 1; } if (m === 1) { return d - 30; } var leap = InLeapYear(t); if (m === 2) { return d - 58 - leap; } if (m === 3) { return d - 89 - leap; } if (m === 4) { return d - 119 - leap; } if (m === 5) { return d - 150 - leap; } if (m === 6) { return d - 180 - leap; } if (m === 7) { return d - 211 - leap; } if (m === 8) { return d - 242 - leap; } if (m === 9) { return d - 272 - leap; } if (m === 10) { return d - 303 - leap; } if (m === 11) { return d - 333 - leap; } throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m); }; es-abstract-1.20.4/2019/DateString.js000066400000000000000000000020371431761430200170060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; var $isNaN = require('../helpers/isNaN'); var padTimeComponent = require('../helpers/padTimeComponent'); var Type = require('./Type'); var WeekDay = require('./WeekDay'); var MonthFromTime = require('./MonthFromTime'); var YearFromTime = require('./YearFromTime'); var DateFromTime = require('./DateFromTime'); // https://262.ecma-international.org/9.0/#sec-datestring module.exports = function DateString(tv) { if (Type(tv) !== 'Number' || $isNaN(tv)) { throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); } var weekday = weekdays[WeekDay(tv)]; var month = months[MonthFromTime(tv)]; var day = padTimeComponent(DateFromTime(tv)); var year = padTimeComponent(YearFromTime(tv), 4); return weekday + '\x20' + month + '\x20' + day + '\x20' + year; }; es-abstract-1.20.4/2019/Day.js000066400000000000000000000003521431761430200154550ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function Day(t) { return floor(t / msPerDay); }; es-abstract-1.20.4/2019/DayFromYear.js000066400000000000000000000004001431761430200171140ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DayFromYear(y) { return (365 * (y - 1970)) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400); }; es-abstract-1.20.4/2019/DayWithinYear.js000066400000000000000000000004361431761430200174640ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var DayFromYear = require('./DayFromYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function DayWithinYear(t) { return Day(t) - DayFromYear(YearFromTime(t)); }; es-abstract-1.20.4/2019/DaysInYear.js000066400000000000000000000004551431761430200167540ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DaysInYear(y) { if (modulo(y, 4) !== 0) { return 365; } if (modulo(y, 100) !== 0) { return 366; } if (modulo(y, 400) !== 0) { return 365; } return 366; }; es-abstract-1.20.4/2019/DefinePropertyOrThrow.js000066400000000000000000000026721431761430200212330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow module.exports = function DefinePropertyOrThrow(O, P, desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var Desc = isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, desc) ? desc : ToPropertyDescriptor(desc); if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor'); } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); }; es-abstract-1.20.4/2019/DeletePropertyOrThrow.js000066400000000000000000000012731431761430200212370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow module.exports = function DeletePropertyOrThrow(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // eslint-disable-next-line no-param-reassign var success = delete O[P]; if (!success) { throw new $TypeError('Attempt to delete property failed.'); } return success; }; es-abstract-1.20.4/2019/EnumerableOwnPropertyNames.js000066400000000000000000000021301431761430200222300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var objectKeys = require('object-keys'); var callBound = require('call-bind/callBound'); var callBind = require('call-bind'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%')); var forEach = require('../helpers/forEach'); var Type = require('./Type'); // https://262.ecma-international.org/8.0/#sec-enumerableownproperties module.exports = function EnumerableOwnPropertyNames(O, kind) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var keys = objectKeys(O); if (kind === 'key') { return keys; } if (kind === 'value' || kind === 'key+value') { var results = []; forEach(keys, function (key) { if ($isEnumerable(O, key)) { $pushApply(results, [ kind === 'value' ? O[key] : [key, O[key]] ]); } }); return results; } throw new $TypeError('Assertion failed: "kind" is not "key", "value", or "key+value": ' + kind); }; es-abstract-1.20.4/2019/FlattenIntoArray.js000066400000000000000000000033141431761430200201670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var Call = require('./Call'); var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var HasProperty = require('./HasProperty'); var IsArray = require('./IsArray'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); // https://262.ecma-international.org/10.0/#sec-flattenintoarray // eslint-disable-next-line max-params module.exports = function FlattenIntoArray(target, source, sourceLen, start, depth) { var mapperFunction; if (arguments.length > 5) { mapperFunction = arguments[5]; } var targetIndex = start; var sourceIndex = 0; while (sourceIndex < sourceLen) { var P = ToString(sourceIndex); var exists = HasProperty(source, P); if (exists === true) { var element = Get(source, P); if (typeof mapperFunction !== 'undefined') { if (arguments.length <= 6) { throw new $TypeError('Assertion failed: thisArg is required when mapperFunction is provided'); } element = Call(mapperFunction, arguments[6], [element, sourceIndex, source]); } var shouldFlatten = false; if (depth > 0) { shouldFlatten = IsArray(element); } if (shouldFlatten) { var elementLen = ToLength(Get(element, 'length')); targetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1); } else { if (targetIndex >= MAX_SAFE_INTEGER) { throw new $TypeError('index too large'); } CreateDataPropertyOrThrow(target, ToString(targetIndex), element); targetIndex += 1; } } sourceIndex += 1; } return targetIndex; }; es-abstract-1.20.4/2019/FromPropertyDescriptor.js000066400000000000000000000007021431761430200214460ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor module.exports = function FromPropertyDescriptor(Desc) { if (typeof Desc !== 'undefined') { assertRecord(Type, 'Property Descriptor', 'Desc', Desc); } return fromPropertyDescriptor(Desc); }; es-abstract-1.20.4/2019/Get.js000066400000000000000000000011321431761430200154540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var inspect = require('object-inspect'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-get-o-p module.exports = function Get(O, P) { // 7.3.1.1 if (Type(O) !== 'Object') { 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)); } // 7.3.1.3 return O[P]; }; es-abstract-1.20.4/2019/GetIterator.js000066400000000000000000000015301431761430200171700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var getIteratorMethod = require('../helpers/getIteratorMethod'); var AdvanceStringIndex = require('./AdvanceStringIndex'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsArray = require('./IsArray'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getiterator module.exports = function GetIterator(obj, method) { var actualMethod = method; if (arguments.length < 2) { actualMethod = getIteratorMethod( { AdvanceStringIndex: AdvanceStringIndex, GetMethod: GetMethod, IsArray: IsArray }, obj ); } var iterator = Call(actualMethod, obj); if (Type(iterator) !== 'Object') { throw new $TypeError('iterator must return an object'); } return iterator; }; es-abstract-1.20.4/2019/GetMethod.js000066400000000000000000000012271431761430200166220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-getmethod module.exports = function GetMethod(O, P) { // 7.3.9.1 if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // 7.3.9.2 var func = GetV(O, P); // 7.3.9.4 if (func == null) { return void 0; } // 7.3.9.5 if (!IsCallable(func)) { throw new $TypeError(P + 'is not a function'); } // 7.3.9.6 return func; }; es-abstract-1.20.4/2019/GetOwnPropertyKeys.js000066400000000000000000000014751431761430200205530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%', true); var keys = require('object-keys'); var esType = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys module.exports = function GetOwnPropertyKeys(O, Type) { if (esType(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (Type === 'Symbol') { return $gOPS ? $gOPS(O) : []; } if (Type === 'String') { if (!$gOPN) { return keys(O); } return $gOPN(O); } throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`'); }; es-abstract-1.20.4/2019/GetPrototypeFromConstructor.js000066400000000000000000000016311431761430200225000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Function = GetIntrinsic('%Function%'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic if (!IsConstructor(constructor)) { throw new $TypeError('Assertion failed: `constructor` must be a constructor'); } var proto = Get(constructor, 'prototype'); if (Type(proto) !== 'Object') { if (!(constructor instanceof $Function)) { // ignore other realms, for now throw new $TypeError('cross-realm constructors not currently supported'); } proto = intrinsic; } return proto; }; es-abstract-1.20.4/2019/GetSubstitution.js000066400000000000000000000104721431761430200201200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var every = require('../helpers/every'); var $charAt = callBound('String.prototype.charAt'); var $strSlice = callBound('String.prototype.slice'); var $indexOf = callBound('String.prototype.indexOf'); var $parseInt = parseInt; var isDigit = regexTester(/^[0-9]$/); var inspect = require('object-inspect'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); var ToObject = require('./ToObject'); var ToString = require('./ToString'); var Type = require('./Type'); var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false var isStringOrHole = function (capture, index, arr) { return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined'); }; // http://262.ecma-international.org/9.0/#sec-getsubstitution // eslint-disable-next-line max-statements, max-params, max-lines-per-function module.exports = function GetSubstitution(matched, str, position, captures, namedCaptures, replacement) { if (Type(matched) !== 'String') { throw new $TypeError('Assertion failed: `matched` must be a String'); } var matchLength = matched.length; if (Type(str) !== 'String') { throw new $TypeError('Assertion failed: `str` must be a String'); } var stringLength = str.length; if (!IsInteger(position) || position < 0 || position > stringLength) { throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position)); } if (!IsArray(captures) || !every(captures, isStringOrHole)) { throw new $TypeError('Assertion failed: `captures` must be a List of Strings, got ' + inspect(captures)); } if (Type(replacement) !== 'String') { throw new $TypeError('Assertion failed: `replacement` must be a String'); } var tailPos = position + matchLength; var m = captures.length; if (Type(namedCaptures) !== 'Undefined') { namedCaptures = ToObject(namedCaptures); // eslint-disable-line no-param-reassign } var result = ''; for (var i = 0; i < replacement.length; i += 1) { // if this is a $, and it's not the end of the replacement var current = $charAt(replacement, i); var isLast = (i + 1) >= replacement.length; var nextIsLast = (i + 2) >= replacement.length; if (current === '$' && !isLast) { var next = $charAt(replacement, i + 1); if (next === '$') { result += '$'; i += 1; } else if (next === '&') { result += matched; i += 1; } else if (next === '`') { result += position === 0 ? '' : $strSlice(str, 0, position - 1); i += 1; } else if (next === "'") { result += tailPos >= stringLength ? '' : $strSlice(str, tailPos); i += 1; } else { var nextNext = nextIsLast ? null : $charAt(replacement, i + 2); if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) { // $1 through $9, and not followed by a digit var n = $parseInt(next, 10); // if (n > m, impl-defined) result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1]; i += 1; } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) { // $00 through $99 var nn = next + nextNext; var nnI = $parseInt(nn, 10) - 1; // if nn === '00' or nn > m, impl-defined result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI]; i += 2; } else if (next === '<') { // eslint-disable-next-line max-depth if (Type(namedCaptures) === 'Undefined') { result += '$<'; i += 2; } else { var endIndex = $indexOf(replacement, '>', i); // eslint-disable-next-line max-depth if (endIndex > -1) { var groupName = $strSlice(replacement, i + '$<'.length, endIndex); var capture = Get(namedCaptures, groupName); // eslint-disable-next-line max-depth if (Type(capture) !== 'Undefined') { result += ToString(capture); } i += ('<' + groupName + '>').length; } } } else { result += '$'; } } } else { // the final $, or else not a $ result += $charAt(replacement, i); } } return result; }; es-abstract-1.20.4/2019/GetV.js000066400000000000000000000007321431761430200156070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var ToObject = require('./ToObject'); // https://ecma-international.org/ecma-262/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'); } // 7.3.2.2-3 var O = ToObject(V); // 7.3.2.4 return O[P]; }; es-abstract-1.20.4/2019/HasOwnProperty.js000066400000000000000000000010511431761430200177010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var has = require('has'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty module.exports = function HasOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return has(O, P); }; es-abstract-1.20.4/2019/HasProperty.js000066400000000000000000000010051431761430200172140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty module.exports = function HasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2019/HourFromTime.js000066400000000000000000000005761431761430200173300ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerHour = timeConstants.msPerHour; var HoursPerDay = timeConstants.HoursPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function HourFromTime(t) { return modulo(floor(t / msPerHour), HoursPerDay); }; es-abstract-1.20.4/2019/InLeapYear.js000066400000000000000000000007761431761430200167430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DaysInYear = require('./DaysInYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function InLeapYear(t) { var days = DaysInYear(YearFromTime(t)); if (days === 365) { return 0; } if (days === 366) { return 1; } throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days); }; es-abstract-1.20.4/2019/InstanceofOperator.js000066400000000000000000000016261431761430200205520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $hasInstance = GetIntrinsic('Symbol.hasInstance', true); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var OrdinaryHasInstance = require('./OrdinaryHasInstance'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator module.exports = function InstanceofOperator(O, C) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var instOfHandler = $hasInstance ? GetMethod(C, $hasInstance) : void 0; if (typeof instOfHandler !== 'undefined') { return ToBoolean(Call(instOfHandler, C, [O])); } if (!IsCallable(C)) { throw new $TypeError('`C` is not Callable'); } return OrdinaryHasInstance(C, O); }; es-abstract-1.20.4/2019/Invoke.js000066400000000000000000000013131431761430200161710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-invoke module.exports = function Invoke(O, P) { if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } var func = GetV(O, P); return Call(func, O, argumentsList); }; es-abstract-1.20.4/2019/IsAccessorDescriptor.js000066400000000000000000000007211431761430200210350ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor module.exports = function IsAccessorDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { return false; } return true; }; es-abstract-1.20.4/2019/IsArray.js000066400000000000000000000001731431761430200163130ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-isarray module.exports = require('../helpers/IsArray'); es-abstract-1.20.4/2019/IsCallable.js000066400000000000000000000001541431761430200167330ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.11 module.exports = require('is-callable'); es-abstract-1.20.4/2019/IsCompatiblePropertyDescriptor.js000066400000000000000000000005571431761430200231260ustar00rootroot00000000000000'use strict'; var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); }; es-abstract-1.20.4/2019/IsConcatSpreadable.js000066400000000000000000000011621431761430200204260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable module.exports = function IsConcatSpreadable(O) { if (Type(O) !== 'Object') { return false; } if ($isConcatSpreadable) { var spreadable = Get(O, $isConcatSpreadable); if (typeof spreadable !== 'undefined') { return ToBoolean(spreadable); } } return IsArray(O); }; es-abstract-1.20.4/2019/IsConstructor.js000066400000000000000000000021751431761430200175660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('../GetIntrinsic.js'); var $construct = GetIntrinsic('%Reflect.construct%', true); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); try { DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} }); } catch (e) { // Accessor properties aren't supported DefinePropertyOrThrow = null; } // https://ecma-international.org/ecma-262/6.0/#sec-isconstructor if (DefinePropertyOrThrow && $construct) { var isConstructorMarker = {}; var badArrayLike = {}; DefinePropertyOrThrow(badArrayLike, 'length', { '[[Get]]': function () { throw isConstructorMarker; }, '[[Enumerable]]': true }); module.exports = function IsConstructor(argument) { try { // `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`: $construct(argument, badArrayLike); } catch (err) { return err === isConstructorMarker; } }; } else { module.exports = function IsConstructor(argument) { // unfortunately there's no way to truly check this without try/catch `new argument` in old environments return typeof argument === 'function' && !!argument.prototype; }; } es-abstract-1.20.4/2019/IsDataDescriptor.js000066400000000000000000000007201431761430200201430ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor module.exports = function IsDataDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { return false; } return true; }; es-abstract-1.20.4/2019/IsExtensible.js000066400000000000000000000007751431761430200173470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $isExtensible = GetIntrinsic('%Object.isExtensible%', true); var isPrimitive = require('../helpers/isPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o module.exports = $preventExtensions ? function IsExtensible(obj) { return !isPrimitive(obj) && $isExtensible(obj); } : function IsExtensible(obj) { return !isPrimitive(obj); }; es-abstract-1.20.4/2019/IsGenericDescriptor.js000066400000000000000000000010601431761430200206440ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor module.exports = function IsGenericDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) { return true; } return false; }; es-abstract-1.20.4/2019/IsInteger.js000066400000000000000000000007021431761430200166300ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); // https://ecma-international.org/ecma-262/6.0/#sec-isinteger module.exports = function IsInteger(argument) { if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) { return false; } var absValue = abs(argument); return floor(absValue) === absValue; }; es-abstract-1.20.4/2019/IsPromise.js000066400000000000000000000007451431761430200166600ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $PromiseThen = callBound('Promise.prototype.then', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ispromise module.exports = function IsPromise(x) { if (Type(x) !== 'Object') { return false; } if (!$PromiseThen) { // Promises are not supported return false; } try { $PromiseThen(x); // throws if not a promise } catch (e) { return false; } return true; }; es-abstract-1.20.4/2019/IsPropertyKey.js000066400000000000000000000003171431761430200175320ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { return typeof argument === 'string' || typeof argument === 'symbol'; }; es-abstract-1.20.4/2019/IsRegExp.js000066400000000000000000000010411431761430200164220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $match = GetIntrinsic('%Symbol.match%', true); var hasRegExpMatcher = require('is-regex'); var ToBoolean = require('./ToBoolean'); // https://ecma-international.org/ecma-262/6.0/#sec-isregexp module.exports = function IsRegExp(argument) { if (!argument || typeof argument !== 'object') { return false; } if ($match) { var isRegExp = argument[$match]; if (typeof isRegExp !== 'undefined') { return ToBoolean(isRegExp); } } return hasRegExpMatcher(argument); }; es-abstract-1.20.4/2019/IsSharedArrayBuffer.js000066400000000000000000000007151431761430200205760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var isSharedArrayBuffer = require('is-shared-array-buffer'); // https://262.ecma-international.org/8.0/#sec-issharedarraybuffer module.exports = function IsSharedArrayBuffer(obj) { if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } return isSharedArrayBuffer(obj); }; es-abstract-1.20.4/2019/IsStringPrefix.js000066400000000000000000000016541431761430200176660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPrefixOf = require('../helpers/isPrefixOf'); // var callBound = require('call-bind/callBound'); // var $charAt = callBound('String.prototype.charAt'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-isstringprefix module.exports = function IsStringPrefix(p, q) { if (Type(p) !== 'String') { throw new $TypeError('Assertion failed: "p" must be a String'); } if (Type(q) !== 'String') { throw new $TypeError('Assertion failed: "q" must be a String'); } return isPrefixOf(p, q); /* if (p === q || p === '') { return true; } var pLength = p.length; var qLength = q.length; if (pLength >= qLength) { return false; } // assert: pLength < qLength for (var i = 0; i < pLength; i += 1) { if ($charAt(p, i) !== $charAt(q, i)) { return false; } } return true; */ }; es-abstract-1.20.4/2019/IterableToList.js000066400000000000000000000011531431761430200176260ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $arrayPush = callBound('Array.prototype.push'); var GetIterator = require('./GetIterator'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); // https://262.ecma-international.org/8.0/#sec-iterabletolist module.exports = function IterableToList(items, method) { var iterator = GetIterator(items, method); var values = []; var next = true; while (next) { next = IteratorStep(iterator); if (next) { var nextValue = IteratorValue(next); $arrayPush(values, nextValue); } } return values; }; es-abstract-1.20.4/2019/IteratorClose.js000066400000000000000000000027111431761430200175200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose module.exports = function IteratorClose(iterator, completion) { if (Type(iterator) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterator) is not Object'); } if (!IsCallable(completion)) { throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record'); } var completionThunk = completion; var iteratorReturn = GetMethod(iterator, 'return'); if (typeof iteratorReturn === 'undefined') { return completionThunk(); } var completionRecord; try { var innerResult = Call(iteratorReturn, iterator, []); } catch (e) { // if we hit here, then "e" is the innerResult completion that needs re-throwing // if the completion is of type "throw", this will throw. completionThunk(); completionThunk = null; // ensure it's not called twice. // if not, then return the innerResult completion throw e; } completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does completionThunk = null; // ensure it's not called twice. if (Type(innerResult) !== 'Object') { throw new $TypeError('iterator .return must return an object'); } return completionRecord; }; es-abstract-1.20.4/2019/IteratorComplete.js000066400000000000000000000007621431761430200202270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete module.exports = function IteratorComplete(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return ToBoolean(Get(iterResult, 'done')); }; es-abstract-1.20.4/2019/IteratorNext.js000066400000000000000000000007551431761430200173770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Invoke = require('./Invoke'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext module.exports = function IteratorNext(iterator, value) { var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]); if (Type(result) !== 'Object') { throw new $TypeError('iterator next must return an object'); } return result; }; es-abstract-1.20.4/2019/IteratorStep.js000066400000000000000000000005411431761430200173650ustar00rootroot00000000000000'use strict'; var IteratorComplete = require('./IteratorComplete'); var IteratorNext = require('./IteratorNext'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep module.exports = function IteratorStep(iterator) { var result = IteratorNext(iterator); var done = IteratorComplete(result); return done === true ? false : result; }; es-abstract-1.20.4/2019/IteratorValue.js000066400000000000000000000006731431761430200175340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue module.exports = function IteratorValue(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return Get(iterResult, 'value'); }; es-abstract-1.20.4/2019/MakeDate.js000066400000000000000000000005101431761430200164070ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.13 module.exports = function MakeDate(day, time) { if (!$isFinite(day) || !$isFinite(time)) { return NaN; } return (day * msPerDay) + time; }; es-abstract-1.20.4/2019/MakeDay.js000066400000000000000000000016251431761430200162570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $DateUTC = GetIntrinsic('%Date.UTC%'); var $isFinite = require('../helpers/isFinite'); var DateFromTime = require('./DateFromTime'); var Day = require('./Day'); var floor = require('./floor'); var modulo = require('./modulo'); var MonthFromTime = require('./MonthFromTime'); var ToInteger = require('./ToInteger'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.12 module.exports = function MakeDay(year, month, date) { if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { return NaN; } var y = ToInteger(year); var m = ToInteger(month); var dt = ToInteger(date); var ym = y + floor(m / 12); var mn = modulo(m, 12); var t = $DateUTC(ym, mn, 1); if (YearFromTime(t) !== ym || MonthFromTime(t) !== mn || DateFromTime(t) !== 1) { return NaN; } return Day(t) + dt - 1; }; es-abstract-1.20.4/2019/MakeTime.js000066400000000000000000000012721431761430200164360ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var msPerMinute = timeConstants.msPerMinute; var msPerHour = timeConstants.msPerHour; var ToInteger = require('./ToInteger'); // https://262.ecma-international.org/5.1/#sec-15.9.1.11 module.exports = function MakeTime(hour, min, sec, ms) { if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { return NaN; } var h = ToInteger(hour); var m = ToInteger(min); var s = ToInteger(sec); var milli = ToInteger(ms); var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; return t; }; es-abstract-1.20.4/2019/MinFromTime.js000066400000000000000000000006141431761430200171270ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerMinute = timeConstants.msPerMinute; var MinutesPerHour = timeConstants.MinutesPerHour; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function MinFromTime(t) { return modulo(floor(t / msPerMinute), MinutesPerHour); }; es-abstract-1.20.4/2019/MonthFromTime.js000066400000000000000000000017661431761430200175020ustar00rootroot00000000000000'use strict'; var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function MonthFromTime(t) { var day = DayWithinYear(t); if (0 <= day && day < 31) { return 0; } var leap = InLeapYear(t); if (31 <= day && day < (59 + leap)) { return 1; } if ((59 + leap) <= day && day < (90 + leap)) { return 2; } if ((90 + leap) <= day && day < (120 + leap)) { return 3; } if ((120 + leap) <= day && day < (151 + leap)) { return 4; } if ((151 + leap) <= day && day < (181 + leap)) { return 5; } if ((181 + leap) <= day && day < (212 + leap)) { return 6; } if ((212 + leap) <= day && day < (243 + leap)) { return 7; } if ((243 + leap) <= day && day < (273 + leap)) { return 8; } if ((273 + leap) <= day && day < (304 + leap)) { return 9; } if ((304 + leap) <= day && day < (334 + leap)) { return 10; } if ((334 + leap) <= day && day < (365 + leap)) { return 11; } }; es-abstract-1.20.4/2019/NumberToString.js000066400000000000000000000006601431761430200176640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-tostring-applied-to-the-number-type module.exports = function NumberToString(m) { if (Type(m) !== 'Number') { throw new $TypeError('Assertion failed: "m" must be a String'); } return $String(m); }; es-abstract-1.20.4/2019/ObjectCreate.js000066400000000000000000000020111431761430200172640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ObjectCreate = GetIntrinsic('%Object.create%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var Type = require('./Type'); var hasProto = !({ __proto__: null } instanceof Object); // https://ecma-international.org/ecma-262/6.0/#sec-objectcreate module.exports = function ObjectCreate(proto, internalSlotsList) { if (proto !== null && Type(proto) !== 'Object') { throw new $TypeError('Assertion failed: `proto` must be null or an object'); } var slots = arguments.length < 2 ? [] : internalSlotsList; if (slots.length > 0) { throw new $SyntaxError('es-abstract does not yet support internal slots'); } if ($ObjectCreate) { return $ObjectCreate(proto); } if (hasProto) { return { __proto__: proto }; } if (proto === null) { throw new $SyntaxError('native Object.create support is required to create null objects'); } var T = function T() {}; T.prototype = proto; return new T(); }; es-abstract-1.20.4/2019/ObjectDefineProperties.js000066400000000000000000000027441431761430200213450ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var Get = require('./Get'); var ToObject = require('./ToObject'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var forEach = require('../helpers/forEach'); var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $push = callBound('Array.prototype.push'); // https://262.ecma-international.org/6.0/#sec-objectdefineproperties module.exports = function ObjectDefineProperties(O, Properties) { var props = ToObject(Properties); // step 1 var keys = OwnPropertyKeys(props); // step 2 var descriptors = []; // step 3 forEach(keys, function (nextKey) { // step 4 var propDesc = ToPropertyDescriptor(getOwnPropertyDescriptor(props, nextKey)); // step 4.a if (typeof propDesc !== 'undefined' && propDesc['[[Enumerable]]']) { // step 4.b var descObj = Get(props, nextKey); // step 4.b.i var desc = ToPropertyDescriptor(descObj); // step 4.b.ii $push(descriptors, [nextKey, desc]); // step 4.b.iii } }); forEach(descriptors, function (pair) { // step 5 var P = pair[0]; // step 5.a var desc = pair[1]; // step 5.b desc = FromPropertyDescriptor(desc); // TODO: remove this once DefinePropertyOrThrow is fixed DefinePropertyOrThrow(O, P, desc); // step 5.c }); return O; // step 6 }; es-abstract-1.20.4/2019/OrdinaryCreateFromConstructor.js000066400000000000000000000014501431761430200227450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor'); var IsArray = require('./IsArray'); var ObjectCreate = require('./ObjectCreate'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarycreatefromconstructor module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto); var slots = arguments.length < 3 ? [] : arguments[2]; if (!IsArray(slots)) { throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List'); } return ObjectCreate(proto, slots); }; es-abstract-1.20.4/2019/OrdinaryDefineOwnProperty.js000066400000000000000000000045261431761430200221020ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var Type = require('./Type'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!$gOPD) { // ES3/IE 8 fallback if (IsAccessorDescriptor(Desc)) { throw new $SyntaxError('This environment does not support accessor property descriptors.'); } var creatingNormalDataProperty = !(P in O) && Desc['[[Writable]]'] && Desc['[[Enumerable]]'] && Desc['[[Configurable]]'] && '[[Value]]' in Desc; var settingExistingDataProperty = (P in O) && (!('[[Configurable]]' in Desc) || Desc['[[Configurable]]']) && (!('[[Enumerable]]' in Desc) || Desc['[[Enumerable]]']) && (!('[[Writable]]' in Desc) || Desc['[[Writable]]']) && '[[Value]]' in Desc; if (creatingNormalDataProperty || settingExistingDataProperty) { O[P] = Desc['[[Value]]']; // eslint-disable-line no-param-reassign return SameValue(O[P], Desc['[[Value]]']); } throw new $SyntaxError('This environment does not support defining non-writable, non-enumerable, or non-configurable properties'); } var desc = $gOPD(O, P); var current = desc && ToPropertyDescriptor(desc); var extensible = IsExtensible(O); return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current); }; es-abstract-1.20.4/2019/OrdinaryGetOwnProperty.js000066400000000000000000000023511431761430200214210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var has = require('has'); var IsArray = require('./IsArray'); var IsPropertyKey = require('./IsPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty module.exports = function OrdinaryGetOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!has(O, P)) { return void 0; } if (!$gOPD) { // ES3 / IE 8 fallback var arrayLength = IsArray(O) && P === 'length'; var regexLastIndex = IsRegExp(O) && P === 'lastIndex'; return { '[[Configurable]]': !(arrayLength || regexLastIndex), '[[Enumerable]]': $isEnumerable(O, P), '[[Value]]': O[P], '[[Writable]]': true }; } return ToPropertyDescriptor($gOPD(O, P)); }; es-abstract-1.20.4/2019/OrdinaryGetPrototypeOf.js000066400000000000000000000010331431761430200213770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $getProto = require('../helpers/getProto'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarygetprototypeof module.exports = function OrdinaryGetPrototypeOf(O) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!$getProto) { throw new $TypeError('This environment does not support fetching prototypes.'); } return $getProto(O); }; es-abstract-1.20.4/2019/OrdinaryHasInstance.js000066400000000000000000000011631431761430200206510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance module.exports = function OrdinaryHasInstance(C, O) { if (IsCallable(C) === false) { return false; } if (Type(O) !== 'Object') { return false; } var P = Get(C, 'prototype'); if (Type(P) !== 'Object') { throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.'); } return O instanceof C; }; es-abstract-1.20.4/2019/OrdinaryHasProperty.js000066400000000000000000000010231431761430200207240ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty module.exports = function OrdinaryHasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2019/OrdinarySetPrototypeOf.js000066400000000000000000000020321431761430200214130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $setProto = require('../helpers/setProto'); var OrdinaryGetPrototypeOf = require('./OrdinaryGetPrototypeOf'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarysetprototypeof module.exports = function OrdinarySetPrototypeOf(O, V) { if (Type(V) !== 'Object' && Type(V) !== 'Null') { throw new $TypeError('Assertion failed: V must be Object or Null'); } /* var extensible = IsExtensible(O); var current = OrdinaryGetPrototypeOf(O); if (SameValue(V, current)) { return true; } if (!extensible) { return false; } */ try { $setProto(O, V); } catch (e) { return false; } return OrdinaryGetPrototypeOf(O) === V; /* var p = V; var done = false; while (!done) { if (p === null) { done = true; } else if (SameValue(p, O)) { return false; } else { if (wat) { done = true; } else { p = p.[[Prototype]]; } } } O.[[Prototype]] = V; return true; */ }; es-abstract-1.20.4/2019/OrdinaryToPrimitive.js000066400000000000000000000020511431761430200207210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); var inspect = require('object-inspect'); // https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive module.exports = function OrdinaryToPrimitive(O, hint) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); } var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; for (var i = 0; i < methodNames.length; i += 1) { var name = methodNames[i]; var method = Get(O, name); if (IsCallable(method)) { var result = Call(method, O); if (Type(result) !== 'Object') { return result; } } } throw new $TypeError('No primitive value for ' + inspect(O)); }; es-abstract-1.20.4/2019/PromiseResolve.js000066400000000000000000000007111431761430200177150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBind = require('call-bind'); var $resolve = GetIntrinsic('%Promise.resolve%', true); var $PromiseResolve = $resolve && callBind($resolve); // https://262.ecma-international.org/9.0/#sec-promise-resolve module.exports = function PromiseResolve(C, x) { if (!$PromiseResolve) { throw new SyntaxError('This environment does not support Promises.'); } return $PromiseResolve(C, x); }; es-abstract-1.20.4/2019/QuoteJSONString.js000066400000000000000000000025441431761430200177230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var $strSplit = callBound('String.prototype.split'); var Type = require('./Type'); var UnicodeEscape = require('./UnicodeEscape'); var UTF16Encoding = require('./UTF16Encoding'); var has = require('has'); // https://262.ecma-international.org/10.0/#sec-quotejsonstring var escapes = { '\u0008': '\\b', '\u0009': '\\t', '\u000A': '\\n', '\u000C': '\\f', '\u000D': '\\r', '\u0022': '\\"', '\u005c': '\\\\' }; module.exports = function QuoteJSONString(value) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `value` must be a String'); } var product = '"'; if (value) { forEach($strSplit(value), function (C) { if (has(escapes, C)) { product += escapes[C]; } else { var cCharCode = $charCodeAt(C, 0); if (cCharCode < 0x20 || isLeadingSurrogate(C) || isTrailingSurrogate(C)) { product += UnicodeEscape(C); } else { product += UTF16Encoding(cCharCode); } } }); } product += '"'; return product; }; es-abstract-1.20.4/2019/RegExpCreate.js000066400000000000000000000012031431761430200172520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RegExp = GetIntrinsic('%RegExp%'); // var RegExpAlloc = require('./RegExpAlloc'); // var RegExpInitialize = require('./RegExpInitialize'); var ToString = require('./ToString'); // https://262.ecma-international.org/6.0/#sec-regexpcreate module.exports = function RegExpCreate(P, F) { // var obj = RegExpAlloc($RegExp); // return RegExpInitialize(obj, P, F); // covers spec mechanics; bypass regex brand checking var pattern = typeof P === 'undefined' ? '' : ToString(P); var flags = typeof F === 'undefined' ? '' : ToString(F); return new $RegExp(pattern, flags); }; es-abstract-1.20.4/2019/RegExpExec.js000066400000000000000000000015671431761430200167500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var regexExec = require('call-bind/callBound')('RegExp.prototype.exec'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-regexpexec module.exports = function RegExpExec(R, S) { if (Type(R) !== 'Object') { throw new $TypeError('Assertion failed: `R` must be an Object'); } if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var exec = Get(R, 'exec'); if (IsCallable(exec)) { var result = Call(exec, R, [S]); if (result === null || Type(result) === 'Object') { return result; } throw new $TypeError('"exec" method must return `null` or an Object'); } return regexExec(R, S); }; es-abstract-1.20.4/2019/RequireObjectCoercible.js000066400000000000000000000001061431761430200213100ustar00rootroot00000000000000'use strict'; module.exports = require('../5/CheckObjectCoercible'); es-abstract-1.20.4/2019/SameValue.js000066400000000000000000000004631431761430200166250ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // http://262.ecma-international.org/5.1/#sec-9.12 module.exports = function SameValue(x, y) { if (x === y) { // 0 === -0, but they are not identical. if (x === 0) { return 1 / x === 1 / y; } return true; } return $isNaN(x) && $isNaN(y); }; es-abstract-1.20.4/2019/SameValueNonNumber.js000066400000000000000000000007021431761430200204450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); // https://262.ecma-international.org/7.0/#sec-samevaluenonnumber module.exports = function SameValueNonNumber(x, y) { if (typeof x === 'number' || typeof x !== typeof y) { throw new $TypeError('SameValueNonNumber requires two non-number values of the same type.'); } return SameValue(x, y); }; es-abstract-1.20.4/2019/SameValueZero.js000066400000000000000000000003371431761430200174650ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero module.exports = function SameValueZero(x, y) { return (x === y) || ($isNaN(x) && $isNaN(y)); }; es-abstract-1.20.4/2019/SecFromTime.js000066400000000000000000000006221431761430200171150ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var SecondsPerMinute = timeConstants.SecondsPerMinute; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function SecFromTime(t) { return modulo(floor(t / msPerSecond), SecondsPerMinute); }; es-abstract-1.20.4/2019/Set.js000066400000000000000000000023471431761430200155010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // IE 9 does not throw in strict mode when writability/configurability/extensibility is violated var noThrowOnStrictViolation = (function () { try { delete [].length; return true; } catch (e) { return false; } }()); // https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw module.exports = function Set(O, P, V, Throw) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (Type(Throw) !== 'Boolean') { throw new $TypeError('Assertion failed: `Throw` must be a Boolean'); } if (Throw) { O[P] = V; // eslint-disable-line no-param-reassign if (noThrowOnStrictViolation && !SameValue(O[P], V)) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; } try { O[P] = V; // eslint-disable-line no-param-reassign return noThrowOnStrictViolation ? SameValue(O[P], V) : true; } catch (e) { return false; } }; es-abstract-1.20.4/2019/SetFunctionLength.js000066400000000000000000000020271431761430200203440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var HasOwnProperty = require('./HasOwnProperty'); var IsExtensible = require('./IsExtensible'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-setfunctionlength module.exports = function SetFunctionLength(F, length) { if (typeof F !== 'function' || !IsExtensible(F) || HasOwnProperty(F, 'length')) { throw new $TypeError('Assertion failed: `F` must be an extensible function and lack an own `length` property'); } if (Type(length) !== 'Number') { throw new $TypeError('Assertion failed: `length` must be a Number'); } if (length < 0 || !IsInteger(length)) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0'); } return DefinePropertyOrThrow(F, 'length', { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); }; es-abstract-1.20.4/2019/SetFunctionName.js000066400000000000000000000025451431761430200200100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname module.exports = function SetFunctionName(F, name) { if (typeof F !== 'function') { throw new $TypeError('Assertion failed: `F` must be a function'); } if (!IsExtensible(F) || has(F, 'name')) { throw new $TypeError('Assertion failed: `F` must be extensible, and must not have a `name` own property'); } var nameType = Type(name); if (nameType !== 'Symbol' && nameType !== 'String') { throw new $TypeError('Assertion failed: `name` must be a Symbol or a String'); } if (nameType === 'Symbol') { var description = getSymbolDescription(name); // eslint-disable-next-line no-param-reassign name = typeof description === 'undefined' ? '' : '[' + description + ']'; } if (arguments.length > 2) { var prefix = arguments[2]; // eslint-disable-next-line no-param-reassign name = prefix + ' ' + name; } return DefinePropertyOrThrow(F, 'name', { '[[Value]]': name, '[[Writable]]': false, '[[Enumerable]]': false, '[[Configurable]]': true }); }; es-abstract-1.20.4/2019/SetIntegrityLevel.js000066400000000000000000000035061431761430200203660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var forEach = require('../helpers/forEach'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel module.exports = function SetIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } if (!$preventExtensions) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.preventExtensions` support'); } var status = $preventExtensions(O); if (!status) { return false; } if (!$gOPN) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support'); } var theKeys = $gOPN(O); if (level === 'sealed') { forEach(theKeys, function (k) { DefinePropertyOrThrow(O, k, { configurable: false }); }); } else if (level === 'frozen') { forEach(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { var desc; if (IsAccessorDescriptor(ToPropertyDescriptor(currentDesc))) { desc = { configurable: false }; } else { desc = { configurable: false, writable: false }; } DefinePropertyOrThrow(O, k, desc); } }); } return true; }; es-abstract-1.20.4/2019/SpeciesConstructor.js000066400000000000000000000015141431761430200206020ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor module.exports = function SpeciesConstructor(O, defaultConstructor) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var C = O.constructor; if (typeof C === 'undefined') { return defaultConstructor; } if (Type(C) !== 'Object') { throw new $TypeError('O.constructor is not an Object'); } var S = $species ? C[$species] : void 0; if (S == null) { return defaultConstructor; } if (IsConstructor(S)) { return S; } throw new $TypeError('no constructor found'); }; es-abstract-1.20.4/2019/SplitMatch.js000066400000000000000000000015521431761430200170130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var $charAt = callBound('String.prototype.charAt'); // https://262.ecma-international.org/6.0/#sec-splitmatch module.exports = function SplitMatch(S, q, R) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(q)) { throw new $TypeError('Assertion failed: `q` must be an integer'); } if (Type(R) !== 'String') { throw new $TypeError('Assertion failed: `R` must be a String'); } var r = R.length; var s = S.length; if (q + r > s) { return false; } for (var i = 0; i < r; i += 1) { if ($charAt(S, q + i) !== $charAt(R, i)) { return false; } } return q + r; }; es-abstract-1.20.4/2019/StrictEqualityComparison.js000066400000000000000000000005511431761430200217620ustar00rootroot00000000000000'use strict'; var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.9.6 module.exports = function StrictEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType !== yType) { return false; } if (xType === 'Undefined' || xType === 'Null') { return true; } return x === y; // shortcut for steps 4-7 }; es-abstract-1.20.4/2019/StringCreate.js000066400000000000000000000021351431761430200173330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var $StringPrototype = GetIntrinsic('%String.prototype%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var Type = require('./Type'); var setProto = require('../helpers/setProto'); // https://262.ecma-international.org/6.0/#sec-stringcreate module.exports = function StringCreate(value, prototype) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var S = $Object(value); if (prototype !== $StringPrototype) { if (setProto) { setProto(S, prototype); } else { throw new $SyntaxError('StringCreate: a `proto` argument that is not `String.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } } var length = value.length; DefinePropertyOrThrow(S, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); return S; }; es-abstract-1.20.4/2019/StringGetOwnProperty.js000066400000000000000000000025461431761430200211060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charAt = callBound('String.prototype.charAt'); var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsInteger = require('./IsInteger'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); var isNegativeZero = require('is-negative-zero'); // https://262.ecma-international.org/8.0/#sec-stringgetownproperty module.exports = function StringGetOwnProperty(S, P) { var str; if (Type(S) === 'Object') { try { str = $stringToString(S); } catch (e) { /**/ } } if (Type(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 (Type(P) !== 'String') { return void undefined; } var index = CanonicalNumericIndexString(P); var len = str.length; if (typeof index === 'undefined' || !IsInteger(index) || isNegativeZero(index) || index < 0 || len <= index) { return void undefined; } var resultStr = $charAt(S, index); return { '[[Configurable]]': false, '[[Enumerable]]': true, '[[Value]]': resultStr, '[[Writable]]': false }; }; es-abstract-1.20.4/2019/SymbolDescriptiveString.js000066400000000000000000000010161431761430200215740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $SymbolToString = callBound('Symbol.prototype.toString', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring module.exports = function SymbolDescriptiveString(sym) { if (Type(sym) !== 'Symbol') { throw new $TypeError('Assertion failed: `sym` must be a Symbol'); } return $SymbolToString(sym); }; es-abstract-1.20.4/2019/TestIntegrityLevel.js000066400000000000000000000024051431761430200205470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var every = require('../helpers/every'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel module.exports = function TestIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } var status = IsExtensible(O); if (status) { return false; } var theKeys = OwnPropertyKeys(O); return theKeys.length === 0 || every(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { if (currentDesc.configurable) { return false; } if (level === 'frozen' && IsDataDescriptor(ToPropertyDescriptor(currentDesc)) && currentDesc.writable) { return false; } } return true; }); }; es-abstract-1.20.4/2019/TimeClip.js000066400000000000000000000007241431761430200164510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var $Number = GetIntrinsic('%Number%'); var $isFinite = require('../helpers/isFinite'); var abs = require('./abs'); var ToNumber = require('./ToNumber'); // https://262.ecma-international.org/5.1/#sec-15.9.1.14 module.exports = function TimeClip(time) { if (!$isFinite(time) || abs(time) > 8.64e15) { return NaN; } return $Number(new $Date(ToNumber(time))); }; es-abstract-1.20.4/2019/TimeFromYear.js000066400000000000000000000004051431761430200173020ustar00rootroot00000000000000'use strict'; var msPerDay = require('../helpers/timeConstants').msPerDay; var DayFromYear = require('./DayFromYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function TimeFromYear(y) { return msPerDay * DayFromYear(y); }; es-abstract-1.20.4/2019/TimeString.js000066400000000000000000000014501431761430200170250ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var padTimeComponent = require('../helpers/padTimeComponent'); var HourFromTime = require('./HourFromTime'); var MinFromTime = require('./MinFromTime'); var SecFromTime = require('./SecFromTime'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-timestring module.exports = function TimeString(tv) { if (Type(tv) !== 'Number' || $isNaN(tv)) { throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); } var hour = HourFromTime(tv); var minute = MinFromTime(tv); var second = SecFromTime(tv); return padTimeComponent(hour) + ':' + padTimeComponent(minute) + ':' + padTimeComponent(second) + '\x20GMT'; }; es-abstract-1.20.4/2019/TimeWithinDay.js000066400000000000000000000003671431761430200174650ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function TimeWithinDay(t) { return modulo(t, msPerDay); }; es-abstract-1.20.4/2019/ToBoolean.js000066400000000000000000000002021431761430200166140ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.2 module.exports = function ToBoolean(value) { return !!value; }; es-abstract-1.20.4/2019/ToDateString.js000066400000000000000000000007621431761430200173140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Date = GetIntrinsic('%Date%'); var $isNaN = require('../helpers/isNaN'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-todatestring module.exports = function ToDateString(tv) { if (Type(tv) !== 'Number') { throw new $TypeError('Assertion failed: `tv` must be a Number'); } if ($isNaN(tv)) { return 'Invalid Date'; } return $Date(tv); }; es-abstract-1.20.4/2019/ToIndex.js000066400000000000000000000012341431761430200163120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var ToInteger = require('./ToInteger'); var ToLength = require('./ToLength'); var SameValueZero = require('./SameValueZero'); // https://262.ecma-international.org/8.0/#sec-toindex module.exports = function ToIndex(value) { if (typeof value === 'undefined') { return 0; } var integerIndex = ToInteger(value); if (integerIndex < 0) { throw new $RangeError('index must be >= 0'); } var index = ToLength(integerIndex); if (!SameValueZero(integerIndex, index)) { throw new $RangeError('index must be >= 0 and < 2 ** 53 - 1'); } return index; }; es-abstract-1.20.4/2019/ToInt16.js000066400000000000000000000004041431761430200161420ustar00rootroot00000000000000'use strict'; var ToUint16 = require('./ToUint16'); // https://ecma-international.org/ecma-262/6.0/#sec-toint16 module.exports = function ToInt16(argument) { var int16bit = ToUint16(argument); return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit; }; es-abstract-1.20.4/2019/ToInt32.js000066400000000000000000000002551431761430200161440ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.5 module.exports = function ToInt32(x) { return ToNumber(x) >> 0; }; es-abstract-1.20.4/2019/ToInt8.js000066400000000000000000000003671431761430200160730ustar00rootroot00000000000000'use strict'; var ToUint8 = require('./ToUint8'); // https://ecma-international.org/ecma-262/6.0/#sec-toint8 module.exports = function ToInt8(argument) { var int8bit = ToUint8(argument); return int8bit >= 0x80 ? int8bit - 0x100 : int8bit; }; es-abstract-1.20.4/2019/ToInteger.js000066400000000000000000000004211431761430200166350ustar00rootroot00000000000000'use strict'; var ES5ToInteger = require('../5/ToInteger'); var ToNumber = require('./ToNumber'); // https://ecma-international.org/ecma-262/6.0/#sec-tointeger module.exports = function ToInteger(value) { var number = ToNumber(value); return ES5ToInteger(number); }; es-abstract-1.20.4/2019/ToLength.js000066400000000000000000000005141431761430200164640ustar00rootroot00000000000000'use strict'; var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var ToInteger = require('./ToInteger'); module.exports = function ToLength(argument) { var len = ToInteger(argument); if (len <= 0) { return 0; } // includes converting -0 to +0 if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } return len; }; es-abstract-1.20.4/2019/ToNumber.js000066400000000000000000000037301431761430200164760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Number = GetIntrinsic('%Number%'); var $RegExp = GetIntrinsic('%RegExp%'); var $parseInteger = GetIntrinsic('%parseInt%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var isPrimitive = require('../helpers/isPrimitive'); var $strSlice = callBound('String.prototype.slice'); var isBinary = regexTester(/^0b[01]+$/i); var isOctal = regexTester(/^0o[0-7]+$/i); var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i); var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); var hasNonWS = regexTester(nonWSregex); // whitespace from: https://es5.github.io/#x15.5.4.20 // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324 var ws = [ '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003', '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028', '\u2029\uFEFF' ].join(''); var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); var $replace = callBound('String.prototype.replace'); var $trim = function (value) { return $replace(value, trimRegex, ''); }; var ToPrimitive = require('./ToPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-tonumber module.exports = function ToNumber(argument) { var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (typeof value === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a number'); } if (typeof value === 'string') { if (isBinary(value)) { return ToNumber($parseInteger($strSlice(value, 2), 2)); } else if (isOctal(value)) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; } var trimmed = $trim(value); if (trimmed !== value) { return ToNumber(trimmed); } } return $Number(value); }; es-abstract-1.20.4/2019/ToObject.js000066400000000000000000000005161431761430200164530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); // https://ecma-international.org/ecma-262/6.0/#sec-toobject module.exports = function ToObject(value) { RequireObjectCoercible(value); return $Object(value); }; es-abstract-1.20.4/2019/ToPrimitive.js000066400000000000000000000004371431761430200172170ustar00rootroot00000000000000'use strict'; var toPrimitive = require('es-to-primitive/es2015'); // https://ecma-international.org/ecma-262/6.0/#sec-toprimitive module.exports = function ToPrimitive(input) { if (arguments.length > 1) { return toPrimitive(input, arguments[1]); } return toPrimitive(input); }; es-abstract-1.20.4/2019/ToPropertyDescriptor.js000066400000000000000000000026541431761430200211350ustar00rootroot00000000000000'use strict'; var has = require('has'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var ToBoolean = require('./ToBoolean'); var IsCallable = require('./IsCallable'); // https://262.ecma-international.org/5.1/#sec-8.10.5 module.exports = function ToPropertyDescriptor(Obj) { if (Type(Obj) !== 'Object') { throw new $TypeError('ToPropertyDescriptor requires an object'); } var desc = {}; if (has(Obj, 'enumerable')) { desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable); } if (has(Obj, 'configurable')) { desc['[[Configurable]]'] = ToBoolean(Obj.configurable); } if (has(Obj, 'value')) { desc['[[Value]]'] = Obj.value; } if (has(Obj, 'writable')) { desc['[[Writable]]'] = ToBoolean(Obj.writable); } if (has(Obj, 'get')) { var getter = Obj.get; if (typeof getter !== 'undefined' && !IsCallable(getter)) { throw new $TypeError('getter must be a function'); } desc['[[Get]]'] = getter; } if (has(Obj, 'set')) { var setter = Obj.set; if (typeof setter !== 'undefined' && !IsCallable(setter)) { throw new $TypeError('setter must be a function'); } desc['[[Set]]'] = setter; } if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); } return desc; }; es-abstract-1.20.4/2019/ToPropertyKey.js000066400000000000000000000006251431761430200175430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var ToPrimitive = require('./ToPrimitive'); var ToString = require('./ToString'); // https://ecma-international.org/ecma-262/6.0/#sec-topropertykey module.exports = function ToPropertyKey(argument) { var key = ToPrimitive(argument, $String); return typeof key === 'symbol' ? key : ToString(key); }; es-abstract-1.20.4/2019/ToString.js000066400000000000000000000006141431761430200165120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); // https://ecma-international.org/ecma-262/6.0/#sec-tostring module.exports = function ToString(argument) { if (typeof argument === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a string'); } return $String(argument); }; es-abstract-1.20.4/2019/ToUint16.js000066400000000000000000000010641431761430200163320ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // http://262.ecma-international.org/5.1/#sec-9.7 module.exports = function ToUint16(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x10000); }; es-abstract-1.20.4/2019/ToUint32.js000066400000000000000000000002571431761430200163330ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.6 module.exports = function ToUint32(x) { return ToNumber(x) >>> 0; }; es-abstract-1.20.4/2019/ToUint8.js000066400000000000000000000011021431761430200162440ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8 module.exports = function ToUint8(argument) { var number = ToNumber(argument); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x100); }; es-abstract-1.20.4/2019/ToUint8Clamp.js000066400000000000000000000010121431761430200172210ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp module.exports = function ToUint8Clamp(argument) { var number = ToNumber(argument); if ($isNaN(number) || number <= 0) { return 0; } if (number >= 0xFF) { return 0xFF; } var f = floor(argument); if (f + 0.5 < number) { return f + 1; } if (number < f + 0.5) { return f; } if (f % 2 !== 0) { return f + 1; } return f; }; es-abstract-1.20.4/2019/TrimString.js000066400000000000000000000014441431761430200170450ustar00rootroot00000000000000'use strict'; var trimStart = require('string.prototype.trimstart'); var trimEnd = require('string.prototype.trimend'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); // https://262.ecma-international.org/10.0/#sec-trimstring module.exports = function TrimString(string, where) { var str = RequireObjectCoercible(string); var S = ToString(str); var T; if (where === 'start') { T = trimStart(S); } else if (where === 'end') { T = trimEnd(S); } else if (where === 'start+end') { T = trimStart(trimEnd(S)); } else { throw new $TypeError('Assertion failed: invalid `where` value; must be "start", "end", or "start+end"'); } return T; }; es-abstract-1.20.4/2019/Type.js000066400000000000000000000003711431761430200156620ustar00rootroot00000000000000'use strict'; var ES5Type = require('../5/Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ecmascript-data-types-and-values module.exports = function Type(x) { if (typeof x === 'symbol') { return 'Symbol'; } return ES5Type(x); }; es-abstract-1.20.4/2019/UTF16Decode.js000066400000000000000000000014671431761430200166610ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); // https://262.ecma-international.org/7.0/#sec-utf16decode var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); // https://262.ecma-international.org/11.0/#sec-utf16decodesurrogatepair module.exports = function UTF16Decode(lead, trail) { if (!isLeadingSurrogate(lead) || !isTrailingSurrogate(trail)) { throw new $TypeError('Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code'); } // var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; return $fromCharCode(lead) + $fromCharCode(trail); }; es-abstract-1.20.4/2019/UTF16Encoding.js000066400000000000000000000012741431761430200172200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var floor = require('./floor'); var modulo = require('./modulo'); var isCodePoint = require('../helpers/isCodePoint'); // https://262.ecma-international.org/7.0/#sec-utf16encoding module.exports = function UTF16Encoding(cp) { if (!isCodePoint(cp)) { throw new $TypeError('Assertion failed: `cp` must be >= 0 and <= 0x10FFFF'); } if (cp <= 65535) { return $fromCharCode(cp); } var cu1 = floor((cp - 65536) / 1024) + 0xD800; var cu2 = modulo(cp - 65536, 1024) + 0xDC00; return $fromCharCode(cu1) + $fromCharCode(cu2); }; es-abstract-1.20.4/2019/UnicodeEscape.js000066400000000000000000000015161431761430200174520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var $numberToString = callBound('Number.prototype.toString'); var $toLowerCase = callBound('String.prototype.toLowerCase'); var $strSlice = callBound('String.prototype.slice'); // https://262.ecma-international.org/9.0/#sec-unicodeescape module.exports = function UnicodeEscape(C) { if (typeof C !== 'string' || C.length !== 1) { throw new $TypeError('Assertion failed: `C` must be a single code unit'); } var n = $charCodeAt(C, 0); if (n > 0xFFFF) { throw new $TypeError('`Assertion failed: numeric value of `C` must be <= 0xFFFF'); } return '\\u' + $strSlice('0000' + $toLowerCase($numberToString(n, 16)), -4); }; es-abstract-1.20.4/2019/ValidateAndApplyPropertyDescriptor.js000066400000000000000000000121731431761430200237320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var isSamePropertyDescriptor = require('../helpers/isSamePropertyDescriptor'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-validateandapplypropertydescriptor // https://ecma-international.org/ecma-262/8.0/#sec-validateandapplypropertydescriptor // eslint-disable-next-line max-lines-per-function, max-statements, max-params module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) { // this uses the ES2017+ logic, since it fixes a number of bugs in the ES2015 logic. var oType = Type(O); if (oType !== 'Undefined' && oType !== 'Object') { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } if (Type(extensible) !== 'Boolean') { throw new $TypeError('Assertion failed: extensible must be a Boolean'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (Type(current) !== 'Undefined' && !isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } if (oType !== 'Undefined' && !IsPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (Type(current) === 'Undefined') { if (!extensible) { return false; } if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': Desc['[[Configurable]]'], '[[Enumerable]]': Desc['[[Enumerable]]'], '[[Value]]': Desc['[[Value]]'], '[[Writable]]': Desc['[[Writable]]'] } ); } } else { if (!IsAccessorDescriptor(Desc)) { throw new $TypeError('Assertion failed: Desc is not an accessor descriptor'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } } return true; } if (IsGenericDescriptor(Desc) && !('[[Configurable]]' in Desc) && !('[[Enumerable]]' in Desc)) { return true; } if (isSamePropertyDescriptor({ SameValue: SameValue }, Desc, current)) { return true; // removed by ES2017, but should still be correct } // "if every field in Desc is absent, return true" can't really match the assertion that it's a Property Descriptor if (!current['[[Configurable]]']) { if (Desc['[[Configurable]]']) { return false; } if ('[[Enumerable]]' in Desc && !Desc['[[Enumerable]]'] === !!current['[[Enumerable]]']) { return false; } } if (IsGenericDescriptor(Desc)) { // no further validation is required. } else if (IsDataDescriptor(current) !== IsDataDescriptor(Desc)) { if (!current['[[Configurable]]']) { return false; } if (IsDataDescriptor(current)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Get]]': undefined } ); } } else if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Value]]': undefined } ); } } else if (IsDataDescriptor(current) && IsDataDescriptor(Desc)) { if (!current['[[Configurable]]'] && !current['[[Writable]]']) { if ('[[Writable]]' in Desc && Desc['[[Writable]]']) { return false; } if ('[[Value]]' in Desc && !SameValue(Desc['[[Value]]'], current['[[Value]]'])) { return false; } return true; } } else if (IsAccessorDescriptor(current) && IsAccessorDescriptor(Desc)) { if (!current['[[Configurable]]']) { if ('[[Set]]' in Desc && !SameValue(Desc['[[Set]]'], current['[[Set]]'])) { return false; } if ('[[Get]]' in Desc && !SameValue(Desc['[[Get]]'], current['[[Get]]'])) { return false; } return true; } } else { throw new $TypeError('Assertion failed: current and Desc are not both data, both accessors, or one accessor and one data.'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } return true; }; es-abstract-1.20.4/2019/WeekDay.js000066400000000000000000000003201431761430200162640ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.6 module.exports = function WeekDay(t) { return modulo(Day(t) + 4, 7); }; es-abstract-1.20.4/2019/YearFromTime.js000066400000000000000000000006271431761430200173100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var callBound = require('call-bind/callBound'); var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function YearFromTime(t) { // largest y such that this.TimeFromYear(y) <= t return $getUTCFullYear(new $Date(t)); }; es-abstract-1.20.4/2019/abs.js000066400000000000000000000003171431761430200155060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $abs = GetIntrinsic('%Math.abs%'); // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function abs(x) { return $abs(x); }; es-abstract-1.20.4/2019/floor.js000066400000000000000000000003311431761430200160560ustar00rootroot00000000000000'use strict'; // var modulo = require('./modulo'); var $floor = Math.floor; // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function floor(x) { // return x - modulo(x, 1); return $floor(x); }; es-abstract-1.20.4/2019/modulo.js000066400000000000000000000002501431761430200162340ustar00rootroot00000000000000'use strict'; var mod = require('../helpers/mod'); // https://262.ecma-international.org/5.1/#sec-5.2 module.exports = function modulo(x, y) { return mod(x, y); }; es-abstract-1.20.4/2019/msFromTime.js000066400000000000000000000003751431761430200170270ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerSecond = require('../helpers/timeConstants').msPerSecond; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function msFromTime(t) { return modulo(t, msPerSecond); }; es-abstract-1.20.4/2019/thisBooleanValue.js000066400000000000000000000005571431761430200202130ustar00rootroot00000000000000'use strict'; var $BooleanValueOf = require('call-bind/callBound')('Boolean.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-boolean-prototype-object module.exports = function thisBooleanValue(value) { if (Type(value) === 'Boolean') { return value; } return $BooleanValueOf(value); }; es-abstract-1.20.4/2019/thisNumberValue.js000066400000000000000000000006061431761430200200570ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var Type = require('./Type'); var $NumberValueOf = callBound('Number.prototype.valueOf'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object module.exports = function thisNumberValue(value) { if (Type(value) === 'Number') { return value; } return $NumberValueOf(value); }; es-abstract-1.20.4/2019/thisStringValue.js000066400000000000000000000005511431761430200200740ustar00rootroot00000000000000'use strict'; var $StringValueOf = require('call-bind/callBound')('String.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object module.exports = function thisStringValue(value) { if (Type(value) === 'String') { return value; } return $StringValueOf(value); }; es-abstract-1.20.4/2019/thisSymbolValue.js000066400000000000000000000010021431761430200200630ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-thissymbolvalue module.exports = function thisSymbolValue(value) { if (!$SymbolValueOf) { throw new SyntaxError('Symbols are not supported; thisSymbolValue requires that `value` be a Symbol or a Symbol object'); } if (Type(value) === 'Symbol') { return value; } return $SymbolValueOf(value); }; es-abstract-1.20.4/2019/thisTimeValue.js000066400000000000000000000001021431761430200175140ustar00rootroot00000000000000'use strict'; module.exports = require('../2018/thisTimeValue'); es-abstract-1.20.4/2020/000077500000000000000000000000001431761430200143725ustar00rootroot00000000000000es-abstract-1.20.4/2020/AbstractEqualityComparison.js000066400000000000000000000035211431761430200222450ustar00rootroot00000000000000'use strict'; var StrictEqualityComparison = require('./StrictEqualityComparison'); var StringToBigInt = require('./StringToBigInt'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); var isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/11.0/#sec-abstract-equality-comparison module.exports = function AbstractEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType === yType) { return StrictEqualityComparison(x, y); } if (x == null && y == null) { return true; } if (xType === 'Number' && yType === 'String') { return AbstractEqualityComparison(x, ToNumber(y)); } if (xType === 'String' && yType === 'Number') { return AbstractEqualityComparison(ToNumber(x), y); } if (xType === 'BigInt' && yType === 'String') { var n = StringToBigInt(y); if (isNaN(n)) { return false; } return AbstractEqualityComparison(x, n); } if (xType === 'String' && yType === 'BigInt') { return AbstractEqualityComparison(y, x); } if (xType === 'Boolean') { return AbstractEqualityComparison(ToNumber(x), y); } if (yType === 'Boolean') { return AbstractEqualityComparison(x, ToNumber(y)); } if ((xType === 'String' || xType === 'Number' || xType === 'BigInt' || xType === 'Symbol') && yType === 'Object') { return AbstractEqualityComparison(x, ToPrimitive(y)); } if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'BigInt' || yType === 'Symbol')) { return AbstractEqualityComparison(ToPrimitive(x), y); } if ((xType === 'BigInt' && yType === 'Number') || (xType === 'Number' && yType === 'BigInt')) { if (isNaN(x) || isNaN(y) || x === Infinity || y === Infinity || x === -Infinity || y === -Infinity) { return false; } return x == y; // eslint-disable-line eqeqeq } return false; }; es-abstract-1.20.4/2020/AbstractRelationalComparison.js000066400000000000000000000041111431761430200225360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var IsStringPrefix = require('./IsStringPrefix'); var StringToBigInt = require('./StringToBigInt'); var ToNumeric = require('./ToNumeric'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); var BigIntLessThan = require('./BigInt/lessThan'); var NumberLessThan = require('./Number/lessThan'); // https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); } var px; var py; if (LeftFirst) { px = ToPrimitive(x, $Number); py = ToPrimitive(y, $Number); } else { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } if (Type(px) === 'String' && Type(py) === 'String') { if (IsStringPrefix(py, px)) { return false; } if (IsStringPrefix(px, py)) { return true; } return px < py; // both strings, neither a prefix of the other. shortcut for steps 3 c-f } var pxType = Type(px); var pyType = Type(py); var nx; var ny; if (pxType === 'BigInt' && pyType === 'String') { ny = StringToBigInt(py); if ($isNaN(ny)) { return void undefined; } return BigIntLessThan(px, ny); } if (pxType === 'String' && pyType === 'BigInt') { nx = StringToBigInt(px); if ($isNaN(nx)) { return void undefined; } return BigIntLessThan(px, ny); } nx = ToNumeric(px); ny = ToNumeric(py); var nxType = Type(nx); if (nxType === Type(ny)) { return nxType === 'Number' ? NumberLessThan(nx, ny) : BigIntLessThan(nx, ny); } if ($isNaN(nx) || $isNaN(ny)) { return void undefined; } if (nx === -Infinity || ny === Infinity) { return true; } if (nx === Infinity || ny === -Infinity) { return false; } return nx < ny; // by now, these are both nonzero, finite, and not equal }; es-abstract-1.20.4/2020/AddEntriesFromIterable.js000066400000000000000000000027571431761430200212610ustar00rootroot00000000000000'use strict'; var inspect = require('object-inspect'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var GetIterator = require('./GetIterator'); var IsCallable = require('./IsCallable'); var IteratorClose = require('./IteratorClose'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); var Type = require('./Type'); // https://262.ecma-international.org/10.0//#sec-add-entries-from-iterable module.exports = function AddEntriesFromIterable(target, iterable, adder) { if (!IsCallable(adder)) { throw new $TypeError('Assertion failed: `adder` is not callable'); } if (iterable == null) { throw new $TypeError('Assertion failed: `iterable` is present, and not nullish'); } var iteratorRecord = GetIterator(iterable); while (true) { // eslint-disable-line no-constant-condition var next = IteratorStep(iteratorRecord); if (!next) { return target; } var nextItem = IteratorValue(next); if (Type(nextItem) !== 'Object') { var error = new $TypeError('iterator next must return an Object, got ' + inspect(nextItem)); return IteratorClose( iteratorRecord, function () { throw error; } // eslint-disable-line no-loop-func ); } try { var k = Get(nextItem, '0'); var v = Get(nextItem, '1'); Call(adder, target, [k, v]); } catch (e) { return IteratorClose( iteratorRecord, function () { throw e; } ); } } }; es-abstract-1.20.4/2020/AdvanceStringIndex.js000066400000000000000000000017271431761430200204570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var CodePointAt = require('./CodePointAt'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var $TypeError = GetIntrinsic('%TypeError%'); // https://262.ecma-international.org/6.0/#sec-advancestringindex module.exports = function AdvanceStringIndex(S, index, unicode) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53'); } if (Type(unicode) !== 'Boolean') { throw new $TypeError('Assertion failed: `unicode` must be a Boolean'); } if (!unicode) { return index + 1; } var length = S.length; if ((index + 1) >= length) { return index + 1; } var cp = CodePointAt(S, index); return index + cp['[[CodeUnitCount]]']; }; es-abstract-1.20.4/2020/ArrayCreate.js000066400000000000000000000031621431761430200171340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ArrayPrototype = GetIntrinsic('%Array.prototype%'); var $RangeError = GetIntrinsic('%RangeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || ( // eslint-disable-next-line no-proto, no-negated-condition [].__proto__ !== $ArrayPrototype ? null : function (O, proto) { O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign return O; } ); // https://ecma-international.org/ecma-262/6.0/#sec-arraycreate module.exports = function ArrayCreate(length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0'); } if (length > MAX_ARRAY_LENGTH) { throw new $RangeError('length is greater than (2**32 - 1)'); } var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype; var A = []; // steps 5 - 7, and 9 if (proto !== $ArrayPrototype) { // step 8 if (!$setProto) { throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } $setProto(A, proto); } if (length !== 0) { // bypasses the need for step 2 A.length = length; } /* step 10, the above as a shortcut for the below OrdinaryDefineOwnProperty(A, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': true }); */ return A; }; es-abstract-1.20.4/2020/ArraySetLength.js000066400000000000000000000051511431761430200176260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var assign = require('object.assign'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsArray = require('./IsArray'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function ArraySetLength(A, Desc) { if (!IsArray(A)) { throw new $TypeError('Assertion failed: A must be an Array'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!('[[Value]]' in Desc)) { return OrdinaryDefineOwnProperty(A, 'length', Desc); } var newLenDesc = assign({}, Desc); var newLen = ToUint32(Desc['[[Value]]']); var numberLen = ToNumber(Desc['[[Value]]']); if (newLen !== numberLen) { throw new $RangeError('Invalid array length'); } newLenDesc['[[Value]]'] = newLen; var oldLenDesc = OrdinaryGetOwnProperty(A, 'length'); if (!IsDataDescriptor(oldLenDesc)) { throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`'); } var oldLen = oldLenDesc['[[Value]]']; if (newLen >= oldLen) { return OrdinaryDefineOwnProperty(A, 'length', newLenDesc); } if (!oldLenDesc['[[Writable]]']) { return false; } var newWritable; if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) { newWritable = true; } else { newWritable = false; newLenDesc['[[Writable]]'] = true; } var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc); if (!succeeded) { return false; } while (newLen < oldLen) { oldLen -= 1; // eslint-disable-next-line no-param-reassign var deleteSucceeded = delete A[ToString(oldLen)]; if (!deleteSucceeded) { newLenDesc['[[Value]]'] = oldLen + 1; if (!newWritable) { newLenDesc['[[Writable]]'] = false; OrdinaryDefineOwnProperty(A, 'length', newLenDesc); return false; } } } if (!newWritable) { return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false }); } return true; }; es-abstract-1.20.4/2020/ArraySpeciesCreate.js000066400000000000000000000025041431761430200204470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Array = GetIntrinsic('%Array%'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsConstructor = require('./IsConstructor'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate module.exports = function ArraySpeciesCreate(originalArray, length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: length must be an integer >= 0'); } var len = length === 0 ? 0 : length; var C; var isArray = IsArray(originalArray); if (isArray) { C = Get(originalArray, 'constructor'); // TODO: figure out how to make a cross-realm normal Array, a same-realm Array // if (IsConstructor(C)) { // if C is another realm's Array, C = undefined // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ? // } if ($species && Type(C) === 'Object') { C = Get(C, $species); if (C === null) { C = void 0; } } } if (typeof C === 'undefined') { return $Array(len); } if (!IsConstructor(C)) { throw new $TypeError('C must be a constructor'); } return new C(len); // Construct(C, len); }; es-abstract-1.20.4/2020/BigInt/000077500000000000000000000000001431761430200155465ustar00rootroot00000000000000es-abstract-1.20.4/2020/BigInt/add.js000066400000000000000000000007131431761430200166350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-add module.exports = function BigIntAdd(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x + y; }; es-abstract-1.20.4/2020/BigInt/bitwiseAND.js000066400000000000000000000007671431761430200201070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var BigIntBitwiseOp = require('../BigIntBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseAND module.exports = function BigIntBitwiseAND(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntBitwiseOp('&', x, y); }; es-abstract-1.20.4/2020/BigInt/bitwiseNOT.js000066400000000000000000000007021431761430200201320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseNOT module.exports = function BigIntBitwiseNOT(x) { if (Type(x) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` argument must be a BigInt'); } return -x - $BigInt(1); }; es-abstract-1.20.4/2020/BigInt/bitwiseOR.js000066400000000000000000000007651431761430200200230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var BigIntBitwiseOp = require('../BigIntBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseOR module.exports = function BigIntBitwiseOR(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntBitwiseOp('|', x, y); }; es-abstract-1.20.4/2020/BigInt/bitwiseXOR.js000066400000000000000000000007671431761430200201550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var BigIntBitwiseOp = require('../BigIntBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseXOR module.exports = function BigIntBitwiseXOR(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntBitwiseOp('^', x, y); }; es-abstract-1.20.4/2020/BigInt/divide.js000066400000000000000000000011671431761430200173550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-divide module.exports = function BigIntDivide(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } if (y === $BigInt(0)) { throw new $RangeError('Division by zero'); } // shortcut for the actual spec mechanics return x / y; }; es-abstract-1.20.4/2020/BigInt/equal.js000066400000000000000000000007201431761430200172120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-equal module.exports = function BigIntEqual(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x === y; }; es-abstract-1.20.4/2020/BigInt/exponentiate.js000066400000000000000000000015671431761430200206200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-exponentiate module.exports = function BigIntExponentiate(base, exponent) { if (Type(base) !== 'BigInt' || Type(exponent) !== 'BigInt') { throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be BigInts'); } if (exponent < $BigInt(0)) { throw new $RangeError('Exponent must be positive'); } if (/* base === $BigInt(0) && */ exponent === $BigInt(0)) { return $BigInt(1); } var square = base; var remaining = exponent; while (remaining > $BigInt(0)) { square += exponent; --remaining; // eslint-disable-line no-plusplus } return square; }; es-abstract-1.20.4/2020/BigInt/index.js000066400000000000000000000023721431761430200172170ustar00rootroot00000000000000'use strict'; var add = require('./add'); var bitwiseAND = require('./bitwiseAND'); var bitwiseNOT = require('./bitwiseNOT'); var bitwiseOR = require('./bitwiseOR'); var bitwiseXOR = require('./bitwiseXOR'); var divide = require('./divide'); var equal = require('./equal'); var exponentiate = require('./exponentiate'); var leftShift = require('./leftShift'); var lessThan = require('./lessThan'); var multiply = require('./multiply'); var remainder = require('./remainder'); var sameValue = require('./sameValue'); var sameValueZero = require('./sameValueZero'); var signedRightShift = require('./signedRightShift'); var subtract = require('./subtract'); var toString = require('./toString'); var unaryMinus = require('./unaryMinus'); var unsignedRightShift = require('./unsignedRightShift'); module.exports = { add: add, bitwiseAND: bitwiseAND, bitwiseNOT: bitwiseNOT, bitwiseOR: bitwiseOR, bitwiseXOR: bitwiseXOR, divide: divide, equal: equal, exponentiate: exponentiate, leftShift: leftShift, lessThan: lessThan, multiply: multiply, remainder: remainder, sameValue: sameValue, sameValueZero: sameValueZero, signedRightShift: signedRightShift, subtract: subtract, toString: toString, unaryMinus: unaryMinus, unsignedRightShift: unsignedRightShift }; es-abstract-1.20.4/2020/BigInt/leftShift.js000066400000000000000000000007301431761430200200340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-leftShift module.exports = function BigIntLeftShift(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x << y; }; es-abstract-1.20.4/2020/BigInt/lessThan.js000066400000000000000000000007251431761430200176710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-lessThan module.exports = function BigIntLessThan(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x < y; }; es-abstract-1.20.4/2020/BigInt/multiply.js000066400000000000000000000007251431761430200177670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-multiply module.exports = function BigIntMultiply(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x * y; }; es-abstract-1.20.4/2020/BigInt/remainder.js000066400000000000000000000013021431761430200200460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var zero = $BigInt && $BigInt(0); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-remainder module.exports = function BigIntRemainder(n, d) { if (Type(n) !== 'BigInt' || Type(d) !== 'BigInt') { throw new $TypeError('Assertion failed: `n` and `d` arguments must be BigInts'); } if (d === zero) { throw new $RangeError('Division by zero'); } if (n === zero) { return zero; } // shortcut for the actual spec mechanics return n % d; }; es-abstract-1.20.4/2020/BigInt/sameValue.js000066400000000000000000000007361431761430200200340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var BigIntEqual = require('./equal'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValue module.exports = function BigIntSameValue(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntEqual(x, y); }; es-abstract-1.20.4/2020/BigInt/sameValueZero.js000066400000000000000000000007461431761430200206750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var BigIntEqual = require('./equal'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValueZero module.exports = function BigIntSameValueZero(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntEqual(x, y); }; es-abstract-1.20.4/2020/BigInt/signedRightShift.js000066400000000000000000000007711431761430200213560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var BigIntLeftShift = require('./leftShift'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-signedRightShift module.exports = function BigIntSignedRightShift(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntLeftShift(x, -y); }; es-abstract-1.20.4/2020/BigInt/subtract.js000066400000000000000000000007251431761430200177370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-subtract module.exports = function BigIntSubtract(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x - y; }; es-abstract-1.20.4/2020/BigInt/toString.js000066400000000000000000000006531431761430200177210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-tostring module.exports = function BigIntToString(x) { if (Type(x) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` must be a BigInt'); } return $String(x); }; es-abstract-1.20.4/2020/BigInt/unaryMinus.js000066400000000000000000000007771431761430200202710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var zero = $BigInt && $BigInt(0); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unaryMinus module.exports = function BigIntUnaryMinus(x) { if (Type(x) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` argument must be a BigInt'); } if (x === zero) { return zero; } return -x; }; es-abstract-1.20.4/2020/BigInt/unsignedRightShift.js000066400000000000000000000007761431761430200217260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unsignedRightShift module.exports = function BigIntUnsignedRightShift(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } throw new $TypeError('BigInts have no unsigned right shift, use >> instead'); }; es-abstract-1.20.4/2020/BigIntBitwiseOp.js000066400000000000000000000033071431761430200177350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // var $BigInt = GetIntrinsic('%BigInt%', true); // var $pow = GetIntrinsic('%Math.pow%'); // var BinaryAnd = require('./BinaryAnd'); // var BinaryOr = require('./BinaryOr'); // var BinaryXor = require('./BinaryXor'); var Type = require('./Type'); // var modulo = require('./modulo'); // var zero = $BigInt && $BigInt(0); // var negOne = $BigInt && $BigInt(-1); // var two = $BigInt && $BigInt(2); // https://262.ecma-international.org/11.0/#sec-bigintbitwiseop module.exports = function BigIntBitwiseOp(op, x, y) { if (op !== '&' && op !== '|' && op !== '^') { throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`'); } if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('`x` and `y` must be BigInts'); } if (op === '&') { return x & y; } if (op === '|') { return x | y; } return x ^ y; /* var result = zero; var shift = 0; while (x !== zero && x !== negOne && y !== zero && y !== negOne) { var xDigit = modulo(x, two); var yDigit = modulo(y, two); if (op === '&') { result += $pow(2, shift) * BinaryAnd(xDigit, yDigit); } else if (op === '|') { result += $pow(2, shift) * BinaryOr(xDigit, yDigit); } else if (op === '^') { result += $pow(2, shift) * BinaryXor(xDigit, yDigit); } shift += 1; x = (x - xDigit) / two; y = (y - yDigit) / two; } var tmp; if (op === '&') { tmp = BinaryAnd(modulo(x, two), modulo(y, two)); } else if (op === '|') { tmp = BinaryAnd(modulo(x, two), modulo(y, two)); } else { tmp = BinaryXor(modulo(x, two), modulo(y, two)); } if (tmp !== 0) { result -= $pow(2, shift); } return result; */ }; es-abstract-1.20.4/2020/BinaryAnd.js000066400000000000000000000005541431761430200166030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // https://262.ecma-international.org/11.0/#sec-binaryand module.exports = function BinaryAnd(x, y) { if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); } return x & y; }; es-abstract-1.20.4/2020/BinaryOr.js000066400000000000000000000005521431761430200164570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // https://262.ecma-international.org/11.0/#sec-binaryor module.exports = function BinaryOr(x, y) { if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); } return x | y; }; es-abstract-1.20.4/2020/BinaryXor.js000066400000000000000000000005541431761430200166510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // https://262.ecma-international.org/11.0/#sec-binaryxor module.exports = function BinaryXor(x, y) { if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); } return x ^ y; }; es-abstract-1.20.4/2020/Call.js000066400000000000000000000011571431761430200156070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsArray = require('./IsArray'); var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%'); // https://ecma-international.org/ecma-262/6.0/#sec-call module.exports = function Call(F, V) { var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } return $apply(F, V, argumentsList); }; es-abstract-1.20.4/2020/CanonicalNumericIndexString.js000066400000000000000000000012161431761430200223210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring module.exports = function CanonicalNumericIndexString(argument) { if (Type(argument) !== 'String') { throw new $TypeError('Assertion failed: `argument` must be a String'); } if (argument === '-0') { return -0; } var n = ToNumber(argument); if (SameValue(ToString(n), argument)) { return n; } return void 0; }; es-abstract-1.20.4/2020/CharacterRange.js000066400000000000000000000014161431761430200176030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = callBound('%String.prototype.charCodeAt%'); var $push = callBound('%Array.prototype.push%'); module.exports = function CharacterRange(A, B) { if (A.length !== 1 || B.length !== 1) { throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); } var a = A[0]; var b = B[0]; var i = $charCodeAt(a, 0); var j = $charCodeAt(b, 0); if (!(i <= j)) { throw new $TypeError('Assertion failed: i is not <= j'); } var arr = []; for (var k = i; k <= j; k += 1) { $push(arr, $fromCharCode(k)); } return arr; }; es-abstract-1.20.4/2020/CodePointAt.js000066400000000000000000000032701431761430200171030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var Type = require('./Type'); var UTF16DecodeSurrogatePair = require('./UTF16DecodeSurrogatePair'); var $charAt = callBound('String.prototype.charAt'); var $charCodeAt = callBound('String.prototype.charCodeAt'); // https://262.ecma-international.org/11.0/#sec-codepointat module.exports = function CodePointAt(string, position) { if (Type(string) !== 'String') { throw new $TypeError('Assertion failed: `string` must be a String'); } var size = string.length; if (position < 0 || position >= size) { throw new $TypeError('Assertion failed: `position` must be >= 0, and < the length of `string`'); } var first = $charCodeAt(string, position); var cp = $charAt(string, position); var firstIsLeading = isLeadingSurrogate(first); var firstIsTrailing = isTrailingSurrogate(first); if (!firstIsLeading && !firstIsTrailing) { return { '[[CodePoint]]': cp, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': false }; } if (firstIsTrailing || (position + 1 === size)) { return { '[[CodePoint]]': cp, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': true }; } var second = $charCodeAt(string, position + 1); if (!isTrailingSurrogate(second)) { return { '[[CodePoint]]': cp, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': true }; } return { '[[CodePoint]]': UTF16DecodeSurrogatePair(first, second), '[[CodeUnitCount]]': 2, '[[IsUnpairedSurrogate]]': false }; }; es-abstract-1.20.4/2020/CompletePropertyDescriptor.js000066400000000000000000000017351431761430200223120ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor module.exports = function CompletePropertyDescriptor(Desc) { /* eslint no-param-reassign: 0 */ assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (!has(Desc, '[[Value]]')) { Desc['[[Value]]'] = void 0; } if (!has(Desc, '[[Writable]]')) { Desc['[[Writable]]'] = false; } } else { if (!has(Desc, '[[Get]]')) { Desc['[[Get]]'] = void 0; } if (!has(Desc, '[[Set]]')) { Desc['[[Set]]'] = void 0; } } if (!has(Desc, '[[Enumerable]]')) { Desc['[[Enumerable]]'] = false; } if (!has(Desc, '[[Configurable]]')) { Desc['[[Configurable]]'] = false; } return Desc; }; es-abstract-1.20.4/2020/CopyDataProperties.js000066400000000000000000000035371431761430200205210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var every = require('../helpers/every'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-copydataproperties module.exports = function CopyDataProperties(target, source, excludedItems) { if (Type(target) !== 'Object') { throw new $TypeError('Assertion failed: "target" must be an Object'); } if (!IsArray(excludedItems) || !every(excludedItems, IsPropertyKey)) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } if (typeof source === 'undefined' || source === null) { return target; } var from = ToObject(source); var sourceKeys = OwnPropertyKeys(from); forEach(sourceKeys, function (nextKey) { var excluded = false; forEach(excludedItems, function (e) { if (SameValue(e, nextKey) === true) { excluded = true; } }); var enumerable = $isEnumerable(from, nextKey) || ( // this is to handle string keys being non-enumerable in older engines typeof source === 'string' && nextKey >= 0 && IsInteger(ToNumber(nextKey)) ); if (excluded === false && enumerable) { var propValue = Get(from, nextKey); CreateDataPropertyOrThrow(target, nextKey, propValue); } }); return target; }; es-abstract-1.20.4/2020/CreateDataProperty.js000066400000000000000000000023771431761430200205030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty module.exports = function CreateDataProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var oldDesc = OrdinaryGetOwnProperty(O, P); var extensible = !oldDesc || IsExtensible(O); var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]']; if (nonConfigurable || !extensible) { return false; } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Value]]': V, '[[Writable]]': true } ); }; es-abstract-1.20.4/2020/CreateDataPropertyOrThrow.js000066400000000000000000000013361431761430200220220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var CreateDataProperty = require('./CreateDataProperty'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var success = CreateDataProperty(O, P, V); if (!success) { throw new $TypeError('unable to create data property'); } return success; }; es-abstract-1.20.4/2020/CreateHTML.js000066400000000000000000000016371431761430200166270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $replace = callBound('String.prototype.replace'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createhtml module.exports = function CreateHTML(string, tag, attribute, value) { if (Type(tag) !== 'String' || Type(attribute) !== 'String') { throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings'); } var str = RequireObjectCoercible(string); var S = ToString(str); var p1 = '<' + tag; if (attribute !== '') { var V = ToString(value); var escapedV = $replace(V, /\x22/g, '"'); p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22'; } return p1 + '>' + S + ''; }; es-abstract-1.20.4/2020/CreateIterResultObject.js000066400000000000000000000006601431761430200213070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject module.exports = function CreateIterResultObject(value, done) { if (Type(done) !== 'Boolean') { throw new $TypeError('Assertion failed: Type(done) is not Boolean'); } return { value: value, done: done }; }; es-abstract-1.20.4/2020/CreateListFromArrayLike.js000066400000000000000000000025231431761430200214210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $indexOf = callBound('Array.prototype.indexOf', true) || callBound('String.prototype.indexOf'); var $push = callBound('Array.prototype.push'); var Get = require('./Get'); var IsArray = require('./IsArray'); var LengthOfArrayLike = require('./LengthOfArrayLike'); var ToString = require('./ToString'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-createlistfromarraylike module.exports = function CreateListFromArrayLike(obj) { var elementTypes = arguments.length > 1 ? arguments[1] : ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object']; if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } if (!IsArray(elementTypes)) { throw new $TypeError('Assertion failed: `elementTypes`, if provided, must be an array'); } var len = LengthOfArrayLike(obj); var list = []; var index = 0; while (index < len) { var indexName = ToString(index); var next = Get(obj, indexName); var nextType = Type(next); if ($indexOf(elementTypes, nextType) < 0) { throw new $TypeError('item type ' + nextType + ' is not a valid elementType'); } $push(list, next); index += 1; } return list; }; es-abstract-1.20.4/2020/CreateMethodProperty.js000066400000000000000000000017231431761430200210440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty module.exports = function CreateMethodProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var newDesc = { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': V, '[[Writable]]': true }; return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, newDesc ); }; es-abstract-1.20.4/2020/CreateRegExpStringIterator.js000066400000000000000000000071741431761430200221600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var IteratorPrototype = GetIntrinsic('%IteratorPrototype%', true); var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); var AdvanceStringIndex = require('./AdvanceStringIndex'); var CreateIterResultObject = require('./CreateIterResultObject'); var CreateMethodProperty = require('./CreateMethodProperty'); var Get = require('./Get'); var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); var RegExpExec = require('./RegExpExec'); var Set = require('./Set'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var Type = require('./Type'); var SLOT = require('internal-slot'); var RegExpStringIterator = function RegExpStringIterator(R, S, global, fullUnicode) { if (Type(S) !== 'String') { throw new $TypeError('`S` must be a string'); } if (Type(global) !== 'Boolean') { throw new $TypeError('`global` must be a boolean'); } if (Type(fullUnicode) !== 'Boolean') { throw new $TypeError('`fullUnicode` must be a boolean'); } SLOT.set(this, '[[IteratingRegExp]]', R); SLOT.set(this, '[[IteratedString]]', S); SLOT.set(this, '[[Global]]', global); SLOT.set(this, '[[Unicode]]', fullUnicode); SLOT.set(this, '[[Done]]', false); }; if (IteratorPrototype) { RegExpStringIterator.prototype = OrdinaryObjectCreate(IteratorPrototype); } var RegExpStringIteratorNext = function next() { var O = this; // eslint-disable-line no-invalid-this if (Type(O) !== 'Object') { throw new $TypeError('receiver must be an object'); } if ( !(O instanceof RegExpStringIterator) || !SLOT.has(O, '[[IteratingRegExp]]') || !SLOT.has(O, '[[IteratedString]]') || !SLOT.has(O, '[[Global]]') || !SLOT.has(O, '[[Unicode]]') || !SLOT.has(O, '[[Done]]') ) { throw new $TypeError('"this" value must be a RegExpStringIterator instance'); } if (SLOT.get(O, '[[Done]]')) { return CreateIterResultObject(undefined, true); } var R = SLOT.get(O, '[[IteratingRegExp]]'); var S = SLOT.get(O, '[[IteratedString]]'); var global = SLOT.get(O, '[[Global]]'); var fullUnicode = SLOT.get(O, '[[Unicode]]'); var match = RegExpExec(R, S); if (match === null) { SLOT.set(O, '[[Done]]', true); return CreateIterResultObject(undefined, true); } if (global) { var matchStr = ToString(Get(match, '0')); if (matchStr === '') { var thisIndex = ToLength(Get(R, 'lastIndex')); var nextIndex = AdvanceStringIndex(S, thisIndex, fullUnicode); Set(R, 'lastIndex', nextIndex, true); } return CreateIterResultObject(match, false); } SLOT.set(O, '[[Done]]', true); return CreateIterResultObject(match, false); }; CreateMethodProperty(RegExpStringIterator.prototype, 'next', RegExpStringIteratorNext); if (hasSymbols) { if (Symbol.toStringTag) { if ($defineProperty) { $defineProperty(RegExpStringIterator.prototype, Symbol.toStringTag, { configurable: true, enumerable: false, value: 'RegExp String Iterator', writable: false }); } else { RegExpStringIterator.prototype[Symbol.toStringTag] = 'RegExp String Iterator'; } } if (Symbol.iterator && typeof RegExpStringIterator.prototype[Symbol.iterator] !== 'function') { var iteratorFn = function SymbolIterator() { return this; }; CreateMethodProperty(RegExpStringIterator.prototype, Symbol.iterator, iteratorFn); } } // https://262.ecma-international.org/11.0/#sec-createregexpstringiterator module.exports = function CreateRegExpStringIterator(R, S, global, fullUnicode) { // assert R.global === global && R.unicode === fullUnicode? return new RegExpStringIterator(R, S, global, fullUnicode); }; es-abstract-1.20.4/2020/DateFromTime.js000066400000000000000000000020141431761430200172450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); var MonthFromTime = require('./MonthFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.5 module.exports = function DateFromTime(t) { var m = MonthFromTime(t); var d = DayWithinYear(t); if (m === 0) { return d + 1; } if (m === 1) { return d - 30; } var leap = InLeapYear(t); if (m === 2) { return d - 58 - leap; } if (m === 3) { return d - 89 - leap; } if (m === 4) { return d - 119 - leap; } if (m === 5) { return d - 150 - leap; } if (m === 6) { return d - 180 - leap; } if (m === 7) { return d - 211 - leap; } if (m === 8) { return d - 242 - leap; } if (m === 9) { return d - 272 - leap; } if (m === 10) { return d - 303 - leap; } if (m === 11) { return d - 333 - leap; } throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m); }; es-abstract-1.20.4/2020/DateString.js000066400000000000000000000020371431761430200167760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; var $isNaN = require('../helpers/isNaN'); var padTimeComponent = require('../helpers/padTimeComponent'); var Type = require('./Type'); var WeekDay = require('./WeekDay'); var MonthFromTime = require('./MonthFromTime'); var YearFromTime = require('./YearFromTime'); var DateFromTime = require('./DateFromTime'); // https://262.ecma-international.org/9.0/#sec-datestring module.exports = function DateString(tv) { if (Type(tv) !== 'Number' || $isNaN(tv)) { throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); } var weekday = weekdays[WeekDay(tv)]; var month = months[MonthFromTime(tv)]; var day = padTimeComponent(DateFromTime(tv)); var year = padTimeComponent(YearFromTime(tv), 4); return weekday + '\x20' + month + '\x20' + day + '\x20' + year; }; es-abstract-1.20.4/2020/Day.js000066400000000000000000000003521431761430200154450ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function Day(t) { return floor(t / msPerDay); }; es-abstract-1.20.4/2020/DayFromYear.js000066400000000000000000000004001431761430200171040ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DayFromYear(y) { return (365 * (y - 1970)) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400); }; es-abstract-1.20.4/2020/DayWithinYear.js000066400000000000000000000004361431761430200174540ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var DayFromYear = require('./DayFromYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function DayWithinYear(t) { return Day(t) - DayFromYear(YearFromTime(t)); }; es-abstract-1.20.4/2020/DaysInYear.js000066400000000000000000000004551431761430200167440ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DaysInYear(y) { if (modulo(y, 4) !== 0) { return 365; } if (modulo(y, 100) !== 0) { return 366; } if (modulo(y, 400) !== 0) { return 365; } return 366; }; es-abstract-1.20.4/2020/DefinePropertyOrThrow.js000066400000000000000000000026721431761430200212230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow module.exports = function DefinePropertyOrThrow(O, P, desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var Desc = isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, desc) ? desc : ToPropertyDescriptor(desc); if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor'); } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); }; es-abstract-1.20.4/2020/DeletePropertyOrThrow.js000066400000000000000000000012731431761430200212270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow module.exports = function DeletePropertyOrThrow(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // eslint-disable-next-line no-param-reassign var success = delete O[P]; if (!success) { throw new $TypeError('Attempt to delete property failed.'); } return success; }; es-abstract-1.20.4/2020/EnumerableOwnPropertyNames.js000066400000000000000000000021301431761430200222200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var objectKeys = require('object-keys'); var callBound = require('call-bind/callBound'); var callBind = require('call-bind'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%')); var forEach = require('../helpers/forEach'); var Type = require('./Type'); // https://262.ecma-international.org/8.0/#sec-enumerableownproperties module.exports = function EnumerableOwnPropertyNames(O, kind) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var keys = objectKeys(O); if (kind === 'key') { return keys; } if (kind === 'value' || kind === 'key+value') { var results = []; forEach(keys, function (key) { if ($isEnumerable(O, key)) { $pushApply(results, [ kind === 'value' ? O[key] : [key, O[key]] ]); } }); return results; } throw new $TypeError('Assertion failed: "kind" is not "key", "value", or "key+value": ' + kind); }; es-abstract-1.20.4/2020/FlattenIntoArray.js000066400000000000000000000033301431761430200201550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var Call = require('./Call'); var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var HasProperty = require('./HasProperty'); var IsArray = require('./IsArray'); var LengthOfArrayLike = require('./LengthOfArrayLike'); var ToString = require('./ToString'); // https://262.ecma-international.org/11.0/#sec-flattenintoarray // eslint-disable-next-line max-params module.exports = function FlattenIntoArray(target, source, sourceLen, start, depth) { var mapperFunction; if (arguments.length > 5) { mapperFunction = arguments[5]; } var targetIndex = start; var sourceIndex = 0; while (sourceIndex < sourceLen) { var P = ToString(sourceIndex); var exists = HasProperty(source, P); if (exists === true) { var element = Get(source, P); if (typeof mapperFunction !== 'undefined') { if (arguments.length <= 6) { throw new $TypeError('Assertion failed: thisArg is required when mapperFunction is provided'); } element = Call(mapperFunction, arguments[6], [element, sourceIndex, source]); } var shouldFlatten = false; if (depth > 0) { shouldFlatten = IsArray(element); } if (shouldFlatten) { var elementLen = LengthOfArrayLike(element); targetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1); } else { if (targetIndex >= MAX_SAFE_INTEGER) { throw new $TypeError('index too large'); } CreateDataPropertyOrThrow(target, ToString(targetIndex), element); targetIndex += 1; } } sourceIndex += 1; } return targetIndex; }; es-abstract-1.20.4/2020/FromPropertyDescriptor.js000066400000000000000000000007021431761430200214360ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor module.exports = function FromPropertyDescriptor(Desc) { if (typeof Desc !== 'undefined') { assertRecord(Type, 'Property Descriptor', 'Desc', Desc); } return fromPropertyDescriptor(Desc); }; es-abstract-1.20.4/2020/Get.js000066400000000000000000000011321431761430200154440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var inspect = require('object-inspect'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-get-o-p module.exports = function Get(O, P) { // 7.3.1.1 if (Type(O) !== 'Object') { 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)); } // 7.3.1.3 return O[P]; }; es-abstract-1.20.4/2020/GetIterator.js000066400000000000000000000032701431761430200171630ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $asyncIterator = GetIntrinsic('%Symbol.asyncIterator%', true); var inspect = require('object-inspect'); var hasSymbols = require('has-symbols')(); var getIteratorMethod = require('../helpers/getIteratorMethod'); var AdvanceStringIndex = require('./AdvanceStringIndex'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsArray = require('./IsArray'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-getiterator module.exports = function GetIterator(obj, hint, method) { var actualHint = hint; if (arguments.length < 2) { actualHint = 'sync'; } if (actualHint !== 'sync' && actualHint !== 'async') { throw new $TypeError("Assertion failed: `hint` must be one of 'sync' or 'async', got " + inspect(hint)); } var actualMethod = method; if (arguments.length < 3) { if (actualHint === 'async') { if (hasSymbols && $asyncIterator) { actualMethod = GetMethod(obj, $asyncIterator); } if (actualMethod === undefined) { throw new $TypeError("async from sync iterators aren't currently supported"); } } else { actualMethod = getIteratorMethod( { AdvanceStringIndex: AdvanceStringIndex, GetMethod: GetMethod, IsArray: IsArray }, obj ); } } var iterator = Call(actualMethod, obj); if (Type(iterator) !== 'Object') { throw new $TypeError('iterator must return an object'); } return iterator; // TODO: This should return an IteratorRecord /* var nextMethod = GetV(iterator, 'next'); return { '[[Iterator]]': iterator, '[[NextMethod]]': nextMethod, '[[Done]]': false }; */ }; es-abstract-1.20.4/2020/GetMethod.js000066400000000000000000000012271431761430200166120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-getmethod module.exports = function GetMethod(O, P) { // 7.3.9.1 if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // 7.3.9.2 var func = GetV(O, P); // 7.3.9.4 if (func == null) { return void 0; } // 7.3.9.5 if (!IsCallable(func)) { throw new $TypeError(P + 'is not a function'); } // 7.3.9.6 return func; }; es-abstract-1.20.4/2020/GetOwnPropertyKeys.js000066400000000000000000000014751431761430200205430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%', true); var keys = require('object-keys'); var esType = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys module.exports = function GetOwnPropertyKeys(O, Type) { if (esType(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (Type === 'Symbol') { return $gOPS ? $gOPS(O) : []; } if (Type === 'String') { if (!$gOPN) { return keys(O); } return $gOPN(O); } throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`'); }; es-abstract-1.20.4/2020/GetPrototypeFromConstructor.js000066400000000000000000000016311431761430200224700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Function = GetIntrinsic('%Function%'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic if (!IsConstructor(constructor)) { throw new $TypeError('Assertion failed: `constructor` must be a constructor'); } var proto = Get(constructor, 'prototype'); if (Type(proto) !== 'Object') { if (!(constructor instanceof $Function)) { // ignore other realms, for now throw new $TypeError('cross-realm constructors not currently supported'); } proto = intrinsic; } return proto; }; es-abstract-1.20.4/2020/GetSubstitution.js000066400000000000000000000104721431761430200201100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var every = require('../helpers/every'); var $charAt = callBound('String.prototype.charAt'); var $strSlice = callBound('String.prototype.slice'); var $indexOf = callBound('String.prototype.indexOf'); var $parseInt = parseInt; var isDigit = regexTester(/^[0-9]$/); var inspect = require('object-inspect'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsInteger = require('./IsInteger'); var ToObject = require('./ToObject'); var ToString = require('./ToString'); var Type = require('./Type'); var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false var isStringOrHole = function (capture, index, arr) { return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined'); }; // http://262.ecma-international.org/9.0/#sec-getsubstitution // eslint-disable-next-line max-statements, max-params, max-lines-per-function module.exports = function GetSubstitution(matched, str, position, captures, namedCaptures, replacement) { if (Type(matched) !== 'String') { throw new $TypeError('Assertion failed: `matched` must be a String'); } var matchLength = matched.length; if (Type(str) !== 'String') { throw new $TypeError('Assertion failed: `str` must be a String'); } var stringLength = str.length; if (!IsInteger(position) || position < 0 || position > stringLength) { throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position)); } if (!IsArray(captures) || !every(captures, isStringOrHole)) { throw new $TypeError('Assertion failed: `captures` must be a List of Strings, got ' + inspect(captures)); } if (Type(replacement) !== 'String') { throw new $TypeError('Assertion failed: `replacement` must be a String'); } var tailPos = position + matchLength; var m = captures.length; if (Type(namedCaptures) !== 'Undefined') { namedCaptures = ToObject(namedCaptures); // eslint-disable-line no-param-reassign } var result = ''; for (var i = 0; i < replacement.length; i += 1) { // if this is a $, and it's not the end of the replacement var current = $charAt(replacement, i); var isLast = (i + 1) >= replacement.length; var nextIsLast = (i + 2) >= replacement.length; if (current === '$' && !isLast) { var next = $charAt(replacement, i + 1); if (next === '$') { result += '$'; i += 1; } else if (next === '&') { result += matched; i += 1; } else if (next === '`') { result += position === 0 ? '' : $strSlice(str, 0, position - 1); i += 1; } else if (next === "'") { result += tailPos >= stringLength ? '' : $strSlice(str, tailPos); i += 1; } else { var nextNext = nextIsLast ? null : $charAt(replacement, i + 2); if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) { // $1 through $9, and not followed by a digit var n = $parseInt(next, 10); // if (n > m, impl-defined) result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1]; i += 1; } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) { // $00 through $99 var nn = next + nextNext; var nnI = $parseInt(nn, 10) - 1; // if nn === '00' or nn > m, impl-defined result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI]; i += 2; } else if (next === '<') { // eslint-disable-next-line max-depth if (Type(namedCaptures) === 'Undefined') { result += '$<'; i += 2; } else { var endIndex = $indexOf(replacement, '>', i); // eslint-disable-next-line max-depth if (endIndex > -1) { var groupName = $strSlice(replacement, i + '$<'.length, endIndex); var capture = Get(namedCaptures, groupName); // eslint-disable-next-line max-depth if (Type(capture) !== 'Undefined') { result += ToString(capture); } i += ('<' + groupName + '>').length; } } } else { result += '$'; } } } else { // the final $, or else not a $ result += $charAt(replacement, i); } } return result; }; es-abstract-1.20.4/2020/GetV.js000066400000000000000000000007321431761430200155770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var ToObject = require('./ToObject'); // https://ecma-international.org/ecma-262/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'); } // 7.3.2.2-3 var O = ToObject(V); // 7.3.2.4 return O[P]; }; es-abstract-1.20.4/2020/HasOwnProperty.js000066400000000000000000000010511431761430200176710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var has = require('has'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty module.exports = function HasOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return has(O, P); }; es-abstract-1.20.4/2020/HasProperty.js000066400000000000000000000010051431761430200172040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty module.exports = function HasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2020/HourFromTime.js000066400000000000000000000005761431761430200173200ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerHour = timeConstants.msPerHour; var HoursPerDay = timeConstants.HoursPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function HourFromTime(t) { return modulo(floor(t / msPerHour), HoursPerDay); }; es-abstract-1.20.4/2020/InLeapYear.js000066400000000000000000000007761431761430200167330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DaysInYear = require('./DaysInYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function InLeapYear(t) { var days = DaysInYear(YearFromTime(t)); if (days === 365) { return 0; } if (days === 366) { return 1; } throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days); }; es-abstract-1.20.4/2020/InstanceofOperator.js000066400000000000000000000016261431761430200205420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $hasInstance = GetIntrinsic('Symbol.hasInstance', true); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var OrdinaryHasInstance = require('./OrdinaryHasInstance'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator module.exports = function InstanceofOperator(O, C) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var instOfHandler = $hasInstance ? GetMethod(C, $hasInstance) : void 0; if (typeof instOfHandler !== 'undefined') { return ToBoolean(Call(instOfHandler, C, [O])); } if (!IsCallable(C)) { throw new $TypeError('`C` is not Callable'); } return OrdinaryHasInstance(C, O); }; es-abstract-1.20.4/2020/Invoke.js000066400000000000000000000013131431761430200161610ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-invoke module.exports = function Invoke(O, P) { if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } var func = GetV(O, P); return Call(func, O, argumentsList); }; es-abstract-1.20.4/2020/IsAccessorDescriptor.js000066400000000000000000000007211431761430200210250ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor module.exports = function IsAccessorDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { return false; } return true; }; es-abstract-1.20.4/2020/IsArray.js000066400000000000000000000001731431761430200163030ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-isarray module.exports = require('../helpers/IsArray'); es-abstract-1.20.4/2020/IsBigIntElementType.js000066400000000000000000000003021431761430200205470ustar00rootroot00000000000000'use strict'; // https://262.ecma-international.org/11.0/#sec-isbigintelementtype module.exports = function IsBigIntElementType(type) { return type === 'BigUint64' || type === 'BigInt64'; }; es-abstract-1.20.4/2020/IsCallable.js000066400000000000000000000001541431761430200167230ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.11 module.exports = require('is-callable'); es-abstract-1.20.4/2020/IsCompatiblePropertyDescriptor.js000066400000000000000000000005571431761430200231160ustar00rootroot00000000000000'use strict'; var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); }; es-abstract-1.20.4/2020/IsConcatSpreadable.js000066400000000000000000000011621431761430200204160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable module.exports = function IsConcatSpreadable(O) { if (Type(O) !== 'Object') { return false; } if ($isConcatSpreadable) { var spreadable = Get(O, $isConcatSpreadable); if (typeof spreadable !== 'undefined') { return ToBoolean(spreadable); } } return IsArray(O); }; es-abstract-1.20.4/2020/IsConstructor.js000066400000000000000000000021751431761430200175560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('../GetIntrinsic.js'); var $construct = GetIntrinsic('%Reflect.construct%', true); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); try { DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} }); } catch (e) { // Accessor properties aren't supported DefinePropertyOrThrow = null; } // https://ecma-international.org/ecma-262/6.0/#sec-isconstructor if (DefinePropertyOrThrow && $construct) { var isConstructorMarker = {}; var badArrayLike = {}; DefinePropertyOrThrow(badArrayLike, 'length', { '[[Get]]': function () { throw isConstructorMarker; }, '[[Enumerable]]': true }); module.exports = function IsConstructor(argument) { try { // `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`: $construct(argument, badArrayLike); } catch (err) { return err === isConstructorMarker; } }; } else { module.exports = function IsConstructor(argument) { // unfortunately there's no way to truly check this without try/catch `new argument` in old environments return typeof argument === 'function' && !!argument.prototype; }; } es-abstract-1.20.4/2020/IsDataDescriptor.js000066400000000000000000000007201431761430200201330ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor module.exports = function IsDataDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { return false; } return true; }; es-abstract-1.20.4/2020/IsExtensible.js000066400000000000000000000007751431761430200173370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $isExtensible = GetIntrinsic('%Object.isExtensible%', true); var isPrimitive = require('../helpers/isPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o module.exports = $preventExtensions ? function IsExtensible(obj) { return !isPrimitive(obj) && $isExtensible(obj); } : function IsExtensible(obj) { return !isPrimitive(obj); }; es-abstract-1.20.4/2020/IsGenericDescriptor.js000066400000000000000000000010601431761430200206340ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor module.exports = function IsGenericDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) { return true; } return false; }; es-abstract-1.20.4/2020/IsInteger.js000066400000000000000000000007021431761430200166200ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); // https://ecma-international.org/ecma-262/6.0/#sec-isinteger module.exports = function IsInteger(argument) { if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) { return false; } var absValue = abs(argument); return floor(absValue) === absValue; }; es-abstract-1.20.4/2020/IsNoTearConfiguration.js000066400000000000000000000007231431761430200211460ustar00rootroot00000000000000'use strict'; var IsUnclampedIntegerElementType = require('./IsUnclampedIntegerElementType'); var IsBigIntElementType = require('./IsBigIntElementType'); // https://262.ecma-international.org/11.0/#sec-isnotearconfiguration module.exports = function IsNoTearConfiguration(type, order) { if (IsUnclampedIntegerElementType(type)) { return true; } if (IsBigIntElementType(type) && order !== 'Init' && order !== 'Unordered') { return true; } return false; }; es-abstract-1.20.4/2020/IsNonNegativeInteger.js000066400000000000000000000003541431761430200207610ustar00rootroot00000000000000'use strict'; var IsInteger = require('./IsInteger'); // https://262.ecma-international.org/11.0/#sec-isnonnegativeinteger module.exports = function IsNonNegativeInteger(argument) { return !!IsInteger(argument) && argument >= 0; }; es-abstract-1.20.4/2020/IsPromise.js000066400000000000000000000007451431761430200166500ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $PromiseThen = callBound('Promise.prototype.then', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ispromise module.exports = function IsPromise(x) { if (Type(x) !== 'Object') { return false; } if (!$PromiseThen) { // Promises are not supported return false; } try { $PromiseThen(x); // throws if not a promise } catch (e) { return false; } return true; }; es-abstract-1.20.4/2020/IsPropertyKey.js000066400000000000000000000003171431761430200175220ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { return typeof argument === 'string' || typeof argument === 'symbol'; }; es-abstract-1.20.4/2020/IsRegExp.js000066400000000000000000000010411431761430200164120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $match = GetIntrinsic('%Symbol.match%', true); var hasRegExpMatcher = require('is-regex'); var ToBoolean = require('./ToBoolean'); // https://ecma-international.org/ecma-262/6.0/#sec-isregexp module.exports = function IsRegExp(argument) { if (!argument || typeof argument !== 'object') { return false; } if ($match) { var isRegExp = argument[$match]; if (typeof isRegExp !== 'undefined') { return ToBoolean(isRegExp); } } return hasRegExpMatcher(argument); }; es-abstract-1.20.4/2020/IsSharedArrayBuffer.js000066400000000000000000000007151431761430200205660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var isSharedArrayBuffer = require('is-shared-array-buffer'); // https://262.ecma-international.org/8.0/#sec-issharedarraybuffer module.exports = function IsSharedArrayBuffer(obj) { if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } return isSharedArrayBuffer(obj); }; es-abstract-1.20.4/2020/IsStringPrefix.js000066400000000000000000000016541431761430200176560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPrefixOf = require('../helpers/isPrefixOf'); // var callBound = require('call-bind/callBound'); // var $charAt = callBound('String.prototype.charAt'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-isstringprefix module.exports = function IsStringPrefix(p, q) { if (Type(p) !== 'String') { throw new $TypeError('Assertion failed: "p" must be a String'); } if (Type(q) !== 'String') { throw new $TypeError('Assertion failed: "q" must be a String'); } return isPrefixOf(p, q); /* if (p === q || p === '') { return true; } var pLength = p.length; var qLength = q.length; if (pLength >= qLength) { return false; } // assert: pLength < qLength for (var i = 0; i < pLength; i += 1) { if ($charAt(p, i) !== $charAt(q, i)) { return false; } } return true; */ }; es-abstract-1.20.4/2020/IsUnclampedIntegerElementType.js000066400000000000000000000004521431761430200226270ustar00rootroot00000000000000'use strict'; // https://262.ecma-international.org/11.0/#sec-isunclampedintegerelementtype module.exports = function IsUnclampedIntegerElementType(type) { return type === 'Int8' || type === 'Uint8' || type === 'Int16' || type === 'Uint16' || type === 'Int32' || type === 'Uint32'; }; es-abstract-1.20.4/2020/IsUnsignedElementType.js000066400000000000000000000004121431761430200211510ustar00rootroot00000000000000'use strict'; // https://262.ecma-international.org/11.0/#sec-isunsignedelementtype module.exports = function IsUnsignedElementType(type) { return type === 'Uint8' || type === 'Uint8C' || type === 'Uint16' || type === 'Uint32' || type === 'BigUint64'; }; es-abstract-1.20.4/2020/IterableToList.js000066400000000000000000000011631431761430200176170ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $arrayPush = callBound('Array.prototype.push'); var GetIterator = require('./GetIterator'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); // https://262.ecma-international.org/9.0/#sec-iterabletolist module.exports = function IterableToList(items, method) { var iterator = GetIterator(items, 'sync', method); var values = []; var next = true; while (next) { next = IteratorStep(iterator); if (next) { var nextValue = IteratorValue(next); $arrayPush(values, nextValue); } } return values; }; es-abstract-1.20.4/2020/IteratorClose.js000066400000000000000000000027111431761430200175100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose module.exports = function IteratorClose(iterator, completion) { if (Type(iterator) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterator) is not Object'); } if (!IsCallable(completion)) { throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record'); } var completionThunk = completion; var iteratorReturn = GetMethod(iterator, 'return'); if (typeof iteratorReturn === 'undefined') { return completionThunk(); } var completionRecord; try { var innerResult = Call(iteratorReturn, iterator, []); } catch (e) { // if we hit here, then "e" is the innerResult completion that needs re-throwing // if the completion is of type "throw", this will throw. completionThunk(); completionThunk = null; // ensure it's not called twice. // if not, then return the innerResult completion throw e; } completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does completionThunk = null; // ensure it's not called twice. if (Type(innerResult) !== 'Object') { throw new $TypeError('iterator .return must return an object'); } return completionRecord; }; es-abstract-1.20.4/2020/IteratorComplete.js000066400000000000000000000007621431761430200202170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete module.exports = function IteratorComplete(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return ToBoolean(Get(iterResult, 'done')); }; es-abstract-1.20.4/2020/IteratorNext.js000066400000000000000000000007551431761430200173670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Invoke = require('./Invoke'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext module.exports = function IteratorNext(iterator, value) { var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]); if (Type(result) !== 'Object') { throw new $TypeError('iterator next must return an object'); } return result; }; es-abstract-1.20.4/2020/IteratorStep.js000066400000000000000000000005411431761430200173550ustar00rootroot00000000000000'use strict'; var IteratorComplete = require('./IteratorComplete'); var IteratorNext = require('./IteratorNext'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep module.exports = function IteratorStep(iterator) { var result = IteratorNext(iterator); var done = IteratorComplete(result); return done === true ? false : result; }; es-abstract-1.20.4/2020/IteratorValue.js000066400000000000000000000006731431761430200175240ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue module.exports = function IteratorValue(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return Get(iterResult, 'value'); }; es-abstract-1.20.4/2020/LengthOfArrayLike.js000066400000000000000000000007571431761430200202530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToLength = require('./ToLength'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-lengthofarraylike module.exports = function LengthOfArrayLike(obj) { if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } return ToLength(Get(obj, 'length')); }; // TODO: use this all over es-abstract-1.20.4/2020/MakeDate.js000066400000000000000000000005101431761430200163770ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.13 module.exports = function MakeDate(day, time) { if (!$isFinite(day) || !$isFinite(time)) { return NaN; } return (day * msPerDay) + time; }; es-abstract-1.20.4/2020/MakeDay.js000066400000000000000000000016251431761430200162470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $DateUTC = GetIntrinsic('%Date.UTC%'); var $isFinite = require('../helpers/isFinite'); var DateFromTime = require('./DateFromTime'); var Day = require('./Day'); var floor = require('./floor'); var modulo = require('./modulo'); var MonthFromTime = require('./MonthFromTime'); var ToInteger = require('./ToInteger'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.12 module.exports = function MakeDay(year, month, date) { if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { return NaN; } var y = ToInteger(year); var m = ToInteger(month); var dt = ToInteger(date); var ym = y + floor(m / 12); var mn = modulo(m, 12); var t = $DateUTC(ym, mn, 1); if (YearFromTime(t) !== ym || MonthFromTime(t) !== mn || DateFromTime(t) !== 1) { return NaN; } return Day(t) + dt - 1; }; es-abstract-1.20.4/2020/MakeTime.js000066400000000000000000000012721431761430200164260ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var msPerMinute = timeConstants.msPerMinute; var msPerHour = timeConstants.msPerHour; var ToInteger = require('./ToInteger'); // https://262.ecma-international.org/5.1/#sec-15.9.1.11 module.exports = function MakeTime(hour, min, sec, ms) { if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { return NaN; } var h = ToInteger(hour); var m = ToInteger(min); var s = ToInteger(sec); var milli = ToInteger(ms); var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; return t; }; es-abstract-1.20.4/2020/MinFromTime.js000066400000000000000000000006141431761430200171170ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerMinute = timeConstants.msPerMinute; var MinutesPerHour = timeConstants.MinutesPerHour; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function MinFromTime(t) { return modulo(floor(t / msPerMinute), MinutesPerHour); }; es-abstract-1.20.4/2020/MonthFromTime.js000066400000000000000000000017661431761430200174720ustar00rootroot00000000000000'use strict'; var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function MonthFromTime(t) { var day = DayWithinYear(t); if (0 <= day && day < 31) { return 0; } var leap = InLeapYear(t); if (31 <= day && day < (59 + leap)) { return 1; } if ((59 + leap) <= day && day < (90 + leap)) { return 2; } if ((90 + leap) <= day && day < (120 + leap)) { return 3; } if ((120 + leap) <= day && day < (151 + leap)) { return 4; } if ((151 + leap) <= day && day < (181 + leap)) { return 5; } if ((181 + leap) <= day && day < (212 + leap)) { return 6; } if ((212 + leap) <= day && day < (243 + leap)) { return 7; } if ((243 + leap) <= day && day < (273 + leap)) { return 8; } if ((273 + leap) <= day && day < (304 + leap)) { return 9; } if ((304 + leap) <= day && day < (334 + leap)) { return 10; } if ((334 + leap) <= day && day < (365 + leap)) { return 11; } }; es-abstract-1.20.4/2020/Number/000077500000000000000000000000001431761430200156225ustar00rootroot00000000000000es-abstract-1.20.4/2020/Number/add.js000066400000000000000000000017001431761430200167060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-add module.exports = function NumberAdd(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y) || (x === Infinity && y === -Infinity) || (x === -Infinity && y === Infinity)) { return NaN; } if ((x === Infinity && y === Infinity) || (x === -Infinity && y === -Infinity)) { return x; } if (x === Infinity) { return x; } if (y === Infinity) { return y; } if (x === y && x === 0) { return Infinity / x === -Infinity && Infinity / y === -Infinity ? -0 : +0; } if (x === -y || -x === y) { return +0; } // shortcut for the actual spec mechanics return x + y; }; es-abstract-1.20.4/2020/Number/bitwiseAND.js000066400000000000000000000007671431761430200201630ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var NumberBitwiseOp = require('../NumberBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseAND module.exports = function NumberBitwiseAND(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberBitwiseOp('&', x, y); }; es-abstract-1.20.4/2020/Number/bitwiseNOT.js000066400000000000000000000011021431761430200202010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseNOT module.exports = function NumberBitwiseNOT(x) { if (Type(x) !== 'Number') { throw new $TypeError('Assertion failed: `x` argument must be a Number'); } var oldValue = ToInt32(x); // Return the result of applying the bitwise operator op to lnum and rnum. The result is a signed 32-bit integer. return ~oldValue; }; es-abstract-1.20.4/2020/Number/bitwiseOR.js000066400000000000000000000007651431761430200200770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var NumberBitwiseOp = require('../NumberBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseOR module.exports = function NumberBitwiseOR(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberBitwiseOp('|', x, y); }; es-abstract-1.20.4/2020/Number/bitwiseXOR.js000066400000000000000000000007671431761430200202310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var NumberBitwiseOp = require('../NumberBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseXOR module.exports = function NumberBitwiseXOR(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberBitwiseOp('^', x, y); }; es-abstract-1.20.4/2020/Number/divide.js000066400000000000000000000011761431761430200174310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isFinite = require('../../helpers/isFinite'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-divide module.exports = function NumberDivide(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y) || (!isFinite(x) && !isFinite(y))) { return NaN; } // shortcut for the actual spec mechanics return x / y; }; es-abstract-1.20.4/2020/Number/equal.js000066400000000000000000000010541431761430200172670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-equal module.exports = function NumberEqual(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y)) { return false; } // shortcut for the actual spec mechanics return x === y; }; es-abstract-1.20.4/2020/Number/exponentiate.js000066400000000000000000000033641431761430200206710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); // var isNegativeZero = require('is-negative-zero'); var $pow = GetIntrinsic('%Math.pow%'); var $TypeError = GetIntrinsic('%TypeError%'); /* var abs = require('../../helpers/abs'); var isFinite = require('../../helpers/isFinite'); var isNaN = require('../../helpers/isNaN'); var IsInteger = require('../IsInteger'); */ var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-exponentiate /* eslint max-lines-per-function: 0, max-statements: 0 */ module.exports = function NumberExponentiate(base, exponent) { if (Type(base) !== 'Number' || Type(exponent) !== 'Number') { throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be Numbers'); } return $pow(base, exponent); /* if (isNaN(exponent)) { return NaN; } if (exponent === 0) { return 1; } if (isNaN(base)) { return NaN; } var aB = abs(base); if (aB > 1 && exponent === Infinity) { return Infinity; } if (aB > 1 && exponent === -Infinity) { return 0; } if (aB === 1 && (exponent === Infinity || exponent === -Infinity)) { return NaN; } if (aB < 1 && exponent === Infinity) { return +0; } if (aB < 1 && exponent === -Infinity) { return Infinity; } if (base === Infinity) { return exponent > 0 ? Infinity : 0; } if (base === -Infinity) { var isOdd = true; if (exponent > 0) { return isOdd ? -Infinity : Infinity; } return isOdd ? -0 : 0; } if (exponent > 0) { return isNegativeZero(base) ? Infinity : 0; } if (isNegativeZero(base)) { if (exponent > 0) { return isOdd ? -0 : 0; } return isOdd ? -Infinity : Infinity; } if (base < 0 && isFinite(base) && isFinite(exponent) && !IsInteger(exponent)) { return NaN; } */ }; es-abstract-1.20.4/2020/Number/index.js000066400000000000000000000023721431761430200172730ustar00rootroot00000000000000'use strict'; var add = require('./add'); var bitwiseAND = require('./bitwiseAND'); var bitwiseNOT = require('./bitwiseNOT'); var bitwiseOR = require('./bitwiseOR'); var bitwiseXOR = require('./bitwiseXOR'); var divide = require('./divide'); var equal = require('./equal'); var exponentiate = require('./exponentiate'); var leftShift = require('./leftShift'); var lessThan = require('./lessThan'); var multiply = require('./multiply'); var remainder = require('./remainder'); var sameValue = require('./sameValue'); var sameValueZero = require('./sameValueZero'); var signedRightShift = require('./signedRightShift'); var subtract = require('./subtract'); var toString = require('./toString'); var unaryMinus = require('./unaryMinus'); var unsignedRightShift = require('./unsignedRightShift'); module.exports = { add: add, bitwiseAND: bitwiseAND, bitwiseNOT: bitwiseNOT, bitwiseOR: bitwiseOR, bitwiseXOR: bitwiseXOR, divide: divide, equal: equal, exponentiate: exponentiate, leftShift: leftShift, lessThan: lessThan, multiply: multiply, remainder: remainder, sameValue: sameValue, sameValueZero: sameValueZero, signedRightShift: signedRightShift, subtract: subtract, toString: toString, unaryMinus: unaryMinus, unsignedRightShift: unsignedRightShift }; es-abstract-1.20.4/2020/Number/leftShift.js000066400000000000000000000011271431761430200201110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var ToUint32 = require('../ToUint32'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-leftShift module.exports = function NumberLeftShift(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); var shiftCount = rnum & 0x1F; return lnum << shiftCount; }; es-abstract-1.20.4/2020/Number/lessThan.js000066400000000000000000000012021431761430200177340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-lessThan module.exports = function NumberLessThan(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } // If x is NaN, return undefined. // If y is NaN, return undefined. if (isNaN(x) || isNaN(y)) { return void undefined; } // shortcut for the actual spec mechanics return x < y; }; es-abstract-1.20.4/2020/Number/multiply.js000066400000000000000000000015201431761430200200350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-multiply module.exports = function NumberMultiply(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y) || (x === 0 && !isFinite(y)) || (!isFinite(x) && y === 0)) { return NaN; } if (!isFinite(x) && !isFinite(y)) { return x === y ? Infinity : -Infinity; } if (!isFinite(x) && y !== 0) { return x > 0 ? Infinity : -Infinity; } if (!isFinite(y) && x !== 0) { return y > 0 ? Infinity : -Infinity; } // shortcut for the actual spec mechanics return x * y; }; es-abstract-1.20.4/2020/Number/remainder.js000066400000000000000000000020201431761430200201200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-remainder module.exports = function NumberRemainder(n, d) { if (Type(n) !== 'Number' || Type(d) !== 'Number') { throw new $TypeError('Assertion failed: `n` and `d` arguments must be Numbers'); } // If either operand is NaN, the result is NaN. // If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN. if (isNaN(n) || isNaN(d) || !isFinite(n) || d === 0) { return NaN; } // If the dividend is finite and the divisor is an infinity, the result equals the dividend. // If the dividend is a zero and the divisor is nonzero and finite, the result is the same as the dividend. if (!isFinite(d) || (n === 0 && d !== 0)) { return n; } // In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved… return n % d; }; es-abstract-1.20.4/2020/Number/sameValue.js000066400000000000000000000011701431761430200201010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var isNegativeZero = require('is-negative-zero'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var NumberSameValueZero = require('./sameValueZero'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValue module.exports = function NumberSameValue(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (x === 0 && y === 0) { return !(isNegativeZero(x) ^ isNegativeZero(y)); } return NumberSameValueZero(x, y); }; es-abstract-1.20.4/2020/Number/sameValueZero.js000066400000000000000000000010771431761430200207470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValueZero module.exports = function NumberSameValueZero(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var xNaN = isNaN(x); var yNaN = isNaN(y); if (xNaN || yNaN) { return xNaN === yNaN; } return x === y; }; es-abstract-1.20.4/2020/Number/signedRightShift.js000066400000000000000000000011451431761430200214260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var ToUint32 = require('../ToUint32'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-signedRightShift module.exports = function NumberSignedRightShift(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); var shiftCount = rnum & 0x1F; return lnum >> shiftCount; }; es-abstract-1.20.4/2020/Number/subtract.js000066400000000000000000000006511431761430200200110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-subtract module.exports = function NumberSubtract(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return x - y; }; es-abstract-1.20.4/2020/Number/toString.js000066400000000000000000000006531431761430200177750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-tostring module.exports = function NumberToString(x) { if (Type(x) !== 'Number') { throw new $TypeError('Assertion failed: `x` must be a Number'); } return $String(x); }; es-abstract-1.20.4/2020/Number/unaryMinus.js000066400000000000000000000007261431761430200203370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-unaryMinus module.exports = function NumberUnaryMinus(x) { if (Type(x) !== 'Number') { throw new $TypeError('Assertion failed: `x` argument must be a Number'); } if (isNaN(x)) { return NaN; } return -x; }; es-abstract-1.20.4/2020/Number/unsignedRightShift.js000066400000000000000000000011521431761430200217670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var ToUint32 = require('../ToUint32'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-unsignedRightShift module.exports = function NumberUnsignedRightShift(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); var shiftCount = rnum & 0x1F; return lnum >>> shiftCount; }; es-abstract-1.20.4/2020/NumberBitwiseOp.js000066400000000000000000000013651431761430200200130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('./ToInt32'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-numberbitwiseop module.exports = function NumberBitwiseOp(op, x, y) { if (op !== '&' && op !== '|' && op !== '^') { throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`'); } if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); if (op === '&') { return lnum & rnum; } if (op === '|') { return lnum | rnum; } return lnum ^ rnum; }; es-abstract-1.20.4/2020/NumberToBigInt.js000066400000000000000000000014561431761430200175660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-numbertobigint module.exports = function NumberToBigInt(number) { if (Type(number) !== 'Number') { throw new $TypeError('Assertion failed: `number` must be a String'); } if (!IsInteger(number)) { throw new $RangeError('The number ' + number + ' cannot be converted to a BigInt because it is not an integer'); } if (!$BigInt) { throw new $SyntaxError('BigInts are not supported in this environment'); } return $BigInt(number); }; es-abstract-1.20.4/2020/ObjectDefineProperties.js000066400000000000000000000027441431761430200213350ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var Get = require('./Get'); var ToObject = require('./ToObject'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var forEach = require('../helpers/forEach'); var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $push = callBound('Array.prototype.push'); // https://262.ecma-international.org/6.0/#sec-objectdefineproperties module.exports = function ObjectDefineProperties(O, Properties) { var props = ToObject(Properties); // step 1 var keys = OwnPropertyKeys(props); // step 2 var descriptors = []; // step 3 forEach(keys, function (nextKey) { // step 4 var propDesc = ToPropertyDescriptor(getOwnPropertyDescriptor(props, nextKey)); // step 4.a if (typeof propDesc !== 'undefined' && propDesc['[[Enumerable]]']) { // step 4.b var descObj = Get(props, nextKey); // step 4.b.i var desc = ToPropertyDescriptor(descObj); // step 4.b.ii $push(descriptors, [nextKey, desc]); // step 4.b.iii } }); forEach(descriptors, function (pair) { // step 5 var P = pair[0]; // step 5.a var desc = pair[1]; // step 5.b desc = FromPropertyDescriptor(desc); // TODO: remove this once DefinePropertyOrThrow is fixed DefinePropertyOrThrow(O, P, desc); // step 5.c }); return O; // step 6 }; es-abstract-1.20.4/2020/OrdinaryCreateFromConstructor.js000066400000000000000000000014731431761430200227420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor'); var IsArray = require('./IsArray'); var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); // https://262.ecma-international.org/6.0/#sec-ordinarycreatefromconstructor module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto); var slots = arguments.length < 3 ? [] : arguments[2]; if (!IsArray(slots)) { throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List'); } return OrdinaryObjectCreate(proto, slots); }; es-abstract-1.20.4/2020/OrdinaryDefineOwnProperty.js000066400000000000000000000045261431761430200220720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var Type = require('./Type'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!$gOPD) { // ES3/IE 8 fallback if (IsAccessorDescriptor(Desc)) { throw new $SyntaxError('This environment does not support accessor property descriptors.'); } var creatingNormalDataProperty = !(P in O) && Desc['[[Writable]]'] && Desc['[[Enumerable]]'] && Desc['[[Configurable]]'] && '[[Value]]' in Desc; var settingExistingDataProperty = (P in O) && (!('[[Configurable]]' in Desc) || Desc['[[Configurable]]']) && (!('[[Enumerable]]' in Desc) || Desc['[[Enumerable]]']) && (!('[[Writable]]' in Desc) || Desc['[[Writable]]']) && '[[Value]]' in Desc; if (creatingNormalDataProperty || settingExistingDataProperty) { O[P] = Desc['[[Value]]']; // eslint-disable-line no-param-reassign return SameValue(O[P], Desc['[[Value]]']); } throw new $SyntaxError('This environment does not support defining non-writable, non-enumerable, or non-configurable properties'); } var desc = $gOPD(O, P); var current = desc && ToPropertyDescriptor(desc); var extensible = IsExtensible(O); return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current); }; es-abstract-1.20.4/2020/OrdinaryGetOwnProperty.js000066400000000000000000000023511431761430200214110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var has = require('has'); var IsArray = require('./IsArray'); var IsPropertyKey = require('./IsPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty module.exports = function OrdinaryGetOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!has(O, P)) { return void 0; } if (!$gOPD) { // ES3 / IE 8 fallback var arrayLength = IsArray(O) && P === 'length'; var regexLastIndex = IsRegExp(O) && P === 'lastIndex'; return { '[[Configurable]]': !(arrayLength || regexLastIndex), '[[Enumerable]]': $isEnumerable(O, P), '[[Value]]': O[P], '[[Writable]]': true }; } return ToPropertyDescriptor($gOPD(O, P)); }; es-abstract-1.20.4/2020/OrdinaryGetPrototypeOf.js000066400000000000000000000010331431761430200213670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $getProto = require('../helpers/getProto'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarygetprototypeof module.exports = function OrdinaryGetPrototypeOf(O) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!$getProto) { throw new $TypeError('This environment does not support fetching prototypes.'); } return $getProto(O); }; es-abstract-1.20.4/2020/OrdinaryHasInstance.js000066400000000000000000000011631431761430200206410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance module.exports = function OrdinaryHasInstance(C, O) { if (IsCallable(C) === false) { return false; } if (Type(O) !== 'Object') { return false; } var P = Get(C, 'prototype'); if (Type(P) !== 'Object') { throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.'); } return O instanceof C; }; es-abstract-1.20.4/2020/OrdinaryHasProperty.js000066400000000000000000000010231431761430200207140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty module.exports = function OrdinaryHasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2020/OrdinaryObjectCreate.js000066400000000000000000000026451431761430200210010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ObjectCreate = GetIntrinsic('%Object.create%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var IsArray = require('./IsArray'); var Type = require('./Type'); var hasProto = !({ __proto__: null } instanceof Object); // https://262.ecma-international.org/6.0/#sec-objectcreate module.exports = function OrdinaryObjectCreate(proto) { if (proto !== null && Type(proto) !== 'Object') { throw new $TypeError('Assertion failed: `proto` must be null or an object'); } var additionalInternalSlotsList = arguments.length < 2 ? [] : arguments[1]; if (!IsArray(additionalInternalSlotsList)) { throw new $TypeError('Assertion failed: `additionalInternalSlotsList` must be an Array'); } // var internalSlotsList = ['[[Prototype]]', '[[Extensible]]']; if (additionalInternalSlotsList.length > 0) { throw new $SyntaxError('es-abstract does not yet support internal slots'); // internalSlotsList.push(...additionalInternalSlotsList); } // var O = MakeBasicObject(internalSlotsList); // setProto(O, proto); // return O; if ($ObjectCreate) { return $ObjectCreate(proto); } if (hasProto) { return { __proto__: proto }; } if (proto === null) { throw new $SyntaxError('native Object.create support is required to create null objects'); } var T = function T() {}; T.prototype = proto; return new T(); }; es-abstract-1.20.4/2020/OrdinarySetPrototypeOf.js000066400000000000000000000020321431761430200214030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $setProto = require('../helpers/setProto'); var OrdinaryGetPrototypeOf = require('./OrdinaryGetPrototypeOf'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarysetprototypeof module.exports = function OrdinarySetPrototypeOf(O, V) { if (Type(V) !== 'Object' && Type(V) !== 'Null') { throw new $TypeError('Assertion failed: V must be Object or Null'); } /* var extensible = IsExtensible(O); var current = OrdinaryGetPrototypeOf(O); if (SameValue(V, current)) { return true; } if (!extensible) { return false; } */ try { $setProto(O, V); } catch (e) { return false; } return OrdinaryGetPrototypeOf(O) === V; /* var p = V; var done = false; while (!done) { if (p === null) { done = true; } else if (SameValue(p, O)) { return false; } else { if (wat) { done = true; } else { p = p.[[Prototype]]; } } } O.[[Prototype]] = V; return true; */ }; es-abstract-1.20.4/2020/OrdinaryToPrimitive.js000066400000000000000000000020511431761430200207110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); var inspect = require('object-inspect'); // https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive module.exports = function OrdinaryToPrimitive(O, hint) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); } var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; for (var i = 0; i < methodNames.length; i += 1) { var name = methodNames[i]; var method = Get(O, name); if (IsCallable(method)) { var result = Call(method, O); if (Type(result) !== 'Object') { return result; } } } throw new $TypeError('No primitive value for ' + inspect(O)); }; es-abstract-1.20.4/2020/PromiseResolve.js000066400000000000000000000007111431761430200177050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBind = require('call-bind'); var $resolve = GetIntrinsic('%Promise.resolve%', true); var $PromiseResolve = $resolve && callBind($resolve); // https://262.ecma-international.org/9.0/#sec-promise-resolve module.exports = function PromiseResolve(C, x) { if (!$PromiseResolve) { throw new SyntaxError('This environment does not support Promises.'); } return $PromiseResolve(C, x); }; es-abstract-1.20.4/2020/QuoteJSONString.js000066400000000000000000000025571431761430200177170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var Type = require('./Type'); var UnicodeEscape = require('./UnicodeEscape'); var UTF16Encoding = require('./UTF16Encoding'); var UTF16DecodeString = require('./UTF16DecodeString'); var has = require('has'); // https://262.ecma-international.org/11.0/#sec-quotejsonstring var escapes = { '\u0008': '\\b', '\u0009': '\\t', '\u000A': '\\n', '\u000C': '\\f', '\u000D': '\\r', '\u0022': '\\"', '\u005c': '\\\\' }; module.exports = function QuoteJSONString(value) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `value` must be a String'); } var product = '"'; if (value) { forEach(UTF16DecodeString(value), function (C) { if (has(escapes, C)) { product += escapes[C]; } else { var cCharCode = $charCodeAt(C, 0); if (cCharCode < 0x20 || isLeadingSurrogate(C) || isTrailingSurrogate(C)) { product += UnicodeEscape(C); } else { product += UTF16Encoding(cCharCode); } } }); } product += '"'; return product; }; es-abstract-1.20.4/2020/RegExpCreate.js000066400000000000000000000012031431761430200172420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RegExp = GetIntrinsic('%RegExp%'); // var RegExpAlloc = require('./RegExpAlloc'); // var RegExpInitialize = require('./RegExpInitialize'); var ToString = require('./ToString'); // https://262.ecma-international.org/6.0/#sec-regexpcreate module.exports = function RegExpCreate(P, F) { // var obj = RegExpAlloc($RegExp); // return RegExpInitialize(obj, P, F); // covers spec mechanics; bypass regex brand checking var pattern = typeof P === 'undefined' ? '' : ToString(P); var flags = typeof F === 'undefined' ? '' : ToString(F); return new $RegExp(pattern, flags); }; es-abstract-1.20.4/2020/RegExpExec.js000066400000000000000000000015671431761430200167400ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var regexExec = require('call-bind/callBound')('RegExp.prototype.exec'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-regexpexec module.exports = function RegExpExec(R, S) { if (Type(R) !== 'Object') { throw new $TypeError('Assertion failed: `R` must be an Object'); } if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var exec = Get(R, 'exec'); if (IsCallable(exec)) { var result = Call(exec, R, [S]); if (result === null || Type(result) === 'Object') { return result; } throw new $TypeError('"exec" method must return `null` or an Object'); } return regexExec(R, S); }; es-abstract-1.20.4/2020/RequireObjectCoercible.js000066400000000000000000000001061431761430200213000ustar00rootroot00000000000000'use strict'; module.exports = require('../5/CheckObjectCoercible'); es-abstract-1.20.4/2020/SameValue.js000066400000000000000000000004631431761430200166150ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // http://262.ecma-international.org/5.1/#sec-9.12 module.exports = function SameValue(x, y) { if (x === y) { // 0 === -0, but they are not identical. if (x === 0) { return 1 / x === 1 / y; } return true; } return $isNaN(x) && $isNaN(y); }; es-abstract-1.20.4/2020/SameValueNonNumeric.js000066400000000000000000000011731431761430200206120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-samevaluenonnumeric module.exports = function SameValueNonNumeric(x, y) { var xType = Type(x); if (xType === 'Number' || xType === 'BigInt') { throw new $TypeError('Assertion failed: SameValueNonNumeric does not accept Number or BigInt values'); } if (xType !== Type(y)) { throw new $TypeError('SameValueNonNumeric requires two non-numeric values of the same type.'); } return SameValue(x, y); }; es-abstract-1.20.4/2020/SameValueZero.js000066400000000000000000000003371431761430200174550ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero module.exports = function SameValueZero(x, y) { return (x === y) || ($isNaN(x) && $isNaN(y)); }; es-abstract-1.20.4/2020/SecFromTime.js000066400000000000000000000006221431761430200171050ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var SecondsPerMinute = timeConstants.SecondsPerMinute; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function SecFromTime(t) { return modulo(floor(t / msPerSecond), SecondsPerMinute); }; es-abstract-1.20.4/2020/Set.js000066400000000000000000000023471431761430200154710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // IE 9 does not throw in strict mode when writability/configurability/extensibility is violated var noThrowOnStrictViolation = (function () { try { delete [].length; return true; } catch (e) { return false; } }()); // https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw module.exports = function Set(O, P, V, Throw) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (Type(Throw) !== 'Boolean') { throw new $TypeError('Assertion failed: `Throw` must be a Boolean'); } if (Throw) { O[P] = V; // eslint-disable-line no-param-reassign if (noThrowOnStrictViolation && !SameValue(O[P], V)) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; } try { O[P] = V; // eslint-disable-line no-param-reassign return noThrowOnStrictViolation ? SameValue(O[P], V) : true; } catch (e) { return false; } }; es-abstract-1.20.4/2020/SetFunctionLength.js000066400000000000000000000020531431761430200203330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var HasOwnProperty = require('./HasOwnProperty'); var IsExtensible = require('./IsExtensible'); var IsNonNegativeInteger = require('./IsNonNegativeInteger'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-setfunctionlength module.exports = function SetFunctionLength(F, length) { if (typeof F !== 'function' || !IsExtensible(F) || HasOwnProperty(F, 'length')) { throw new $TypeError('Assertion failed: `F` must be an extensible function and lack an own `length` property'); } if (Type(length) !== 'Number') { throw new $TypeError('Assertion failed: `length` must be a Number'); } if (!IsNonNegativeInteger(length)) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0'); } return DefinePropertyOrThrow(F, 'length', { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); }; es-abstract-1.20.4/2020/SetFunctionName.js000066400000000000000000000025451431761430200200000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname module.exports = function SetFunctionName(F, name) { if (typeof F !== 'function') { throw new $TypeError('Assertion failed: `F` must be a function'); } if (!IsExtensible(F) || has(F, 'name')) { throw new $TypeError('Assertion failed: `F` must be extensible, and must not have a `name` own property'); } var nameType = Type(name); if (nameType !== 'Symbol' && nameType !== 'String') { throw new $TypeError('Assertion failed: `name` must be a Symbol or a String'); } if (nameType === 'Symbol') { var description = getSymbolDescription(name); // eslint-disable-next-line no-param-reassign name = typeof description === 'undefined' ? '' : '[' + description + ']'; } if (arguments.length > 2) { var prefix = arguments[2]; // eslint-disable-next-line no-param-reassign name = prefix + ' ' + name; } return DefinePropertyOrThrow(F, 'name', { '[[Value]]': name, '[[Writable]]': false, '[[Enumerable]]': false, '[[Configurable]]': true }); }; es-abstract-1.20.4/2020/SetIntegrityLevel.js000066400000000000000000000035061431761430200203560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var forEach = require('../helpers/forEach'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel module.exports = function SetIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } if (!$preventExtensions) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.preventExtensions` support'); } var status = $preventExtensions(O); if (!status) { return false; } if (!$gOPN) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support'); } var theKeys = $gOPN(O); if (level === 'sealed') { forEach(theKeys, function (k) { DefinePropertyOrThrow(O, k, { configurable: false }); }); } else if (level === 'frozen') { forEach(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { var desc; if (IsAccessorDescriptor(ToPropertyDescriptor(currentDesc))) { desc = { configurable: false }; } else { desc = { configurable: false, writable: false }; } DefinePropertyOrThrow(O, k, desc); } }); } return true; }; es-abstract-1.20.4/2020/SpeciesConstructor.js000066400000000000000000000015141431761430200205720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor module.exports = function SpeciesConstructor(O, defaultConstructor) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var C = O.constructor; if (typeof C === 'undefined') { return defaultConstructor; } if (Type(C) !== 'Object') { throw new $TypeError('O.constructor is not an Object'); } var S = $species ? C[$species] : void 0; if (S == null) { return defaultConstructor; } if (IsConstructor(S)) { return S; } throw new $TypeError('no constructor found'); }; es-abstract-1.20.4/2020/SplitMatch.js000066400000000000000000000015521431761430200170030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var Type = require('./Type'); var $charAt = callBound('String.prototype.charAt'); // https://262.ecma-international.org/6.0/#sec-splitmatch module.exports = function SplitMatch(S, q, R) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsInteger(q)) { throw new $TypeError('Assertion failed: `q` must be an integer'); } if (Type(R) !== 'String') { throw new $TypeError('Assertion failed: `R` must be a String'); } var r = R.length; var s = S.length; if (q + r > s) { return false; } for (var i = 0; i < r; i += 1) { if ($charAt(S, q + i) !== $charAt(R, i)) { return false; } } return q + r; }; es-abstract-1.20.4/2020/StrictEqualityComparison.js000066400000000000000000000005511431761430200217520ustar00rootroot00000000000000'use strict'; var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.9.6 module.exports = function StrictEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType !== yType) { return false; } if (xType === 'Undefined' || xType === 'Null') { return true; } return x === y; // shortcut for steps 4-7 }; es-abstract-1.20.4/2020/StringCreate.js000066400000000000000000000021351431761430200173230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var $StringPrototype = GetIntrinsic('%String.prototype%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var Type = require('./Type'); var setProto = require('../helpers/setProto'); // https://262.ecma-international.org/6.0/#sec-stringcreate module.exports = function StringCreate(value, prototype) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var S = $Object(value); if (prototype !== $StringPrototype) { if (setProto) { setProto(S, prototype); } else { throw new $SyntaxError('StringCreate: a `proto` argument that is not `String.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } } var length = value.length; DefinePropertyOrThrow(S, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); return S; }; es-abstract-1.20.4/2020/StringGetOwnProperty.js000066400000000000000000000025461431761430200210760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charAt = callBound('String.prototype.charAt'); var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsInteger = require('./IsInteger'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); var isNegativeZero = require('is-negative-zero'); // https://262.ecma-international.org/8.0/#sec-stringgetownproperty module.exports = function StringGetOwnProperty(S, P) { var str; if (Type(S) === 'Object') { try { str = $stringToString(S); } catch (e) { /**/ } } if (Type(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 (Type(P) !== 'String') { return void undefined; } var index = CanonicalNumericIndexString(P); var len = str.length; if (typeof index === 'undefined' || !IsInteger(index) || isNegativeZero(index) || index < 0 || len <= index) { return void undefined; } var resultStr = $charAt(S, index); return { '[[Configurable]]': false, '[[Enumerable]]': true, '[[Value]]': resultStr, '[[Writable]]': false }; }; es-abstract-1.20.4/2020/StringPad.js000066400000000000000000000023571431761430200166320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var $strSlice = callBound('String.prototype.slice'); // https://262.ecma-international.org/11.0/#sec-stringpad module.exports = function StringPad(O, maxLength, fillString, placement) { if (placement !== 'start' && placement !== 'end') { throw new $TypeError('Assertion failed: `placement` must be "start" or "end"'); } var S = ToString(O); var intMaxLength = ToLength(maxLength); var stringLength = S.length; if (intMaxLength <= stringLength) { return S; } var filler = typeof fillString === 'undefined' ? ' ' : ToString(fillString); if (filler === '') { return S; } var fillLen = intMaxLength - stringLength; // the String value consisting of repeated concatenations of filler truncated to length fillLen. var truncatedStringFiller = ''; while (truncatedStringFiller.length < fillLen) { truncatedStringFiller += filler; } truncatedStringFiller = $strSlice(truncatedStringFiller, 0, fillLen); if (placement === 'start') { return truncatedStringFiller + S; } return S + truncatedStringFiller; }; es-abstract-1.20.4/2020/StringToBigInt.js000066400000000000000000000011051431761430200175730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); // https://262.ecma-international.org/11.0/#sec-stringtobigint module.exports = function StringToBigInt(argument) { if (typeof argument !== 'string') { throw new $TypeError('`argument` must be a string'); } if (!$BigInt) { throw new $SyntaxError('BigInts are not supported in this environment'); } try { return $BigInt(argument); } catch (e) { return NaN; } }; es-abstract-1.20.4/2020/SymbolDescriptiveString.js000066400000000000000000000010161431761430200215640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $SymbolToString = callBound('Symbol.prototype.toString', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring module.exports = function SymbolDescriptiveString(sym) { if (Type(sym) !== 'Symbol') { throw new $TypeError('Assertion failed: `sym` must be a Symbol'); } return $SymbolToString(sym); }; es-abstract-1.20.4/2020/TestIntegrityLevel.js000066400000000000000000000024051431761430200205370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var every = require('../helpers/every'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel module.exports = function TestIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } var status = IsExtensible(O); if (status) { return false; } var theKeys = OwnPropertyKeys(O); return theKeys.length === 0 || every(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { if (currentDesc.configurable) { return false; } if (level === 'frozen' && IsDataDescriptor(ToPropertyDescriptor(currentDesc)) && currentDesc.writable) { return false; } } return true; }); }; es-abstract-1.20.4/2020/TimeClip.js000066400000000000000000000007241431761430200164410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var $Number = GetIntrinsic('%Number%'); var $isFinite = require('../helpers/isFinite'); var abs = require('./abs'); var ToNumber = require('./ToNumber'); // https://262.ecma-international.org/5.1/#sec-15.9.1.14 module.exports = function TimeClip(time) { if (!$isFinite(time) || abs(time) > 8.64e15) { return NaN; } return $Number(new $Date(ToNumber(time))); }; es-abstract-1.20.4/2020/TimeFromYear.js000066400000000000000000000004051431761430200172720ustar00rootroot00000000000000'use strict'; var msPerDay = require('../helpers/timeConstants').msPerDay; var DayFromYear = require('./DayFromYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function TimeFromYear(y) { return msPerDay * DayFromYear(y); }; es-abstract-1.20.4/2020/TimeString.js000066400000000000000000000014501431761430200170150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var padTimeComponent = require('../helpers/padTimeComponent'); var HourFromTime = require('./HourFromTime'); var MinFromTime = require('./MinFromTime'); var SecFromTime = require('./SecFromTime'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-timestring module.exports = function TimeString(tv) { if (Type(tv) !== 'Number' || $isNaN(tv)) { throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); } var hour = HourFromTime(tv); var minute = MinFromTime(tv); var second = SecFromTime(tv); return padTimeComponent(hour) + ':' + padTimeComponent(minute) + ':' + padTimeComponent(second) + '\x20GMT'; }; es-abstract-1.20.4/2020/TimeWithinDay.js000066400000000000000000000003671431761430200174550ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function TimeWithinDay(t) { return modulo(t, msPerDay); }; es-abstract-1.20.4/2020/ToBigInt.js000066400000000000000000000011671431761430200164140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $asIntN = GetIntrinsic('%BigInt.asIntN%', true); var $Number = GetIntrinsic('%Number%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var ToPrimitive = require('./ToPrimitive'); // https://262.ecma-international.org/11.0/#sec-tobigint module.exports = function ToBigInt(argument) { if (!$BigInt) { throw new $SyntaxError('BigInts are not supported in this environment'); } var prim = ToPrimitive(argument, $Number); if (typeof prim === 'number') { return $asIntN(0, prim); } return $BigInt(prim); }; es-abstract-1.20.4/2020/ToBigInt64.js000066400000000000000000000016641431761430200165700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $pow = GetIntrinsic('%Math.pow%'); var ToBigInt = require('./ToBigInt'); var BigIntRemainder = require('./BigInt/remainder'); var modBigInt = require('../helpers/modBigInt'); // BigInt(2**63), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER var twoSixtyThree = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 31))); // BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32))); // https://262.ecma-international.org/11.0/#sec-tobigint64 module.exports = function ToBigInt64(argument) { var n = ToBigInt(argument); var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour); return int64bit >= twoSixtyThree ? int64bit - twoSixtyFour : int64bit; }; es-abstract-1.20.4/2020/ToBigUint64.js000066400000000000000000000012771431761430200167550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $pow = GetIntrinsic('%Math.pow%'); var ToBigInt = require('./ToBigInt'); var BigIntRemainder = require('./BigInt/remainder'); var modBigInt = require('../helpers/modBigInt'); // BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32))); // https://262.ecma-international.org/11.0/#sec-tobiguint64 module.exports = function ToBigUint64(argument) { var n = ToBigInt(argument); var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour); return int64bit; }; es-abstract-1.20.4/2020/ToBoolean.js000066400000000000000000000002021431761430200166040ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.2 module.exports = function ToBoolean(value) { return !!value; }; es-abstract-1.20.4/2020/ToDateString.js000066400000000000000000000007621431761430200173040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Date = GetIntrinsic('%Date%'); var $isNaN = require('../helpers/isNaN'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-todatestring module.exports = function ToDateString(tv) { if (Type(tv) !== 'Number') { throw new $TypeError('Assertion failed: `tv` must be a Number'); } if ($isNaN(tv)) { return 'Invalid Date'; } return $Date(tv); }; es-abstract-1.20.4/2020/ToIndex.js000066400000000000000000000012211431761430200162760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var ToInteger = require('./ToInteger'); var ToLength = require('./ToLength'); var SameValue = require('./SameValue'); // https://262.ecma-international.org/12.0/#sec-toindex module.exports = function ToIndex(value) { if (typeof value === 'undefined') { return 0; } var integerIndex = ToInteger(value); if (integerIndex < 0) { throw new $RangeError('index must be >= 0'); } var index = ToLength(integerIndex); if (!SameValue(integerIndex, index)) { throw new $RangeError('index must be >= 0 and < 2 ** 53 - 1'); } return index; }; es-abstract-1.20.4/2020/ToInt16.js000066400000000000000000000004041431761430200161320ustar00rootroot00000000000000'use strict'; var ToUint16 = require('./ToUint16'); // https://ecma-international.org/ecma-262/6.0/#sec-toint16 module.exports = function ToInt16(argument) { var int16bit = ToUint16(argument); return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit; }; es-abstract-1.20.4/2020/ToInt32.js000066400000000000000000000002551431761430200161340ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.5 module.exports = function ToInt32(x) { return ToNumber(x) >> 0; }; es-abstract-1.20.4/2020/ToInt8.js000066400000000000000000000003671431761430200160630ustar00rootroot00000000000000'use strict'; var ToUint8 = require('./ToUint8'); // https://ecma-international.org/ecma-262/6.0/#sec-toint8 module.exports = function ToInt8(argument) { var int8bit = ToUint8(argument); return int8bit >= 0x80 ? int8bit - 0x100 : int8bit; }; es-abstract-1.20.4/2020/ToInteger.js000066400000000000000000000005131431761430200166270ustar00rootroot00000000000000'use strict'; var ES5ToInteger = require('../5/ToInteger'); var ToNumber = require('./ToNumber'); // https://262.ecma-international.org/11.0/#sec-tointeger module.exports = function ToInteger(value) { var number = ToNumber(value); if (number !== 0) { number = ES5ToInteger(number); } return number === 0 ? 0 : number; }; es-abstract-1.20.4/2020/ToLength.js000066400000000000000000000005141431761430200164540ustar00rootroot00000000000000'use strict'; var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var ToInteger = require('./ToInteger'); module.exports = function ToLength(argument) { var len = ToInteger(argument); if (len <= 0) { return 0; } // includes converting -0 to +0 if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } return len; }; es-abstract-1.20.4/2020/ToNumber.js000066400000000000000000000041211431761430200164610ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Number = GetIntrinsic('%Number%'); var $RegExp = GetIntrinsic('%RegExp%'); var $parseInteger = GetIntrinsic('%parseInt%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var isPrimitive = require('../helpers/isPrimitive'); var $strSlice = callBound('String.prototype.slice'); var isBinary = regexTester(/^0b[01]+$/i); var isOctal = regexTester(/^0o[0-7]+$/i); var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i); var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); var hasNonWS = regexTester(nonWSregex); // whitespace from: https://es5.github.io/#x15.5.4.20 // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324 var ws = [ '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003', '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028', '\u2029\uFEFF' ].join(''); var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); var $replace = callBound('String.prototype.replace'); var $trim = function (value) { return $replace(value, trimRegex, ''); }; var ToPrimitive = require('./ToPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-tonumber module.exports = function ToNumber(argument) { var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (typeof value === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a number'); } if (typeof value === 'bigint') { throw new $TypeError('Conversion from \'BigInt\' to \'number\' is not allowed.'); } if (typeof value === 'string') { if (isBinary(value)) { return ToNumber($parseInteger($strSlice(value, 2), 2)); } else if (isOctal(value)) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; } var trimmed = $trim(value); if (trimmed !== value) { return ToNumber(trimmed); } } return $Number(value); }; es-abstract-1.20.4/2020/ToNumeric.js000066400000000000000000000010461431761430200166360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var isPrimitive = require('../helpers/isPrimitive'); var ToPrimitive = require('./ToPrimitive'); var ToNumber = require('./ToNumber'); var Type = require('./Type'); // https://262.ecma-international.org/6.0/#sec-tonumber module.exports = function ToNumeric(argument) { var primValue = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (Type(primValue) === 'BigInt') { return primValue; } return ToNumber(primValue); }; es-abstract-1.20.4/2020/ToObject.js000066400000000000000000000005161431761430200164430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); // https://ecma-international.org/ecma-262/6.0/#sec-toobject module.exports = function ToObject(value) { RequireObjectCoercible(value); return $Object(value); }; es-abstract-1.20.4/2020/ToPrimitive.js000066400000000000000000000004371431761430200172070ustar00rootroot00000000000000'use strict'; var toPrimitive = require('es-to-primitive/es2015'); // https://ecma-international.org/ecma-262/6.0/#sec-toprimitive module.exports = function ToPrimitive(input) { if (arguments.length > 1) { return toPrimitive(input, arguments[1]); } return toPrimitive(input); }; es-abstract-1.20.4/2020/ToPropertyDescriptor.js000066400000000000000000000026541431761430200211250ustar00rootroot00000000000000'use strict'; var has = require('has'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var ToBoolean = require('./ToBoolean'); var IsCallable = require('./IsCallable'); // https://262.ecma-international.org/5.1/#sec-8.10.5 module.exports = function ToPropertyDescriptor(Obj) { if (Type(Obj) !== 'Object') { throw new $TypeError('ToPropertyDescriptor requires an object'); } var desc = {}; if (has(Obj, 'enumerable')) { desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable); } if (has(Obj, 'configurable')) { desc['[[Configurable]]'] = ToBoolean(Obj.configurable); } if (has(Obj, 'value')) { desc['[[Value]]'] = Obj.value; } if (has(Obj, 'writable')) { desc['[[Writable]]'] = ToBoolean(Obj.writable); } if (has(Obj, 'get')) { var getter = Obj.get; if (typeof getter !== 'undefined' && !IsCallable(getter)) { throw new $TypeError('getter must be a function'); } desc['[[Get]]'] = getter; } if (has(Obj, 'set')) { var setter = Obj.set; if (typeof setter !== 'undefined' && !IsCallable(setter)) { throw new $TypeError('setter must be a function'); } desc['[[Set]]'] = setter; } if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); } return desc; }; es-abstract-1.20.4/2020/ToPropertyKey.js000066400000000000000000000006251431761430200175330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var ToPrimitive = require('./ToPrimitive'); var ToString = require('./ToString'); // https://ecma-international.org/ecma-262/6.0/#sec-topropertykey module.exports = function ToPropertyKey(argument) { var key = ToPrimitive(argument, $String); return typeof key === 'symbol' ? key : ToString(key); }; es-abstract-1.20.4/2020/ToString.js000066400000000000000000000006141431761430200165020ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); // https://ecma-international.org/ecma-262/6.0/#sec-tostring module.exports = function ToString(argument) { if (typeof argument === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a string'); } return $String(argument); }; es-abstract-1.20.4/2020/ToUint16.js000066400000000000000000000010641431761430200163220ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // http://262.ecma-international.org/5.1/#sec-9.7 module.exports = function ToUint16(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x10000); }; es-abstract-1.20.4/2020/ToUint32.js000066400000000000000000000002571431761430200163230ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.6 module.exports = function ToUint32(x) { return ToNumber(x) >>> 0; }; es-abstract-1.20.4/2020/ToUint8.js000066400000000000000000000011021431761430200162340ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8 module.exports = function ToUint8(argument) { var number = ToNumber(argument); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x100); }; es-abstract-1.20.4/2020/ToUint8Clamp.js000066400000000000000000000010121431761430200172110ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp module.exports = function ToUint8Clamp(argument) { var number = ToNumber(argument); if ($isNaN(number) || number <= 0) { return 0; } if (number >= 0xFF) { return 0xFF; } var f = floor(argument); if (f + 0.5 < number) { return f + 1; } if (number < f + 0.5) { return f; } if (f % 2 !== 0) { return f + 1; } return f; }; es-abstract-1.20.4/2020/TrimString.js000066400000000000000000000014441431761430200170350ustar00rootroot00000000000000'use strict'; var trimStart = require('string.prototype.trimstart'); var trimEnd = require('string.prototype.trimend'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); // https://262.ecma-international.org/10.0/#sec-trimstring module.exports = function TrimString(string, where) { var str = RequireObjectCoercible(string); var S = ToString(str); var T; if (where === 'start') { T = trimStart(S); } else if (where === 'end') { T = trimEnd(S); } else if (where === 'start+end') { T = trimStart(trimEnd(S)); } else { throw new $TypeError('Assertion failed: invalid `where` value; must be "start", "end", or "start+end"'); } return T; }; es-abstract-1.20.4/2020/Type.js000066400000000000000000000004511431761430200156510ustar00rootroot00000000000000'use strict'; var ES5Type = require('../5/Type'); // https://262.ecma-international.org/11.0/#sec-ecmascript-data-types-and-values module.exports = function Type(x) { if (typeof x === 'symbol') { return 'Symbol'; } if (typeof x === 'bigint') { return 'BigInt'; } return ES5Type(x); }; es-abstract-1.20.4/2020/UTF16DecodeString.js000066400000000000000000000013611431761430200200310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $push = callBound('Array.prototype.push'); var CodePointAt = require('./CodePointAt'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-utf16decodestring module.exports = function UTF16DecodeString(string) { if (Type(string) !== 'String') { throw new $TypeError('Assertion failed: `string` must be a String'); } var codePoints = []; var size = string.length; var position = 0; while (position < size) { var cp = CodePointAt(string, position); $push(codePoints, cp['[[CodePoint]]']); position += cp['[[CodeUnitCount]]']; } return codePoints; }; es-abstract-1.20.4/2020/UTF16DecodeSurrogatePair.js000066400000000000000000000014101431761430200213450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); // https://262.ecma-international.org/11.0/#sec-utf16decodesurrogatepair module.exports = function UTF16DecodeSurrogatePair(lead, trail) { if (!isLeadingSurrogate(lead) || !isTrailingSurrogate(trail)) { throw new $TypeError('Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code'); } // var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; return $fromCharCode(lead) + $fromCharCode(trail); }; es-abstract-1.20.4/2020/UTF16Encoding.js000066400000000000000000000012741431761430200172100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var floor = require('./floor'); var modulo = require('./modulo'); var isCodePoint = require('../helpers/isCodePoint'); // https://262.ecma-international.org/7.0/#sec-utf16encoding module.exports = function UTF16Encoding(cp) { if (!isCodePoint(cp)) { throw new $TypeError('Assertion failed: `cp` must be >= 0 and <= 0x10FFFF'); } if (cp <= 65535) { return $fromCharCode(cp); } var cu1 = floor((cp - 65536) / 1024) + 0xD800; var cu2 = modulo(cp - 65536, 1024) + 0xDC00; return $fromCharCode(cu1) + $fromCharCode(cu2); }; es-abstract-1.20.4/2020/UnicodeEscape.js000066400000000000000000000015071431761430200174420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var $numberToString = callBound('Number.prototype.toString'); var $toLowerCase = callBound('String.prototype.toLowerCase'); var StringPad = require('./StringPad'); // https://262.ecma-international.org/11.0/#sec-unicodeescape module.exports = function UnicodeEscape(C) { if (typeof C !== 'string' || C.length !== 1) { throw new $TypeError('Assertion failed: `C` must be a single code unit'); } var n = $charCodeAt(C, 0); if (n > 0xFFFF) { throw new $TypeError('`Assertion failed: numeric value of `C` must be <= 0xFFFF'); } return '\\u' + StringPad($toLowerCase($numberToString(n, 16)), 4, '0', 'start'); }; es-abstract-1.20.4/2020/ValidateAndApplyPropertyDescriptor.js000066400000000000000000000121731431761430200237220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var isSamePropertyDescriptor = require('../helpers/isSamePropertyDescriptor'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-validateandapplypropertydescriptor // https://ecma-international.org/ecma-262/8.0/#sec-validateandapplypropertydescriptor // eslint-disable-next-line max-lines-per-function, max-statements, max-params module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) { // this uses the ES2017+ logic, since it fixes a number of bugs in the ES2015 logic. var oType = Type(O); if (oType !== 'Undefined' && oType !== 'Object') { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } if (Type(extensible) !== 'Boolean') { throw new $TypeError('Assertion failed: extensible must be a Boolean'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (Type(current) !== 'Undefined' && !isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } if (oType !== 'Undefined' && !IsPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (Type(current) === 'Undefined') { if (!extensible) { return false; } if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': Desc['[[Configurable]]'], '[[Enumerable]]': Desc['[[Enumerable]]'], '[[Value]]': Desc['[[Value]]'], '[[Writable]]': Desc['[[Writable]]'] } ); } } else { if (!IsAccessorDescriptor(Desc)) { throw new $TypeError('Assertion failed: Desc is not an accessor descriptor'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } } return true; } if (IsGenericDescriptor(Desc) && !('[[Configurable]]' in Desc) && !('[[Enumerable]]' in Desc)) { return true; } if (isSamePropertyDescriptor({ SameValue: SameValue }, Desc, current)) { return true; // removed by ES2017, but should still be correct } // "if every field in Desc is absent, return true" can't really match the assertion that it's a Property Descriptor if (!current['[[Configurable]]']) { if (Desc['[[Configurable]]']) { return false; } if ('[[Enumerable]]' in Desc && !Desc['[[Enumerable]]'] === !!current['[[Enumerable]]']) { return false; } } if (IsGenericDescriptor(Desc)) { // no further validation is required. } else if (IsDataDescriptor(current) !== IsDataDescriptor(Desc)) { if (!current['[[Configurable]]']) { return false; } if (IsDataDescriptor(current)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Get]]': undefined } ); } } else if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Value]]': undefined } ); } } else if (IsDataDescriptor(current) && IsDataDescriptor(Desc)) { if (!current['[[Configurable]]'] && !current['[[Writable]]']) { if ('[[Writable]]' in Desc && Desc['[[Writable]]']) { return false; } if ('[[Value]]' in Desc && !SameValue(Desc['[[Value]]'], current['[[Value]]'])) { return false; } return true; } } else if (IsAccessorDescriptor(current) && IsAccessorDescriptor(Desc)) { if (!current['[[Configurable]]']) { if ('[[Set]]' in Desc && !SameValue(Desc['[[Set]]'], current['[[Set]]'])) { return false; } if ('[[Get]]' in Desc && !SameValue(Desc['[[Get]]'], current['[[Get]]'])) { return false; } return true; } } else { throw new $TypeError('Assertion failed: current and Desc are not both data, both accessors, or one accessor and one data.'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } return true; }; es-abstract-1.20.4/2020/WeekDay.js000066400000000000000000000003201431761430200162540ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.6 module.exports = function WeekDay(t) { return modulo(Day(t) + 4, 7); }; es-abstract-1.20.4/2020/YearFromTime.js000066400000000000000000000006271431761430200173000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var callBound = require('call-bind/callBound'); var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function YearFromTime(t) { // largest y such that this.TimeFromYear(y) <= t return $getUTCFullYear(new $Date(t)); }; es-abstract-1.20.4/2020/abs.js000066400000000000000000000003171431761430200154760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $abs = GetIntrinsic('%Math.abs%'); // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function abs(x) { return $abs(x); }; es-abstract-1.20.4/2020/floor.js000066400000000000000000000003311431761430200160460ustar00rootroot00000000000000'use strict'; // var modulo = require('./modulo'); var $floor = Math.floor; // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function floor(x) { // return x - modulo(x, 1); return $floor(x); }; es-abstract-1.20.4/2020/modulo.js000066400000000000000000000002501431761430200162240ustar00rootroot00000000000000'use strict'; var mod = require('../helpers/mod'); // https://262.ecma-international.org/5.1/#sec-5.2 module.exports = function modulo(x, y) { return mod(x, y); }; es-abstract-1.20.4/2020/msFromTime.js000066400000000000000000000003751431761430200170170ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerSecond = require('../helpers/timeConstants').msPerSecond; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function msFromTime(t) { return modulo(t, msPerSecond); }; es-abstract-1.20.4/2020/thisBigIntValue.js000066400000000000000000000010471431761430200177730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $bigIntValueOf = callBound('BigInt.prototype.valueOf', true); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-thisbigintvalue module.exports = function thisBigIntValue(value) { var type = Type(value); if (type === 'BigInt') { return value; } if (!$bigIntValueOf) { throw new $TypeError('BigInt is not supported'); } return $bigIntValueOf(value); }; es-abstract-1.20.4/2020/thisBooleanValue.js000066400000000000000000000005571431761430200202030ustar00rootroot00000000000000'use strict'; var $BooleanValueOf = require('call-bind/callBound')('Boolean.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-boolean-prototype-object module.exports = function thisBooleanValue(value) { if (Type(value) === 'Boolean') { return value; } return $BooleanValueOf(value); }; es-abstract-1.20.4/2020/thisNumberValue.js000066400000000000000000000006061431761430200200470ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var Type = require('./Type'); var $NumberValueOf = callBound('Number.prototype.valueOf'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object module.exports = function thisNumberValue(value) { if (Type(value) === 'Number') { return value; } return $NumberValueOf(value); }; es-abstract-1.20.4/2020/thisStringValue.js000066400000000000000000000005511431761430200200640ustar00rootroot00000000000000'use strict'; var $StringValueOf = require('call-bind/callBound')('String.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object module.exports = function thisStringValue(value) { if (Type(value) === 'String') { return value; } return $StringValueOf(value); }; es-abstract-1.20.4/2020/thisSymbolValue.js000066400000000000000000000010021431761430200200530ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-thissymbolvalue module.exports = function thisSymbolValue(value) { if (!$SymbolValueOf) { throw new SyntaxError('Symbols are not supported; thisSymbolValue requires that `value` be a Symbol or a Symbol object'); } if (Type(value) === 'Symbol') { return value; } return $SymbolValueOf(value); }; es-abstract-1.20.4/2020/thisTimeValue.js000066400000000000000000000001021431761430200175040ustar00rootroot00000000000000'use strict'; module.exports = require('../2018/thisTimeValue'); es-abstract-1.20.4/2021/000077500000000000000000000000001431761430200143735ustar00rootroot00000000000000es-abstract-1.20.4/2021/AbstractEqualityComparison.js000066400000000000000000000035211431761430200222460ustar00rootroot00000000000000'use strict'; var StrictEqualityComparison = require('./StrictEqualityComparison'); var StringToBigInt = require('./StringToBigInt'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); var isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/11.0/#sec-abstract-equality-comparison module.exports = function AbstractEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType === yType) { return StrictEqualityComparison(x, y); } if (x == null && y == null) { return true; } if (xType === 'Number' && yType === 'String') { return AbstractEqualityComparison(x, ToNumber(y)); } if (xType === 'String' && yType === 'Number') { return AbstractEqualityComparison(ToNumber(x), y); } if (xType === 'BigInt' && yType === 'String') { var n = StringToBigInt(y); if (isNaN(n)) { return false; } return AbstractEqualityComparison(x, n); } if (xType === 'String' && yType === 'BigInt') { return AbstractEqualityComparison(y, x); } if (xType === 'Boolean') { return AbstractEqualityComparison(ToNumber(x), y); } if (yType === 'Boolean') { return AbstractEqualityComparison(x, ToNumber(y)); } if ((xType === 'String' || xType === 'Number' || xType === 'BigInt' || xType === 'Symbol') && yType === 'Object') { return AbstractEqualityComparison(x, ToPrimitive(y)); } if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'BigInt' || yType === 'Symbol')) { return AbstractEqualityComparison(ToPrimitive(x), y); } if ((xType === 'BigInt' && yType === 'Number') || (xType === 'Number' && yType === 'BigInt')) { if (isNaN(x) || isNaN(y) || x === Infinity || y === Infinity || x === -Infinity || y === -Infinity) { return false; } return x == y; // eslint-disable-line eqeqeq } return false; }; es-abstract-1.20.4/2021/AbstractRelationalComparison.js000066400000000000000000000041111431761430200225370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var IsStringPrefix = require('./IsStringPrefix'); var StringToBigInt = require('./StringToBigInt'); var ToNumeric = require('./ToNumeric'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); var BigIntLessThan = require('./BigInt/lessThan'); var NumberLessThan = require('./Number/lessThan'); // https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); } var px; var py; if (LeftFirst) { px = ToPrimitive(x, $Number); py = ToPrimitive(y, $Number); } else { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } if (Type(px) === 'String' && Type(py) === 'String') { if (IsStringPrefix(py, px)) { return false; } if (IsStringPrefix(px, py)) { return true; } return px < py; // both strings, neither a prefix of the other. shortcut for steps 3 c-f } var pxType = Type(px); var pyType = Type(py); var nx; var ny; if (pxType === 'BigInt' && pyType === 'String') { ny = StringToBigInt(py); if ($isNaN(ny)) { return void undefined; } return BigIntLessThan(px, ny); } if (pxType === 'String' && pyType === 'BigInt') { nx = StringToBigInt(px); if ($isNaN(nx)) { return void undefined; } return BigIntLessThan(px, ny); } nx = ToNumeric(px); ny = ToNumeric(py); var nxType = Type(nx); if (nxType === Type(ny)) { return nxType === 'Number' ? NumberLessThan(nx, ny) : BigIntLessThan(nx, ny); } if ($isNaN(nx) || $isNaN(ny)) { return void undefined; } if (nx === -Infinity || ny === Infinity) { return true; } if (nx === Infinity || ny === -Infinity) { return false; } return nx < ny; // by now, these are both nonzero, finite, and not equal }; es-abstract-1.20.4/2021/AddEntriesFromIterable.js000066400000000000000000000027571431761430200212620ustar00rootroot00000000000000'use strict'; var inspect = require('object-inspect'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var GetIterator = require('./GetIterator'); var IsCallable = require('./IsCallable'); var IteratorClose = require('./IteratorClose'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); var Type = require('./Type'); // https://262.ecma-international.org/10.0//#sec-add-entries-from-iterable module.exports = function AddEntriesFromIterable(target, iterable, adder) { if (!IsCallable(adder)) { throw new $TypeError('Assertion failed: `adder` is not callable'); } if (iterable == null) { throw new $TypeError('Assertion failed: `iterable` is present, and not nullish'); } var iteratorRecord = GetIterator(iterable); while (true) { // eslint-disable-line no-constant-condition var next = IteratorStep(iteratorRecord); if (!next) { return target; } var nextItem = IteratorValue(next); if (Type(nextItem) !== 'Object') { var error = new $TypeError('iterator next must return an Object, got ' + inspect(nextItem)); return IteratorClose( iteratorRecord, function () { throw error; } // eslint-disable-line no-loop-func ); } try { var k = Get(nextItem, '0'); var v = Get(nextItem, '1'); Call(adder, target, [k, v]); } catch (e) { return IteratorClose( iteratorRecord, function () { throw e; } ); } } }; es-abstract-1.20.4/2021/AddToKeptObjects.js000066400000000000000000000012051431761430200200600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var SLOT = require('internal-slot'); var $TypeError = GetIntrinsic('%TypeError%'); var ClearKeptObjects = require('./ClearKeptObjects'); var Type = require('./Type'); var $push = callBound('Array.prototype.push'); // https://ecma-international.org/ecma-262/12.0/#sec-addtokeptobjects module.exports = function AddToKeptObjects(object) { if (Type(object) !== 'Object') { throw new $TypeError('Assertion failed: `object` must be an Object'); } $push(SLOT.get(ClearKeptObjects, '[[es-abstract internal: KeptAlive]]'), object); }; es-abstract-1.20.4/2021/AdvanceStringIndex.js000066400000000000000000000017621431761430200204570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var CodePointAt = require('./CodePointAt'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var $TypeError = GetIntrinsic('%TypeError%'); // https://ecma-international.org/ecma-262/12.0/#sec-advancestringindex module.exports = function AdvanceStringIndex(S, index, unicode) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsIntegralNumber(index) || index < 0 || index > MAX_SAFE_INTEGER) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53'); } if (Type(unicode) !== 'Boolean') { throw new $TypeError('Assertion failed: `unicode` must be a Boolean'); } if (!unicode) { return index + 1; } var length = S.length; if ((index + 1) >= length) { return index + 1; } var cp = CodePointAt(S, index); return index + cp['[[CodeUnitCount]]']; }; es-abstract-1.20.4/2021/ApplyStringOrNumericBinaryOperator.js000066400000000000000000000061631431761430200237200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var HasOwnProperty = require('./HasOwnProperty'); var ToNumeric = require('./ToNumeric'); var ToPrimitive = require('./ToPrimitive'); var ToString = require('./ToString'); var Type = require('./Type'); var NumberAdd = require('./Number/add'); var NumberBitwiseAND = require('./Number/bitwiseAND'); var NumberBitwiseOR = require('./Number/bitwiseOR'); var NumberBitwiseXOR = require('./Number/bitwiseXOR'); var NumberDivide = require('./Number/divide'); var NumberExponentiate = require('./Number/exponentiate'); var NumberLeftShift = require('./Number/leftShift'); var NumberMultiply = require('./Number/multiply'); var NumberRemainder = require('./Number/remainder'); var NumberSignedRightShift = require('./Number/signedRightShift'); var NumberSubtract = require('./Number/subtract'); var NumberUnsignedRightShift = require('./Number/unsignedRightShift'); var BigIntAdd = require('./BigInt/add'); var BigIntBitwiseAND = require('./BigInt/bitwiseAND'); var BigIntBitwiseOR = require('./BigInt/bitwiseOR'); var BigIntBitwiseXOR = require('./BigInt/bitwiseXOR'); var BigIntDivide = require('./BigInt/divide'); var BigIntExponentiate = require('./BigInt/exponentiate'); var BigIntLeftShift = require('./BigInt/leftShift'); var BigIntMultiply = require('./BigInt/multiply'); var BigIntRemainder = require('./BigInt/remainder'); var BigIntSignedRightShift = require('./BigInt/signedRightShift'); var BigIntSubtract = require('./BigInt/subtract'); var BigIntUnsignedRightShift = require('./BigInt/unsignedRightShift'); // https://ecma-international.org/ecma-262/12.0/#sec-applystringornumericbinaryoperator // https://ecma-international.org/ecma-262/12.0/#step-applystringornumericbinaryoperator-operations-table var table = { '**': [NumberExponentiate, BigIntExponentiate], '*': [NumberMultiply, BigIntMultiply], '/': [NumberDivide, BigIntDivide], '%': [NumberRemainder, BigIntRemainder], '+': [NumberAdd, BigIntAdd], '-': [NumberSubtract, BigIntSubtract], '<<': [NumberLeftShift, BigIntLeftShift], '>>': [NumberSignedRightShift, BigIntSignedRightShift], '>>>': [NumberUnsignedRightShift, BigIntUnsignedRightShift], '&': [NumberBitwiseAND, BigIntBitwiseAND], '^': [NumberBitwiseXOR, BigIntBitwiseXOR], '|': [NumberBitwiseOR, BigIntBitwiseOR] }; module.exports = function ApplyStringOrNumericBinaryOperator(lval, opText, rval) { if (Type(opText) !== 'String' || !HasOwnProperty(table, opText)) { throw new $TypeError('Assertion failed: `opText` must be a valid operation string'); } if (opText === '+') { var lprim = ToPrimitive(lval); var rprim = ToPrimitive(rval); if (Type(lprim) === 'String' || Type(rprim) === 'String') { var lstr = ToString(lprim); var rstr = ToString(rprim); return lstr + rstr; } /* eslint no-param-reassign: 1 */ lval = lprim; rval = rprim; } var lnum = ToNumeric(lval); var rnum = ToNumeric(rval); var T = Type(lnum); if (T !== Type(rnum)) { throw new $TypeError('types of ' + lnum + ' and ' + rnum + ' differ'); } var Operation = table[opText][T === 'BigInt' ? 1 : 0]; return Operation(lnum, rnum); }; es-abstract-1.20.4/2021/ArrayCreate.js000066400000000000000000000032031431761430200171310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ArrayPrototype = GetIntrinsic('%Array.prototype%'); var $RangeError = GetIntrinsic('%RangeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || ( // eslint-disable-next-line no-proto, no-negated-condition [].__proto__ !== $ArrayPrototype ? null : function (O, proto) { O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign return O; } ); // https://www.ecma-international.org/ecma-262/12.0/#sec-arraycreate module.exports = function ArrayCreate(length) { if (!IsIntegralNumber(length) || length < 0) { throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0'); } if (length > MAX_ARRAY_LENGTH) { throw new $RangeError('length is greater than (2**32 - 1)'); } var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype; var A = []; // steps 3, 5 if (proto !== $ArrayPrototype) { // step 4 if (!$setProto) { throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } $setProto(A, proto); } if (length !== 0) { // bypasses the need for step 6 A.length = length; } /* step 6, the above as a shortcut for the below OrdinaryDefineOwnProperty(A, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': true }); */ return A; }; es-abstract-1.20.4/2021/ArraySetLength.js000066400000000000000000000051511431761430200176270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var assign = require('object.assign'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsArray = require('./IsArray'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function ArraySetLength(A, Desc) { if (!IsArray(A)) { throw new $TypeError('Assertion failed: A must be an Array'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!('[[Value]]' in Desc)) { return OrdinaryDefineOwnProperty(A, 'length', Desc); } var newLenDesc = assign({}, Desc); var newLen = ToUint32(Desc['[[Value]]']); var numberLen = ToNumber(Desc['[[Value]]']); if (newLen !== numberLen) { throw new $RangeError('Invalid array length'); } newLenDesc['[[Value]]'] = newLen; var oldLenDesc = OrdinaryGetOwnProperty(A, 'length'); if (!IsDataDescriptor(oldLenDesc)) { throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`'); } var oldLen = oldLenDesc['[[Value]]']; if (newLen >= oldLen) { return OrdinaryDefineOwnProperty(A, 'length', newLenDesc); } if (!oldLenDesc['[[Writable]]']) { return false; } var newWritable; if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) { newWritable = true; } else { newWritable = false; newLenDesc['[[Writable]]'] = true; } var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc); if (!succeeded) { return false; } while (newLen < oldLen) { oldLen -= 1; // eslint-disable-next-line no-param-reassign var deleteSucceeded = delete A[ToString(oldLen)]; if (!deleteSucceeded) { newLenDesc['[[Value]]'] = oldLen + 1; if (!newWritable) { newLenDesc['[[Writable]]'] = false; OrdinaryDefineOwnProperty(A, 'length', newLenDesc); return false; } } } if (!newWritable) { return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false }); } return true; }; es-abstract-1.20.4/2021/ArraySpeciesCreate.js000066400000000000000000000025321431761430200204510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var ArrayCreate = require('./ArrayCreate'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsConstructor = require('./IsConstructor'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/12.0/#sec-arrayspeciescreate module.exports = function ArraySpeciesCreate(originalArray, length) { if (!IsIntegralNumber(length) || length < 0) { throw new $TypeError('Assertion failed: length must be an integer >= 0'); } var isArray = IsArray(originalArray); if (!isArray) { return ArrayCreate(length); } var C = Get(originalArray, 'constructor'); // TODO: figure out how to make a cross-realm normal Array, a same-realm Array // if (IsConstructor(C)) { // if C is another realm's Array, C = undefined // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ? // } if ($species && Type(C) === 'Object') { C = Get(C, $species); if (C === null) { C = void 0; } } if (typeof C === 'undefined') { return ArrayCreate(length); } if (!IsConstructor(C)) { throw new $TypeError('C must be a constructor'); } return new C(length); // Construct(C, length); }; es-abstract-1.20.4/2021/BigInt/000077500000000000000000000000001431761430200155475ustar00rootroot00000000000000es-abstract-1.20.4/2021/BigInt/add.js000066400000000000000000000007131431761430200166360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-add module.exports = function BigIntAdd(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x + y; }; es-abstract-1.20.4/2021/BigInt/bitwiseAND.js000066400000000000000000000007671431761430200201100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var BigIntBitwiseOp = require('../BigIntBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseAND module.exports = function BigIntBitwiseAND(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntBitwiseOp('&', x, y); }; es-abstract-1.20.4/2021/BigInt/bitwiseNOT.js000066400000000000000000000007021431761430200201330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseNOT module.exports = function BigIntBitwiseNOT(x) { if (Type(x) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` argument must be a BigInt'); } return -x - $BigInt(1); }; es-abstract-1.20.4/2021/BigInt/bitwiseOR.js000066400000000000000000000007651431761430200200240ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var BigIntBitwiseOp = require('../BigIntBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseOR module.exports = function BigIntBitwiseOR(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntBitwiseOp('|', x, y); }; es-abstract-1.20.4/2021/BigInt/bitwiseXOR.js000066400000000000000000000007671431761430200201560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var BigIntBitwiseOp = require('../BigIntBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseXOR module.exports = function BigIntBitwiseXOR(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntBitwiseOp('^', x, y); }; es-abstract-1.20.4/2021/BigInt/divide.js000066400000000000000000000011671431761430200173560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-divide module.exports = function BigIntDivide(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } if (y === $BigInt(0)) { throw new $RangeError('Division by zero'); } // shortcut for the actual spec mechanics return x / y; }; es-abstract-1.20.4/2021/BigInt/equal.js000066400000000000000000000007201431761430200172130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-equal module.exports = function BigIntEqual(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x === y; }; es-abstract-1.20.4/2021/BigInt/exponentiate.js000066400000000000000000000015671431761430200206210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-exponentiate module.exports = function BigIntExponentiate(base, exponent) { if (Type(base) !== 'BigInt' || Type(exponent) !== 'BigInt') { throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be BigInts'); } if (exponent < $BigInt(0)) { throw new $RangeError('Exponent must be positive'); } if (/* base === $BigInt(0) && */ exponent === $BigInt(0)) { return $BigInt(1); } var square = base; var remaining = exponent; while (remaining > $BigInt(0)) { square += exponent; --remaining; // eslint-disable-line no-plusplus } return square; }; es-abstract-1.20.4/2021/BigInt/index.js000066400000000000000000000023721431761430200172200ustar00rootroot00000000000000'use strict'; var add = require('./add'); var bitwiseAND = require('./bitwiseAND'); var bitwiseNOT = require('./bitwiseNOT'); var bitwiseOR = require('./bitwiseOR'); var bitwiseXOR = require('./bitwiseXOR'); var divide = require('./divide'); var equal = require('./equal'); var exponentiate = require('./exponentiate'); var leftShift = require('./leftShift'); var lessThan = require('./lessThan'); var multiply = require('./multiply'); var remainder = require('./remainder'); var sameValue = require('./sameValue'); var sameValueZero = require('./sameValueZero'); var signedRightShift = require('./signedRightShift'); var subtract = require('./subtract'); var toString = require('./toString'); var unaryMinus = require('./unaryMinus'); var unsignedRightShift = require('./unsignedRightShift'); module.exports = { add: add, bitwiseAND: bitwiseAND, bitwiseNOT: bitwiseNOT, bitwiseOR: bitwiseOR, bitwiseXOR: bitwiseXOR, divide: divide, equal: equal, exponentiate: exponentiate, leftShift: leftShift, lessThan: lessThan, multiply: multiply, remainder: remainder, sameValue: sameValue, sameValueZero: sameValueZero, signedRightShift: signedRightShift, subtract: subtract, toString: toString, unaryMinus: unaryMinus, unsignedRightShift: unsignedRightShift }; es-abstract-1.20.4/2021/BigInt/leftShift.js000066400000000000000000000007301431761430200200350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-leftShift module.exports = function BigIntLeftShift(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x << y; }; es-abstract-1.20.4/2021/BigInt/lessThan.js000066400000000000000000000007251431761430200176720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-lessThan module.exports = function BigIntLessThan(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x < y; }; es-abstract-1.20.4/2021/BigInt/multiply.js000066400000000000000000000007251431761430200177700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-multiply module.exports = function BigIntMultiply(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x * y; }; es-abstract-1.20.4/2021/BigInt/remainder.js000066400000000000000000000013021431761430200200470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var zero = $BigInt && $BigInt(0); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-remainder module.exports = function BigIntRemainder(n, d) { if (Type(n) !== 'BigInt' || Type(d) !== 'BigInt') { throw new $TypeError('Assertion failed: `n` and `d` arguments must be BigInts'); } if (d === zero) { throw new $RangeError('Division by zero'); } if (n === zero) { return zero; } // shortcut for the actual spec mechanics return n % d; }; es-abstract-1.20.4/2021/BigInt/sameValue.js000066400000000000000000000007361431761430200200350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var BigIntEqual = require('./equal'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValue module.exports = function BigIntSameValue(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntEqual(x, y); }; es-abstract-1.20.4/2021/BigInt/sameValueZero.js000066400000000000000000000007461431761430200206760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var BigIntEqual = require('./equal'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValueZero module.exports = function BigIntSameValueZero(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntEqual(x, y); }; es-abstract-1.20.4/2021/BigInt/signedRightShift.js000066400000000000000000000007711431761430200213570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var BigIntLeftShift = require('./leftShift'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-signedRightShift module.exports = function BigIntSignedRightShift(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntLeftShift(x, -y); }; es-abstract-1.20.4/2021/BigInt/subtract.js000066400000000000000000000007251431761430200177400ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-subtract module.exports = function BigIntSubtract(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x - y; }; es-abstract-1.20.4/2021/BigInt/toString.js000066400000000000000000000006531431761430200177220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-tostring module.exports = function BigIntToString(x) { if (Type(x) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` must be a BigInt'); } return $String(x); }; es-abstract-1.20.4/2021/BigInt/unaryMinus.js000066400000000000000000000007771431761430200202720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var zero = $BigInt && $BigInt(0); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unaryMinus module.exports = function BigIntUnaryMinus(x) { if (Type(x) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` argument must be a BigInt'); } if (x === zero) { return zero; } return -x; }; es-abstract-1.20.4/2021/BigInt/unsignedRightShift.js000066400000000000000000000007761431761430200217270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unsignedRightShift module.exports = function BigIntUnsignedRightShift(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } throw new $TypeError('BigInts have no unsigned right shift, use >> instead'); }; es-abstract-1.20.4/2021/BigIntBitwiseOp.js000066400000000000000000000033071431761430200177360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // var $BigInt = GetIntrinsic('%BigInt%', true); // var $pow = GetIntrinsic('%Math.pow%'); // var BinaryAnd = require('./BinaryAnd'); // var BinaryOr = require('./BinaryOr'); // var BinaryXor = require('./BinaryXor'); var Type = require('./Type'); // var modulo = require('./modulo'); // var zero = $BigInt && $BigInt(0); // var negOne = $BigInt && $BigInt(-1); // var two = $BigInt && $BigInt(2); // https://262.ecma-international.org/11.0/#sec-bigintbitwiseop module.exports = function BigIntBitwiseOp(op, x, y) { if (op !== '&' && op !== '|' && op !== '^') { throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`'); } if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('`x` and `y` must be BigInts'); } if (op === '&') { return x & y; } if (op === '|') { return x | y; } return x ^ y; /* var result = zero; var shift = 0; while (x !== zero && x !== negOne && y !== zero && y !== negOne) { var xDigit = modulo(x, two); var yDigit = modulo(y, two); if (op === '&') { result += $pow(2, shift) * BinaryAnd(xDigit, yDigit); } else if (op === '|') { result += $pow(2, shift) * BinaryOr(xDigit, yDigit); } else if (op === '^') { result += $pow(2, shift) * BinaryXor(xDigit, yDigit); } shift += 1; x = (x - xDigit) / two; y = (y - yDigit) / two; } var tmp; if (op === '&') { tmp = BinaryAnd(modulo(x, two), modulo(y, two)); } else if (op === '|') { tmp = BinaryAnd(modulo(x, two), modulo(y, two)); } else { tmp = BinaryXor(modulo(x, two), modulo(y, two)); } if (tmp !== 0) { result -= $pow(2, shift); } return result; */ }; es-abstract-1.20.4/2021/BinaryAnd.js000066400000000000000000000005541431761430200166040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // https://262.ecma-international.org/11.0/#sec-binaryand module.exports = function BinaryAnd(x, y) { if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); } return x & y; }; es-abstract-1.20.4/2021/BinaryOr.js000066400000000000000000000005521431761430200164600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // https://262.ecma-international.org/11.0/#sec-binaryor module.exports = function BinaryOr(x, y) { if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); } return x | y; }; es-abstract-1.20.4/2021/BinaryXor.js000066400000000000000000000005541431761430200166520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // https://262.ecma-international.org/11.0/#sec-binaryxor module.exports = function BinaryXor(x, y) { if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); } return x ^ y; }; es-abstract-1.20.4/2021/ByteListBitwiseOp.js000066400000000000000000000024531431761430200203220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $push = callBound('Array.prototype.push'); var IsArray = require('./IsArray'); var isByteValue = require('../helpers/isByteValue'); // https://ecma-international.org/ecma-262/12.0/#sec-bytelistbitwiseop module.exports = function ByteListBitwiseOp(op, xBytes, yBytes) { if (op !== '&' && op !== '^' && op !== '|') { throw new $TypeError('Assertion failed: `op` must be `&`, `^`, or `|`'); } if (!IsArray(xBytes) || !IsArray(yBytes) || xBytes.length !== yBytes.length) { throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be same-length sequences of byte values (an integer 0-255, inclusive)'); } var result = []; for (var i = 0; i < xBytes.length; i += 1) { var xByte = xBytes[i]; var yByte = yBytes[i]; if (!isByteValue(xByte) || !isByteValue(yByte)) { throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be same-length sequences of byte values (an integer 0-255, inclusive)'); } var resultByte; if (op === '&') { resultByte = xByte & yByte; } else if (op === '^') { resultByte = xByte ^ yByte; } else { resultByte = xByte | yByte; } $push(result, resultByte); } return result; }; es-abstract-1.20.4/2021/ByteListEqual.js000066400000000000000000000016211431761430200174600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsArray = require('./IsArray'); var isByteValue = require('../helpers/isByteValue'); // https://ecma-international.org/ecma-262/12.0/#sec-bytelistequal module.exports = function ByteListEqual(xBytes, yBytes) { if (!IsArray(xBytes) || !IsArray(yBytes)) { throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be sequences of byte values (an integer 0-255, inclusive)'); } if (xBytes.length !== yBytes.length) { return false; } for (var i = 0; i < xBytes.length; i += 1) { var xByte = xBytes[i]; var yByte = yBytes[i]; if (!isByteValue(xByte) || !isByteValue(yByte)) { throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be sequences of byte values (an integer 0-255, inclusive)'); } if (xByte !== yByte) { return false; } } return true; }; es-abstract-1.20.4/2021/Call.js000066400000000000000000000011571431761430200156100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsArray = require('./IsArray'); var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%'); // https://ecma-international.org/ecma-262/6.0/#sec-call module.exports = function Call(F, V) { var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } return $apply(F, V, argumentsList); }; es-abstract-1.20.4/2021/CanonicalNumericIndexString.js000066400000000000000000000012161431761430200223220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring module.exports = function CanonicalNumericIndexString(argument) { if (Type(argument) !== 'String') { throw new $TypeError('Assertion failed: `argument` must be a String'); } if (argument === '-0') { return -0; } var n = ToNumber(argument); if (SameValue(ToString(n), argument)) { return n; } return void 0; }; es-abstract-1.20.4/2021/CharacterRange.js000066400000000000000000000014161431761430200176040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = callBound('%String.prototype.charCodeAt%'); var $push = callBound('%Array.prototype.push%'); module.exports = function CharacterRange(A, B) { if (A.length !== 1 || B.length !== 1) { throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); } var a = A[0]; var b = B[0]; var i = $charCodeAt(a, 0); var j = $charCodeAt(b, 0); if (!(i <= j)) { throw new $TypeError('Assertion failed: i is not <= j'); } var arr = []; for (var k = i; k <= j; k += 1) { $push(arr, $fromCharCode(k)); } return arr; }; es-abstract-1.20.4/2021/ClearKeptObjects.js000066400000000000000000000004561431761430200201220ustar00rootroot00000000000000'use strict'; var SLOT = require('internal-slot'); var keptObjects = []; // https://ecma-international.org/ecma-262/12.0/#sec-clear-kept-objects module.exports = function ClearKeptObjects() { keptObjects.length = 0; }; SLOT.set(module.exports, '[[es-abstract internal: KeptAlive]]', keptObjects); es-abstract-1.20.4/2021/CodePointAt.js000066400000000000000000000033141431761430200171030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var Type = require('./Type'); var UTF16SurrogatePairToCodePoint = require('./UTF16SurrogatePairToCodePoint'); var $charAt = callBound('String.prototype.charAt'); var $charCodeAt = callBound('String.prototype.charCodeAt'); // https://ecma-international.org/ecma-262/12.0/#sec-codepointat module.exports = function CodePointAt(string, position) { if (Type(string) !== 'String') { throw new $TypeError('Assertion failed: `string` must be a String'); } var size = string.length; if (position < 0 || position >= size) { throw new $TypeError('Assertion failed: `position` must be >= 0, and < the length of `string`'); } var first = $charCodeAt(string, position); var cp = $charAt(string, position); var firstIsLeading = isLeadingSurrogate(first); var firstIsTrailing = isTrailingSurrogate(first); if (!firstIsLeading && !firstIsTrailing) { return { '[[CodePoint]]': cp, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': false }; } if (firstIsTrailing || (position + 1 === size)) { return { '[[CodePoint]]': cp, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': true }; } var second = $charCodeAt(string, position + 1); if (!isTrailingSurrogate(second)) { return { '[[CodePoint]]': cp, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': true }; } return { '[[CodePoint]]': UTF16SurrogatePairToCodePoint(first, second), '[[CodeUnitCount]]': 2, '[[IsUnpairedSurrogate]]': false }; }; es-abstract-1.20.4/2021/CodePointsToString.js000066400000000000000000000014241431761430200204730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint'); var IsArray = require('./IsArray'); var forEach = require('../helpers/forEach'); var isCodePoint = require('../helpers/isCodePoint'); // https://ecma-international.org/ecma-262/12.0/#sec-codepointstostring module.exports = function CodePointsToString(text) { if (!IsArray(text)) { throw new $TypeError('Assertion failed: `text` must be a sequence of Unicode Code Points'); } var result = ''; forEach(text, function (cp) { if (!isCodePoint(cp)) { throw new $TypeError('Assertion failed: `text` must be a sequence of Unicode Code Points'); } result += UTF16EncodeCodePoint(cp); }); return result; }; es-abstract-1.20.4/2021/CompletePropertyDescriptor.js000066400000000000000000000017351431761430200223130ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor module.exports = function CompletePropertyDescriptor(Desc) { /* eslint no-param-reassign: 0 */ assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (!has(Desc, '[[Value]]')) { Desc['[[Value]]'] = void 0; } if (!has(Desc, '[[Writable]]')) { Desc['[[Writable]]'] = false; } } else { if (!has(Desc, '[[Get]]')) { Desc['[[Get]]'] = void 0; } if (!has(Desc, '[[Set]]')) { Desc['[[Set]]'] = void 0; } } if (!has(Desc, '[[Enumerable]]')) { Desc['[[Enumerable]]'] = false; } if (!has(Desc, '[[Configurable]]')) { Desc['[[Configurable]]'] = false; } return Desc; }; es-abstract-1.20.4/2021/CopyDataProperties.js000066400000000000000000000040061431761430200205120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var every = require('../helpers/every'); var some = require('../helpers/some'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsIntegralNumber = require('./IsIntegralNumber'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); var Type = require('./Type'); // https://www.ecma-international.org/ecma-262/12.0/#sec-copydataproperties module.exports = function CopyDataProperties(target, source, excludedItems) { if (Type(target) !== 'Object') { throw new $TypeError('Assertion failed: "target" must be an Object'); } if (!IsArray(excludedItems) || !every(excludedItems, IsPropertyKey)) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } if (typeof source === 'undefined' || source === null) { return target; } var from = ToObject(source); var keys = OwnPropertyKeys(from); forEach(keys, function (nextKey) { var excluded = some(excludedItems, function (e) { return SameValue(e, nextKey) === true; }); /* var excluded = false; forEach(excludedItems, function (e) { if (SameValue(e, nextKey) === true) { excluded = true; } }); */ var enumerable = $isEnumerable(from, nextKey) || ( // this is to handle string keys being non-enumerable in older engines typeof source === 'string' && nextKey >= 0 && IsIntegralNumber(ToNumber(nextKey)) ); if (excluded === false && enumerable) { var propValue = Get(from, nextKey); CreateDataPropertyOrThrow(target, nextKey, propValue); } }); return target; }; es-abstract-1.20.4/2021/CreateDataProperty.js000066400000000000000000000023771431761430200205040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty module.exports = function CreateDataProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var oldDesc = OrdinaryGetOwnProperty(O, P); var extensible = !oldDesc || IsExtensible(O); var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]']; if (nonConfigurable || !extensible) { return false; } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Value]]': V, '[[Writable]]': true } ); }; es-abstract-1.20.4/2021/CreateDataPropertyOrThrow.js000066400000000000000000000013361431761430200220230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var CreateDataProperty = require('./CreateDataProperty'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var success = CreateDataProperty(O, P, V); if (!success) { throw new $TypeError('unable to create data property'); } return success; }; es-abstract-1.20.4/2021/CreateHTML.js000066400000000000000000000016371431761430200166300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $replace = callBound('String.prototype.replace'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createhtml module.exports = function CreateHTML(string, tag, attribute, value) { if (Type(tag) !== 'String' || Type(attribute) !== 'String') { throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings'); } var str = RequireObjectCoercible(string); var S = ToString(str); var p1 = '<' + tag; if (attribute !== '') { var V = ToString(value); var escapedV = $replace(V, /\x22/g, '"'); p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22'; } return p1 + '>' + S + ''; }; es-abstract-1.20.4/2021/CreateIterResultObject.js000066400000000000000000000006601431761430200213100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject module.exports = function CreateIterResultObject(value, done) { if (Type(done) !== 'Boolean') { throw new $TypeError('Assertion failed: Type(done) is not Boolean'); } return { value: value, done: done }; }; es-abstract-1.20.4/2021/CreateListFromArrayLike.js000066400000000000000000000025231431761430200214220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $indexOf = callBound('Array.prototype.indexOf', true) || callBound('String.prototype.indexOf'); var $push = callBound('Array.prototype.push'); var Get = require('./Get'); var IsArray = require('./IsArray'); var LengthOfArrayLike = require('./LengthOfArrayLike'); var ToString = require('./ToString'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-createlistfromarraylike module.exports = function CreateListFromArrayLike(obj) { var elementTypes = arguments.length > 1 ? arguments[1] : ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object']; if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } if (!IsArray(elementTypes)) { throw new $TypeError('Assertion failed: `elementTypes`, if provided, must be an array'); } var len = LengthOfArrayLike(obj); var list = []; var index = 0; while (index < len) { var indexName = ToString(index); var next = Get(obj, indexName); var nextType = Type(next); if ($indexOf(elementTypes, nextType) < 0) { throw new $TypeError('item type ' + nextType + ' is not a valid elementType'); } $push(list, next); index += 1; } return list; }; es-abstract-1.20.4/2021/CreateMethodProperty.js000066400000000000000000000017231431761430200210450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty module.exports = function CreateMethodProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var newDesc = { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': V, '[[Writable]]': true }; return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, newDesc ); }; es-abstract-1.20.4/2021/CreateRegExpStringIterator.js000066400000000000000000000071741431761430200221610ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var IteratorPrototype = GetIntrinsic('%IteratorPrototype%', true); var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); var AdvanceStringIndex = require('./AdvanceStringIndex'); var CreateIterResultObject = require('./CreateIterResultObject'); var CreateMethodProperty = require('./CreateMethodProperty'); var Get = require('./Get'); var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); var RegExpExec = require('./RegExpExec'); var Set = require('./Set'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var Type = require('./Type'); var SLOT = require('internal-slot'); var RegExpStringIterator = function RegExpStringIterator(R, S, global, fullUnicode) { if (Type(S) !== 'String') { throw new $TypeError('`S` must be a string'); } if (Type(global) !== 'Boolean') { throw new $TypeError('`global` must be a boolean'); } if (Type(fullUnicode) !== 'Boolean') { throw new $TypeError('`fullUnicode` must be a boolean'); } SLOT.set(this, '[[IteratingRegExp]]', R); SLOT.set(this, '[[IteratedString]]', S); SLOT.set(this, '[[Global]]', global); SLOT.set(this, '[[Unicode]]', fullUnicode); SLOT.set(this, '[[Done]]', false); }; if (IteratorPrototype) { RegExpStringIterator.prototype = OrdinaryObjectCreate(IteratorPrototype); } var RegExpStringIteratorNext = function next() { var O = this; // eslint-disable-line no-invalid-this if (Type(O) !== 'Object') { throw new $TypeError('receiver must be an object'); } if ( !(O instanceof RegExpStringIterator) || !SLOT.has(O, '[[IteratingRegExp]]') || !SLOT.has(O, '[[IteratedString]]') || !SLOT.has(O, '[[Global]]') || !SLOT.has(O, '[[Unicode]]') || !SLOT.has(O, '[[Done]]') ) { throw new $TypeError('"this" value must be a RegExpStringIterator instance'); } if (SLOT.get(O, '[[Done]]')) { return CreateIterResultObject(undefined, true); } var R = SLOT.get(O, '[[IteratingRegExp]]'); var S = SLOT.get(O, '[[IteratedString]]'); var global = SLOT.get(O, '[[Global]]'); var fullUnicode = SLOT.get(O, '[[Unicode]]'); var match = RegExpExec(R, S); if (match === null) { SLOT.set(O, '[[Done]]', true); return CreateIterResultObject(undefined, true); } if (global) { var matchStr = ToString(Get(match, '0')); if (matchStr === '') { var thisIndex = ToLength(Get(R, 'lastIndex')); var nextIndex = AdvanceStringIndex(S, thisIndex, fullUnicode); Set(R, 'lastIndex', nextIndex, true); } return CreateIterResultObject(match, false); } SLOT.set(O, '[[Done]]', true); return CreateIterResultObject(match, false); }; CreateMethodProperty(RegExpStringIterator.prototype, 'next', RegExpStringIteratorNext); if (hasSymbols) { if (Symbol.toStringTag) { if ($defineProperty) { $defineProperty(RegExpStringIterator.prototype, Symbol.toStringTag, { configurable: true, enumerable: false, value: 'RegExp String Iterator', writable: false }); } else { RegExpStringIterator.prototype[Symbol.toStringTag] = 'RegExp String Iterator'; } } if (Symbol.iterator && typeof RegExpStringIterator.prototype[Symbol.iterator] !== 'function') { var iteratorFn = function SymbolIterator() { return this; }; CreateMethodProperty(RegExpStringIterator.prototype, Symbol.iterator, iteratorFn); } } // https://262.ecma-international.org/11.0/#sec-createregexpstringiterator module.exports = function CreateRegExpStringIterator(R, S, global, fullUnicode) { // assert R.global === global && R.unicode === fullUnicode? return new RegExpStringIterator(R, S, global, fullUnicode); }; es-abstract-1.20.4/2021/DateFromTime.js000066400000000000000000000020141431761430200172460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); var MonthFromTime = require('./MonthFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.5 module.exports = function DateFromTime(t) { var m = MonthFromTime(t); var d = DayWithinYear(t); if (m === 0) { return d + 1; } if (m === 1) { return d - 30; } var leap = InLeapYear(t); if (m === 2) { return d - 58 - leap; } if (m === 3) { return d - 89 - leap; } if (m === 4) { return d - 119 - leap; } if (m === 5) { return d - 150 - leap; } if (m === 6) { return d - 180 - leap; } if (m === 7) { return d - 211 - leap; } if (m === 8) { return d - 242 - leap; } if (m === 9) { return d - 272 - leap; } if (m === 10) { return d - 303 - leap; } if (m === 11) { return d - 333 - leap; } throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m); }; es-abstract-1.20.4/2021/DateString.js000066400000000000000000000020371431761430200167770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; var $isNaN = require('../helpers/isNaN'); var padTimeComponent = require('../helpers/padTimeComponent'); var Type = require('./Type'); var WeekDay = require('./WeekDay'); var MonthFromTime = require('./MonthFromTime'); var YearFromTime = require('./YearFromTime'); var DateFromTime = require('./DateFromTime'); // https://262.ecma-international.org/9.0/#sec-datestring module.exports = function DateString(tv) { if (Type(tv) !== 'Number' || $isNaN(tv)) { throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); } var weekday = weekdays[WeekDay(tv)]; var month = months[MonthFromTime(tv)]; var day = padTimeComponent(DateFromTime(tv)); var year = padTimeComponent(YearFromTime(tv), 4); return weekday + '\x20' + month + '\x20' + day + '\x20' + year; }; es-abstract-1.20.4/2021/Day.js000066400000000000000000000003521431761430200154460ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function Day(t) { return floor(t / msPerDay); }; es-abstract-1.20.4/2021/DayFromYear.js000066400000000000000000000004001431761430200171050ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DayFromYear(y) { return (365 * (y - 1970)) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400); }; es-abstract-1.20.4/2021/DayWithinYear.js000066400000000000000000000004361431761430200174550ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var DayFromYear = require('./DayFromYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function DayWithinYear(t) { return Day(t) - DayFromYear(YearFromTime(t)); }; es-abstract-1.20.4/2021/DaysInYear.js000066400000000000000000000004551431761430200167450ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DaysInYear(y) { if (modulo(y, 4) !== 0) { return 365; } if (modulo(y, 100) !== 0) { return 366; } if (modulo(y, 400) !== 0) { return 365; } return 366; }; es-abstract-1.20.4/2021/DefinePropertyOrThrow.js000066400000000000000000000026721431761430200212240ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow module.exports = function DefinePropertyOrThrow(O, P, desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var Desc = isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, desc) ? desc : ToPropertyDescriptor(desc); if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor'); } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); }; es-abstract-1.20.4/2021/DeletePropertyOrThrow.js000066400000000000000000000012731431761430200212300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow module.exports = function DeletePropertyOrThrow(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // eslint-disable-next-line no-param-reassign var success = delete O[P]; if (!success) { throw new $TypeError('Attempt to delete property failed.'); } return success; }; es-abstract-1.20.4/2021/EnumerableOwnPropertyNames.js000066400000000000000000000021301431761430200222210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var objectKeys = require('object-keys'); var callBound = require('call-bind/callBound'); var callBind = require('call-bind'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%')); var forEach = require('../helpers/forEach'); var Type = require('./Type'); // https://262.ecma-international.org/8.0/#sec-enumerableownproperties module.exports = function EnumerableOwnPropertyNames(O, kind) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var keys = objectKeys(O); if (kind === 'key') { return keys; } if (kind === 'value' || kind === 'key+value') { var results = []; forEach(keys, function (key) { if ($isEnumerable(O, key)) { $pushApply(results, [ kind === 'value' ? O[key] : [key, O[key]] ]); } }); return results; } throw new $TypeError('Assertion failed: "kind" is not "key", "value", or "key+value": ' + kind); }; es-abstract-1.20.4/2021/FlattenIntoArray.js000066400000000000000000000033301431761430200201560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var Call = require('./Call'); var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var HasProperty = require('./HasProperty'); var IsArray = require('./IsArray'); var LengthOfArrayLike = require('./LengthOfArrayLike'); var ToString = require('./ToString'); // https://262.ecma-international.org/11.0/#sec-flattenintoarray // eslint-disable-next-line max-params module.exports = function FlattenIntoArray(target, source, sourceLen, start, depth) { var mapperFunction; if (arguments.length > 5) { mapperFunction = arguments[5]; } var targetIndex = start; var sourceIndex = 0; while (sourceIndex < sourceLen) { var P = ToString(sourceIndex); var exists = HasProperty(source, P); if (exists === true) { var element = Get(source, P); if (typeof mapperFunction !== 'undefined') { if (arguments.length <= 6) { throw new $TypeError('Assertion failed: thisArg is required when mapperFunction is provided'); } element = Call(mapperFunction, arguments[6], [element, sourceIndex, source]); } var shouldFlatten = false; if (depth > 0) { shouldFlatten = IsArray(element); } if (shouldFlatten) { var elementLen = LengthOfArrayLike(element); targetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1); } else { if (targetIndex >= MAX_SAFE_INTEGER) { throw new $TypeError('index too large'); } CreateDataPropertyOrThrow(target, ToString(targetIndex), element); targetIndex += 1; } } sourceIndex += 1; } return targetIndex; }; es-abstract-1.20.4/2021/FromPropertyDescriptor.js000066400000000000000000000007021431761430200214370ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor module.exports = function FromPropertyDescriptor(Desc) { if (typeof Desc !== 'undefined') { assertRecord(Type, 'Property Descriptor', 'Desc', Desc); } return fromPropertyDescriptor(Desc); }; es-abstract-1.20.4/2021/Get.js000066400000000000000000000011321431761430200154450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var inspect = require('object-inspect'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-get-o-p module.exports = function Get(O, P) { // 7.3.1.1 if (Type(O) !== 'Object') { 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)); } // 7.3.1.3 return O[P]; }; es-abstract-1.20.4/2021/GetIterator.js000066400000000000000000000032701431761430200171640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $asyncIterator = GetIntrinsic('%Symbol.asyncIterator%', true); var inspect = require('object-inspect'); var hasSymbols = require('has-symbols')(); var getIteratorMethod = require('../helpers/getIteratorMethod'); var AdvanceStringIndex = require('./AdvanceStringIndex'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsArray = require('./IsArray'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-getiterator module.exports = function GetIterator(obj, hint, method) { var actualHint = hint; if (arguments.length < 2) { actualHint = 'sync'; } if (actualHint !== 'sync' && actualHint !== 'async') { throw new $TypeError("Assertion failed: `hint` must be one of 'sync' or 'async', got " + inspect(hint)); } var actualMethod = method; if (arguments.length < 3) { if (actualHint === 'async') { if (hasSymbols && $asyncIterator) { actualMethod = GetMethod(obj, $asyncIterator); } if (actualMethod === undefined) { throw new $TypeError("async from sync iterators aren't currently supported"); } } else { actualMethod = getIteratorMethod( { AdvanceStringIndex: AdvanceStringIndex, GetMethod: GetMethod, IsArray: IsArray }, obj ); } } var iterator = Call(actualMethod, obj); if (Type(iterator) !== 'Object') { throw new $TypeError('iterator must return an object'); } return iterator; // TODO: This should return an IteratorRecord /* var nextMethod = GetV(iterator, 'next'); return { '[[Iterator]]': iterator, '[[NextMethod]]': nextMethod, '[[Done]]': false }; */ }; es-abstract-1.20.4/2021/GetMethod.js000066400000000000000000000012271431761430200166130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-getmethod module.exports = function GetMethod(O, P) { // 7.3.9.1 if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // 7.3.9.2 var func = GetV(O, P); // 7.3.9.4 if (func == null) { return void 0; } // 7.3.9.5 if (!IsCallable(func)) { throw new $TypeError(P + 'is not a function'); } // 7.3.9.6 return func; }; es-abstract-1.20.4/2021/GetOwnPropertyKeys.js000066400000000000000000000014751431761430200205440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%', true); var keys = require('object-keys'); var esType = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys module.exports = function GetOwnPropertyKeys(O, Type) { if (esType(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (Type === 'Symbol') { return $gOPS ? $gOPS(O) : []; } if (Type === 'String') { if (!$gOPN) { return keys(O); } return $gOPN(O); } throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`'); }; es-abstract-1.20.4/2021/GetPromiseResolve.js000066400000000000000000000012641431761430200203520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var IsConstructor = require('./IsConstructor'); // https://ecma-international.org/ecma-262/12.0/#sec-getpromiseresolve module.exports = function GetPromiseResolve(promiseConstructor) { if (!IsConstructor(promiseConstructor)) { throw new $TypeError('Assertion failed: `promiseConstructor` must be a constructor'); } var promiseResolve = Get(promiseConstructor, 'resolve'); if (IsCallable(promiseResolve) === false) { throw new $TypeError('`resolve` method is not callable'); } return promiseResolve; }; es-abstract-1.20.4/2021/GetPrototypeFromConstructor.js000066400000000000000000000016311431761430200224710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Function = GetIntrinsic('%Function%'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic if (!IsConstructor(constructor)) { throw new $TypeError('Assertion failed: `constructor` must be a constructor'); } var proto = Get(constructor, 'prototype'); if (Type(proto) !== 'Object') { if (!(constructor instanceof $Function)) { // ignore other realms, for now throw new $TypeError('cross-realm constructors not currently supported'); } proto = intrinsic; } return proto; }; es-abstract-1.20.4/2021/GetSubstitution.js000066400000000000000000000105501431761430200201060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var every = require('../helpers/every'); var $charAt = callBound('String.prototype.charAt'); var $strSlice = callBound('String.prototype.slice'); var $indexOf = callBound('String.prototype.indexOf'); var $parseInt = parseInt; var isDigit = regexTester(/^[0-9]$/); var inspect = require('object-inspect'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsIntegralNumber = require('./IsIntegralNumber'); var ToObject = require('./ToObject'); var ToString = require('./ToString'); var Type = require('./Type'); var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false var isStringOrHole = function (capture, index, arr) { return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined'); }; // http://www.ecma-international.org/ecma-262/12.0/#sec-getsubstitution // eslint-disable-next-line max-statements, max-params, max-lines-per-function module.exports = function GetSubstitution(matched, str, position, captures, namedCaptures, replacement) { if (Type(matched) !== 'String') { throw new $TypeError('Assertion failed: `matched` must be a String'); } var matchLength = matched.length; if (Type(str) !== 'String') { throw new $TypeError('Assertion failed: `str` must be a String'); } var stringLength = str.length; if (!IsIntegralNumber(position) || position < 0 || position > stringLength) { throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position)); } if (!IsArray(captures) || !every(captures, isStringOrHole)) { throw new $TypeError('Assertion failed: `captures` must be a possibly-empty List of Strings, got ' + inspect(captures)); } if (Type(replacement) !== 'String') { throw new $TypeError('Assertion failed: `replacement` must be a String'); } var tailPos = position + matchLength; var m = captures.length; if (Type(namedCaptures) !== 'Undefined') { namedCaptures = ToObject(namedCaptures); // eslint-disable-line no-param-reassign } var result = ''; for (var i = 0; i < replacement.length; i += 1) { // if this is a $, and it's not the end of the replacement var current = $charAt(replacement, i); var isLast = (i + 1) >= replacement.length; var nextIsLast = (i + 2) >= replacement.length; if (current === '$' && !isLast) { var next = $charAt(replacement, i + 1); if (next === '$') { result += '$'; i += 1; } else if (next === '&') { result += matched; i += 1; } else if (next === '`') { result += position === 0 ? '' : $strSlice(str, 0, position - 1); i += 1; } else if (next === "'") { result += tailPos >= stringLength ? '' : $strSlice(str, tailPos); i += 1; } else { var nextNext = nextIsLast ? null : $charAt(replacement, i + 2); if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) { // $1 through $9, and not followed by a digit var n = $parseInt(next, 10); // if (n > m, impl-defined) result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1]; i += 1; } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) { // $00 through $99 var nn = next + nextNext; var nnI = $parseInt(nn, 10) - 1; // if nn === '00' or nn > m, impl-defined result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI]; i += 2; } else if (next === '<') { // eslint-disable-next-line max-depth if (Type(namedCaptures) === 'Undefined') { result += '$<'; i += 2; } else { var endIndex = $indexOf(replacement, '>', i); // eslint-disable-next-line max-depth if (endIndex > -1) { var groupName = $strSlice(replacement, i + '$<'.length, endIndex); var capture = Get(namedCaptures, groupName); // eslint-disable-next-line max-depth if (Type(capture) !== 'Undefined') { result += ToString(capture); } i += ('<' + groupName + '>').length; } } } else { result += '$'; } } } else { // the final $, or else not a $ result += $charAt(replacement, i); } } return result; }; es-abstract-1.20.4/2021/GetV.js000066400000000000000000000007321431761430200156000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var ToObject = require('./ToObject'); // https://ecma-international.org/ecma-262/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'); } // 7.3.2.2-3 var O = ToObject(V); // 7.3.2.4 return O[P]; }; es-abstract-1.20.4/2021/HasOwnProperty.js000066400000000000000000000010511431761430200176720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var has = require('has'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty module.exports = function HasOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return has(O, P); }; es-abstract-1.20.4/2021/HasProperty.js000066400000000000000000000010051431761430200172050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty module.exports = function HasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2021/HourFromTime.js000066400000000000000000000005761431761430200173210ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerHour = timeConstants.msPerHour; var HoursPerDay = timeConstants.HoursPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function HourFromTime(t) { return modulo(floor(t / msPerHour), HoursPerDay); }; es-abstract-1.20.4/2021/InLeapYear.js000066400000000000000000000007761431761430200167340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DaysInYear = require('./DaysInYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function InLeapYear(t) { var days = DaysInYear(YearFromTime(t)); if (days === 365) { return 0; } if (days === 366) { return 1; } throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days); }; es-abstract-1.20.4/2021/InstanceofOperator.js000066400000000000000000000016261431761430200205430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $hasInstance = GetIntrinsic('Symbol.hasInstance', true); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var OrdinaryHasInstance = require('./OrdinaryHasInstance'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator module.exports = function InstanceofOperator(O, C) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var instOfHandler = $hasInstance ? GetMethod(C, $hasInstance) : void 0; if (typeof instOfHandler !== 'undefined') { return ToBoolean(Call(instOfHandler, C, [O])); } if (!IsCallable(C)) { throw new $TypeError('`C` is not Callable'); } return OrdinaryHasInstance(C, O); }; es-abstract-1.20.4/2021/Invoke.js000066400000000000000000000013131431761430200161620ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-invoke module.exports = function Invoke(O, P) { if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } var func = GetV(O, P); return Call(func, O, argumentsList); }; es-abstract-1.20.4/2021/IsAccessorDescriptor.js000066400000000000000000000007211431761430200210260ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor module.exports = function IsAccessorDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { return false; } return true; }; es-abstract-1.20.4/2021/IsArray.js000066400000000000000000000001731431761430200163040ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-isarray module.exports = require('../helpers/IsArray'); es-abstract-1.20.4/2021/IsBigIntElementType.js000066400000000000000000000003021431761430200205500ustar00rootroot00000000000000'use strict'; // https://262.ecma-international.org/11.0/#sec-isbigintelementtype module.exports = function IsBigIntElementType(type) { return type === 'BigUint64' || type === 'BigInt64'; }; es-abstract-1.20.4/2021/IsCallable.js000066400000000000000000000001541431761430200167240ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.11 module.exports = require('is-callable'); es-abstract-1.20.4/2021/IsCompatiblePropertyDescriptor.js000066400000000000000000000005571431761430200231170ustar00rootroot00000000000000'use strict'; var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); }; es-abstract-1.20.4/2021/IsConcatSpreadable.js000066400000000000000000000011621431761430200204170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable module.exports = function IsConcatSpreadable(O) { if (Type(O) !== 'Object') { return false; } if ($isConcatSpreadable) { var spreadable = Get(O, $isConcatSpreadable); if (typeof spreadable !== 'undefined') { return ToBoolean(spreadable); } } return IsArray(O); }; es-abstract-1.20.4/2021/IsConstructor.js000066400000000000000000000021751431761430200175570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('../GetIntrinsic.js'); var $construct = GetIntrinsic('%Reflect.construct%', true); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); try { DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} }); } catch (e) { // Accessor properties aren't supported DefinePropertyOrThrow = null; } // https://ecma-international.org/ecma-262/6.0/#sec-isconstructor if (DefinePropertyOrThrow && $construct) { var isConstructorMarker = {}; var badArrayLike = {}; DefinePropertyOrThrow(badArrayLike, 'length', { '[[Get]]': function () { throw isConstructorMarker; }, '[[Enumerable]]': true }); module.exports = function IsConstructor(argument) { try { // `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`: $construct(argument, badArrayLike); } catch (err) { return err === isConstructorMarker; } }; } else { module.exports = function IsConstructor(argument) { // unfortunately there's no way to truly check this without try/catch `new argument` in old environments return typeof argument === 'function' && !!argument.prototype; }; } es-abstract-1.20.4/2021/IsDataDescriptor.js000066400000000000000000000007201431761430200201340ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor module.exports = function IsDataDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { return false; } return true; }; es-abstract-1.20.4/2021/IsExtensible.js000066400000000000000000000007751431761430200173400ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $isExtensible = GetIntrinsic('%Object.isExtensible%', true); var isPrimitive = require('../helpers/isPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o module.exports = $preventExtensions ? function IsExtensible(obj) { return !isPrimitive(obj) && $isExtensible(obj); } : function IsExtensible(obj) { return !isPrimitive(obj); }; es-abstract-1.20.4/2021/IsGenericDescriptor.js000066400000000000000000000010601431761430200206350ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor module.exports = function IsGenericDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) { return true; } return false; }; es-abstract-1.20.4/2021/IsIntegralNumber.js000066400000000000000000000007311431761430200201440ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var Type = require('./Type'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); // https://tc39.es/ecma262/#sec-isintegralnumber module.exports = function IsIntegralNumber(argument) { if (Type(argument) !== 'Number' || $isNaN(argument) || !$isFinite(argument)) { return false; } var absValue = abs(argument); return floor(absValue) === absValue; }; es-abstract-1.20.4/2021/IsNoTearConfiguration.js000066400000000000000000000007231431761430200211470ustar00rootroot00000000000000'use strict'; var IsUnclampedIntegerElementType = require('./IsUnclampedIntegerElementType'); var IsBigIntElementType = require('./IsBigIntElementType'); // https://262.ecma-international.org/11.0/#sec-isnotearconfiguration module.exports = function IsNoTearConfiguration(type, order) { if (IsUnclampedIntegerElementType(type)) { return true; } if (IsBigIntElementType(type) && order !== 'Init' && order !== 'Unordered') { return true; } return false; }; es-abstract-1.20.4/2021/IsPromise.js000066400000000000000000000007451431761430200166510ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $PromiseThen = callBound('Promise.prototype.then', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ispromise module.exports = function IsPromise(x) { if (Type(x) !== 'Object') { return false; } if (!$PromiseThen) { // Promises are not supported return false; } try { $PromiseThen(x); // throws if not a promise } catch (e) { return false; } return true; }; es-abstract-1.20.4/2021/IsPropertyKey.js000066400000000000000000000003171431761430200175230ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { return typeof argument === 'string' || typeof argument === 'symbol'; }; es-abstract-1.20.4/2021/IsRegExp.js000066400000000000000000000010411431761430200164130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $match = GetIntrinsic('%Symbol.match%', true); var hasRegExpMatcher = require('is-regex'); var ToBoolean = require('./ToBoolean'); // https://ecma-international.org/ecma-262/6.0/#sec-isregexp module.exports = function IsRegExp(argument) { if (!argument || typeof argument !== 'object') { return false; } if ($match) { var isRegExp = argument[$match]; if (typeof isRegExp !== 'undefined') { return ToBoolean(isRegExp); } } return hasRegExpMatcher(argument); }; es-abstract-1.20.4/2021/IsSharedArrayBuffer.js000066400000000000000000000007151431761430200205670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var isSharedArrayBuffer = require('is-shared-array-buffer'); // https://262.ecma-international.org/8.0/#sec-issharedarraybuffer module.exports = function IsSharedArrayBuffer(obj) { if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } return isSharedArrayBuffer(obj); }; es-abstract-1.20.4/2021/IsStringPrefix.js000066400000000000000000000016541431761430200176570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPrefixOf = require('../helpers/isPrefixOf'); // var callBound = require('call-bind/callBound'); // var $charAt = callBound('String.prototype.charAt'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-isstringprefix module.exports = function IsStringPrefix(p, q) { if (Type(p) !== 'String') { throw new $TypeError('Assertion failed: "p" must be a String'); } if (Type(q) !== 'String') { throw new $TypeError('Assertion failed: "q" must be a String'); } return isPrefixOf(p, q); /* if (p === q || p === '') { return true; } var pLength = p.length; var qLength = q.length; if (pLength >= qLength) { return false; } // assert: pLength < qLength for (var i = 0; i < pLength; i += 1) { if ($charAt(p, i) !== $charAt(q, i)) { return false; } } return true; */ }; es-abstract-1.20.4/2021/IsUnclampedIntegerElementType.js000066400000000000000000000004521431761430200226300ustar00rootroot00000000000000'use strict'; // https://262.ecma-international.org/11.0/#sec-isunclampedintegerelementtype module.exports = function IsUnclampedIntegerElementType(type) { return type === 'Int8' || type === 'Uint8' || type === 'Int16' || type === 'Uint16' || type === 'Int32' || type === 'Uint32'; }; es-abstract-1.20.4/2021/IsUnsignedElementType.js000066400000000000000000000004121431761430200211520ustar00rootroot00000000000000'use strict'; // https://262.ecma-international.org/11.0/#sec-isunsignedelementtype module.exports = function IsUnsignedElementType(type) { return type === 'Uint8' || type === 'Uint8C' || type === 'Uint16' || type === 'Uint32' || type === 'BigUint64'; }; es-abstract-1.20.4/2021/IterableToList.js000066400000000000000000000013211431761430200176140ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $arrayPush = callBound('Array.prototype.push'); var GetIterator = require('./GetIterator'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); // https://262.ecma-international.org/12.0/#sec-iterabletolist module.exports = function IterableToList(items) { var iterator; if (arguments.length > 1) { iterator = GetIterator(items, 'sync', arguments[1]); } else { iterator = GetIterator(items, 'sync'); } var values = []; var next = true; while (next) { next = IteratorStep(iterator); if (next) { var nextValue = IteratorValue(next); $arrayPush(values, nextValue); } } return values; }; es-abstract-1.20.4/2021/IteratorClose.js000066400000000000000000000027111431761430200175110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose module.exports = function IteratorClose(iterator, completion) { if (Type(iterator) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterator) is not Object'); } if (!IsCallable(completion)) { throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record'); } var completionThunk = completion; var iteratorReturn = GetMethod(iterator, 'return'); if (typeof iteratorReturn === 'undefined') { return completionThunk(); } var completionRecord; try { var innerResult = Call(iteratorReturn, iterator, []); } catch (e) { // if we hit here, then "e" is the innerResult completion that needs re-throwing // if the completion is of type "throw", this will throw. completionThunk(); completionThunk = null; // ensure it's not called twice. // if not, then return the innerResult completion throw e; } completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does completionThunk = null; // ensure it's not called twice. if (Type(innerResult) !== 'Object') { throw new $TypeError('iterator .return must return an object'); } return completionRecord; }; es-abstract-1.20.4/2021/IteratorComplete.js000066400000000000000000000007621431761430200202200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete module.exports = function IteratorComplete(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return ToBoolean(Get(iterResult, 'done')); }; es-abstract-1.20.4/2021/IteratorNext.js000066400000000000000000000007551431761430200173700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Invoke = require('./Invoke'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext module.exports = function IteratorNext(iterator, value) { var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]); if (Type(result) !== 'Object') { throw new $TypeError('iterator next must return an object'); } return result; }; es-abstract-1.20.4/2021/IteratorStep.js000066400000000000000000000005411431761430200173560ustar00rootroot00000000000000'use strict'; var IteratorComplete = require('./IteratorComplete'); var IteratorNext = require('./IteratorNext'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep module.exports = function IteratorStep(iterator) { var result = IteratorNext(iterator); var done = IteratorComplete(result); return done === true ? false : result; }; es-abstract-1.20.4/2021/IteratorValue.js000066400000000000000000000006731431761430200175250ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue module.exports = function IteratorValue(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return Get(iterResult, 'value'); }; es-abstract-1.20.4/2021/LengthOfArrayLike.js000066400000000000000000000007571431761430200202540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToLength = require('./ToLength'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-lengthofarraylike module.exports = function LengthOfArrayLike(obj) { if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } return ToLength(Get(obj, 'length')); }; // TODO: use this all over es-abstract-1.20.4/2021/MakeDate.js000066400000000000000000000005101431761430200164000ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.13 module.exports = function MakeDate(day, time) { if (!$isFinite(day) || !$isFinite(time)) { return NaN; } return (day * msPerDay) + time; }; es-abstract-1.20.4/2021/MakeDay.js000066400000000000000000000017641431761430200162540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $DateUTC = GetIntrinsic('%Date.UTC%'); var $isFinite = require('../helpers/isFinite'); var DateFromTime = require('./DateFromTime'); var Day = require('./Day'); var floor = require('./floor'); var modulo = require('./modulo'); var MonthFromTime = require('./MonthFromTime'); var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); var YearFromTime = require('./YearFromTime'); // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.12 module.exports = function MakeDay(year, month, date) { if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { return NaN; } var y = ToIntegerOrInfinity(year); var m = ToIntegerOrInfinity(month); var dt = ToIntegerOrInfinity(date); var ym = y + floor(m / 12); if (!$isFinite(ym)) { return NaN; } var mn = modulo(m, 12); var t = $DateUTC(ym, mn, 1); if (YearFromTime(t) !== ym || MonthFromTime(t) !== mn || DateFromTime(t) !== 1) { return NaN; } return Day(t) + dt - 1; }; es-abstract-1.20.4/2021/MakeTime.js000066400000000000000000000013731431761430200164310ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var msPerMinute = timeConstants.msPerMinute; var msPerHour = timeConstants.msPerHour; var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.11 module.exports = function MakeTime(hour, min, sec, ms) { if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { return NaN; } var h = ToIntegerOrInfinity(hour); var m = ToIntegerOrInfinity(min); var s = ToIntegerOrInfinity(sec); var milli = ToIntegerOrInfinity(ms); var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; return t; }; es-abstract-1.20.4/2021/MinFromTime.js000066400000000000000000000006141431761430200171200ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerMinute = timeConstants.msPerMinute; var MinutesPerHour = timeConstants.MinutesPerHour; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function MinFromTime(t) { return modulo(floor(t / msPerMinute), MinutesPerHour); }; es-abstract-1.20.4/2021/MonthFromTime.js000066400000000000000000000017661431761430200174730ustar00rootroot00000000000000'use strict'; var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function MonthFromTime(t) { var day = DayWithinYear(t); if (0 <= day && day < 31) { return 0; } var leap = InLeapYear(t); if (31 <= day && day < (59 + leap)) { return 1; } if ((59 + leap) <= day && day < (90 + leap)) { return 2; } if ((90 + leap) <= day && day < (120 + leap)) { return 3; } if ((120 + leap) <= day && day < (151 + leap)) { return 4; } if ((151 + leap) <= day && day < (181 + leap)) { return 5; } if ((181 + leap) <= day && day < (212 + leap)) { return 6; } if ((212 + leap) <= day && day < (243 + leap)) { return 7; } if ((243 + leap) <= day && day < (273 + leap)) { return 8; } if ((273 + leap) <= day && day < (304 + leap)) { return 9; } if ((304 + leap) <= day && day < (334 + leap)) { return 10; } if ((334 + leap) <= day && day < (365 + leap)) { return 11; } }; es-abstract-1.20.4/2021/Number/000077500000000000000000000000001431761430200156235ustar00rootroot00000000000000es-abstract-1.20.4/2021/Number/add.js000066400000000000000000000015531431761430200167150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isFinite = require('../../helpers/isFinite'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-add module.exports = function NumberAdd(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y) || (x === Infinity && y === -Infinity) || (x === -Infinity && y === Infinity)) { return NaN; } if (!isFinite(x)) { return x; } if (!isFinite(y)) { return y; } if (x === y && x === 0) { // both zeroes return Infinity / x === -Infinity && Infinity / y === -Infinity ? -0 : +0; } // shortcut for the actual spec mechanics return x + y; }; es-abstract-1.20.4/2021/Number/bitwiseAND.js000066400000000000000000000007671431761430200201640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var NumberBitwiseOp = require('../NumberBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseAND module.exports = function NumberBitwiseAND(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberBitwiseOp('&', x, y); }; es-abstract-1.20.4/2021/Number/bitwiseNOT.js000066400000000000000000000011021431761430200202020ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseNOT module.exports = function NumberBitwiseNOT(x) { if (Type(x) !== 'Number') { throw new $TypeError('Assertion failed: `x` argument must be a Number'); } var oldValue = ToInt32(x); // Return the result of applying the bitwise operator op to lnum and rnum. The result is a signed 32-bit integer. return ~oldValue; }; es-abstract-1.20.4/2021/Number/bitwiseOR.js000066400000000000000000000007651431761430200201000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var NumberBitwiseOp = require('../NumberBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseOR module.exports = function NumberBitwiseOR(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberBitwiseOp('|', x, y); }; es-abstract-1.20.4/2021/Number/bitwiseXOR.js000066400000000000000000000007671431761430200202320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var NumberBitwiseOp = require('../NumberBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseXOR module.exports = function NumberBitwiseXOR(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberBitwiseOp('^', x, y); }; es-abstract-1.20.4/2021/Number/divide.js000066400000000000000000000011761431761430200174320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isFinite = require('../../helpers/isFinite'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-divide module.exports = function NumberDivide(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y) || (!isFinite(x) && !isFinite(y))) { return NaN; } // shortcut for the actual spec mechanics return x / y; }; es-abstract-1.20.4/2021/Number/equal.js000066400000000000000000000010541431761430200172700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-equal module.exports = function NumberEqual(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y)) { return false; } // shortcut for the actual spec mechanics return x === y; }; es-abstract-1.20.4/2021/Number/exponentiate.js000066400000000000000000000033641431761430200206720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); // var isNegativeZero = require('is-negative-zero'); var $pow = GetIntrinsic('%Math.pow%'); var $TypeError = GetIntrinsic('%TypeError%'); /* var abs = require('../../helpers/abs'); var isFinite = require('../../helpers/isFinite'); var isNaN = require('../../helpers/isNaN'); var IsInteger = require('../IsInteger'); */ var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-exponentiate /* eslint max-lines-per-function: 0, max-statements: 0 */ module.exports = function NumberExponentiate(base, exponent) { if (Type(base) !== 'Number' || Type(exponent) !== 'Number') { throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be Numbers'); } return $pow(base, exponent); /* if (isNaN(exponent)) { return NaN; } if (exponent === 0) { return 1; } if (isNaN(base)) { return NaN; } var aB = abs(base); if (aB > 1 && exponent === Infinity) { return Infinity; } if (aB > 1 && exponent === -Infinity) { return 0; } if (aB === 1 && (exponent === Infinity || exponent === -Infinity)) { return NaN; } if (aB < 1 && exponent === Infinity) { return +0; } if (aB < 1 && exponent === -Infinity) { return Infinity; } if (base === Infinity) { return exponent > 0 ? Infinity : 0; } if (base === -Infinity) { var isOdd = true; if (exponent > 0) { return isOdd ? -Infinity : Infinity; } return isOdd ? -0 : 0; } if (exponent > 0) { return isNegativeZero(base) ? Infinity : 0; } if (isNegativeZero(base)) { if (exponent > 0) { return isOdd ? -0 : 0; } return isOdd ? -Infinity : Infinity; } if (base < 0 && isFinite(base) && isFinite(exponent) && !IsInteger(exponent)) { return NaN; } */ }; es-abstract-1.20.4/2021/Number/index.js000066400000000000000000000023721431761430200172740ustar00rootroot00000000000000'use strict'; var add = require('./add'); var bitwiseAND = require('./bitwiseAND'); var bitwiseNOT = require('./bitwiseNOT'); var bitwiseOR = require('./bitwiseOR'); var bitwiseXOR = require('./bitwiseXOR'); var divide = require('./divide'); var equal = require('./equal'); var exponentiate = require('./exponentiate'); var leftShift = require('./leftShift'); var lessThan = require('./lessThan'); var multiply = require('./multiply'); var remainder = require('./remainder'); var sameValue = require('./sameValue'); var sameValueZero = require('./sameValueZero'); var signedRightShift = require('./signedRightShift'); var subtract = require('./subtract'); var toString = require('./toString'); var unaryMinus = require('./unaryMinus'); var unsignedRightShift = require('./unsignedRightShift'); module.exports = { add: add, bitwiseAND: bitwiseAND, bitwiseNOT: bitwiseNOT, bitwiseOR: bitwiseOR, bitwiseXOR: bitwiseXOR, divide: divide, equal: equal, exponentiate: exponentiate, leftShift: leftShift, lessThan: lessThan, multiply: multiply, remainder: remainder, sameValue: sameValue, sameValueZero: sameValueZero, signedRightShift: signedRightShift, subtract: subtract, toString: toString, unaryMinus: unaryMinus, unsignedRightShift: unsignedRightShift }; es-abstract-1.20.4/2021/Number/leftShift.js000066400000000000000000000011771431761430200201170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var ToUint32 = require('../ToUint32'); var modulo = require('../modulo'); var Type = require('../Type'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-leftShift module.exports = function NumberLeftShift(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); var shiftCount = modulo(rnum, 32); return lnum << shiftCount; }; es-abstract-1.20.4/2021/Number/lessThan.js000066400000000000000000000012021431761430200177350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-lessThan module.exports = function NumberLessThan(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } // If x is NaN, return undefined. // If y is NaN, return undefined. if (isNaN(x) || isNaN(y)) { return void undefined; } // shortcut for the actual spec mechanics return x < y; }; es-abstract-1.20.4/2021/Number/multiply.js000066400000000000000000000015201431761430200200360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-multiply module.exports = function NumberMultiply(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y) || (x === 0 && !isFinite(y)) || (!isFinite(x) && y === 0)) { return NaN; } if (!isFinite(x) && !isFinite(y)) { return x === y ? Infinity : -Infinity; } if (!isFinite(x) && y !== 0) { return x > 0 ? Infinity : -Infinity; } if (!isFinite(y) && x !== 0) { return y > 0 ? Infinity : -Infinity; } // shortcut for the actual spec mechanics return x * y; }; es-abstract-1.20.4/2021/Number/remainder.js000066400000000000000000000020031431761430200201220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-remainder module.exports = function NumberRemainder(n, d) { if (Type(n) !== 'Number' || Type(d) !== 'Number') { throw new $TypeError('Assertion failed: `n` and `d` arguments must be Numbers'); } // If either operand is NaN, the result is NaN. // If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN. if (isNaN(n) || isNaN(d) || !isFinite(n) || d === 0) { return NaN; } // If the dividend is finite and the divisor is an infinity, the result equals the dividend. // If the dividend is a zero and the divisor is nonzero and finite, the result is the same as the dividend. if (!isFinite(d) || n === 0) { return n; } // In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved… return n % d; }; es-abstract-1.20.4/2021/Number/sameValue.js000066400000000000000000000011701431761430200201020ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var isNegativeZero = require('is-negative-zero'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var NumberSameValueZero = require('./sameValueZero'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValue module.exports = function NumberSameValue(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (x === 0 && y === 0) { return !(isNegativeZero(x) ^ isNegativeZero(y)); } return NumberSameValueZero(x, y); }; es-abstract-1.20.4/2021/Number/sameValueZero.js000066400000000000000000000010771431761430200207500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValueZero module.exports = function NumberSameValueZero(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var xNaN = isNaN(x); var yNaN = isNaN(y); if (xNaN || yNaN) { return xNaN === yNaN; } return x === y; }; es-abstract-1.20.4/2021/Number/signedRightShift.js000066400000000000000000000012151431761430200214250ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var ToUint32 = require('../ToUint32'); var modulo = require('../modulo'); var Type = require('../Type'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-signedRightShift module.exports = function NumberSignedRightShift(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); var shiftCount = modulo(rnum, 32); return lnum >> shiftCount; }; es-abstract-1.20.4/2021/Number/subtract.js000066400000000000000000000010301431761430200200020ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var NumberAdd = require('./add'); var NumberUnaryMinus = require('./unaryMinus'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-subtract module.exports = function NumberSubtract(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberAdd(x, NumberUnaryMinus(y)); }; es-abstract-1.20.4/2021/Number/toString.js000066400000000000000000000006531431761430200177760ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-tostring module.exports = function NumberToString(x) { if (Type(x) !== 'Number') { throw new $TypeError('Assertion failed: `x` must be a Number'); } return $String(x); }; es-abstract-1.20.4/2021/Number/unaryMinus.js000066400000000000000000000007261431761430200203400ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-unaryMinus module.exports = function NumberUnaryMinus(x) { if (Type(x) !== 'Number') { throw new $TypeError('Assertion failed: `x` argument must be a Number'); } if (isNaN(x)) { return NaN; } return -x; }; es-abstract-1.20.4/2021/Number/unsignedRightShift.js000066400000000000000000000012221431761430200217660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var ToUint32 = require('../ToUint32'); var modulo = require('../modulo'); var Type = require('../Type'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-unsignedRightShift module.exports = function NumberUnsignedRightShift(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); var shiftCount = modulo(rnum, 32); return lnum >>> shiftCount; }; es-abstract-1.20.4/2021/NumberBitwiseOp.js000066400000000000000000000013651431761430200200140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('./ToInt32'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-numberbitwiseop module.exports = function NumberBitwiseOp(op, x, y) { if (op !== '&' && op !== '|' && op !== '^') { throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`'); } if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); if (op === '&') { return lnum & rnum; } if (op === '|') { return lnum | rnum; } return lnum ^ rnum; }; es-abstract-1.20.4/2021/NumberToBigInt.js000066400000000000000000000012621431761430200175620ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-numbertobigint module.exports = function NumberToBigInt(number) { if (Type(number) !== 'Number') { throw new $TypeError('Assertion failed: `number` must be a String'); } if (!IsIntegralNumber(number)) { throw new $RangeError('The number ' + number + ' cannot be converted to a BigInt because it is not an integer'); } return $BigInt(number); }; es-abstract-1.20.4/2021/ObjectDefineProperties.js000066400000000000000000000027441431761430200213360ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var Get = require('./Get'); var ToObject = require('./ToObject'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var forEach = require('../helpers/forEach'); var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $push = callBound('Array.prototype.push'); // https://262.ecma-international.org/6.0/#sec-objectdefineproperties module.exports = function ObjectDefineProperties(O, Properties) { var props = ToObject(Properties); // step 1 var keys = OwnPropertyKeys(props); // step 2 var descriptors = []; // step 3 forEach(keys, function (nextKey) { // step 4 var propDesc = ToPropertyDescriptor(getOwnPropertyDescriptor(props, nextKey)); // step 4.a if (typeof propDesc !== 'undefined' && propDesc['[[Enumerable]]']) { // step 4.b var descObj = Get(props, nextKey); // step 4.b.i var desc = ToPropertyDescriptor(descObj); // step 4.b.ii $push(descriptors, [nextKey, desc]); // step 4.b.iii } }); forEach(descriptors, function (pair) { // step 5 var P = pair[0]; // step 5.a var desc = pair[1]; // step 5.b desc = FromPropertyDescriptor(desc); // TODO: remove this once DefinePropertyOrThrow is fixed DefinePropertyOrThrow(O, P, desc); // step 5.c }); return O; // step 6 }; es-abstract-1.20.4/2021/OrdinaryCreateFromConstructor.js000066400000000000000000000014731431761430200227430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor'); var IsArray = require('./IsArray'); var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); // https://262.ecma-international.org/6.0/#sec-ordinarycreatefromconstructor module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto); var slots = arguments.length < 3 ? [] : arguments[2]; if (!IsArray(slots)) { throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List'); } return OrdinaryObjectCreate(proto, slots); }; es-abstract-1.20.4/2021/OrdinaryDefineOwnProperty.js000066400000000000000000000045261431761430200220730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var Type = require('./Type'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!$gOPD) { // ES3/IE 8 fallback if (IsAccessorDescriptor(Desc)) { throw new $SyntaxError('This environment does not support accessor property descriptors.'); } var creatingNormalDataProperty = !(P in O) && Desc['[[Writable]]'] && Desc['[[Enumerable]]'] && Desc['[[Configurable]]'] && '[[Value]]' in Desc; var settingExistingDataProperty = (P in O) && (!('[[Configurable]]' in Desc) || Desc['[[Configurable]]']) && (!('[[Enumerable]]' in Desc) || Desc['[[Enumerable]]']) && (!('[[Writable]]' in Desc) || Desc['[[Writable]]']) && '[[Value]]' in Desc; if (creatingNormalDataProperty || settingExistingDataProperty) { O[P] = Desc['[[Value]]']; // eslint-disable-line no-param-reassign return SameValue(O[P], Desc['[[Value]]']); } throw new $SyntaxError('This environment does not support defining non-writable, non-enumerable, or non-configurable properties'); } var desc = $gOPD(O, P); var current = desc && ToPropertyDescriptor(desc); var extensible = IsExtensible(O); return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current); }; es-abstract-1.20.4/2021/OrdinaryGetOwnProperty.js000066400000000000000000000023511431761430200214120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var has = require('has'); var IsArray = require('./IsArray'); var IsPropertyKey = require('./IsPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty module.exports = function OrdinaryGetOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!has(O, P)) { return void 0; } if (!$gOPD) { // ES3 / IE 8 fallback var arrayLength = IsArray(O) && P === 'length'; var regexLastIndex = IsRegExp(O) && P === 'lastIndex'; return { '[[Configurable]]': !(arrayLength || regexLastIndex), '[[Enumerable]]': $isEnumerable(O, P), '[[Value]]': O[P], '[[Writable]]': true }; } return ToPropertyDescriptor($gOPD(O, P)); }; es-abstract-1.20.4/2021/OrdinaryGetPrototypeOf.js000066400000000000000000000010331431761430200213700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $getProto = require('../helpers/getProto'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarygetprototypeof module.exports = function OrdinaryGetPrototypeOf(O) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!$getProto) { throw new $TypeError('This environment does not support fetching prototypes.'); } return $getProto(O); }; es-abstract-1.20.4/2021/OrdinaryHasInstance.js000066400000000000000000000011631431761430200206420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance module.exports = function OrdinaryHasInstance(C, O) { if (IsCallable(C) === false) { return false; } if (Type(O) !== 'Object') { return false; } var P = Get(C, 'prototype'); if (Type(P) !== 'Object') { throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.'); } return O instanceof C; }; es-abstract-1.20.4/2021/OrdinaryHasProperty.js000066400000000000000000000010231431761430200207150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty module.exports = function OrdinaryHasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2021/OrdinaryObjectCreate.js000066400000000000000000000026451431761430200210020ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ObjectCreate = GetIntrinsic('%Object.create%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var IsArray = require('./IsArray'); var Type = require('./Type'); var hasProto = !({ __proto__: null } instanceof Object); // https://262.ecma-international.org/6.0/#sec-objectcreate module.exports = function OrdinaryObjectCreate(proto) { if (proto !== null && Type(proto) !== 'Object') { throw new $TypeError('Assertion failed: `proto` must be null or an object'); } var additionalInternalSlotsList = arguments.length < 2 ? [] : arguments[1]; if (!IsArray(additionalInternalSlotsList)) { throw new $TypeError('Assertion failed: `additionalInternalSlotsList` must be an Array'); } // var internalSlotsList = ['[[Prototype]]', '[[Extensible]]']; if (additionalInternalSlotsList.length > 0) { throw new $SyntaxError('es-abstract does not yet support internal slots'); // internalSlotsList.push(...additionalInternalSlotsList); } // var O = MakeBasicObject(internalSlotsList); // setProto(O, proto); // return O; if ($ObjectCreate) { return $ObjectCreate(proto); } if (hasProto) { return { __proto__: proto }; } if (proto === null) { throw new $SyntaxError('native Object.create support is required to create null objects'); } var T = function T() {}; T.prototype = proto; return new T(); }; es-abstract-1.20.4/2021/OrdinarySetPrototypeOf.js000066400000000000000000000020321431761430200214040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $setProto = require('../helpers/setProto'); var OrdinaryGetPrototypeOf = require('./OrdinaryGetPrototypeOf'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarysetprototypeof module.exports = function OrdinarySetPrototypeOf(O, V) { if (Type(V) !== 'Object' && Type(V) !== 'Null') { throw new $TypeError('Assertion failed: V must be Object or Null'); } /* var extensible = IsExtensible(O); var current = OrdinaryGetPrototypeOf(O); if (SameValue(V, current)) { return true; } if (!extensible) { return false; } */ try { $setProto(O, V); } catch (e) { return false; } return OrdinaryGetPrototypeOf(O) === V; /* var p = V; var done = false; while (!done) { if (p === null) { done = true; } else if (SameValue(p, O)) { return false; } else { if (wat) { done = true; } else { p = p.[[Prototype]]; } } } O.[[Prototype]] = V; return true; */ }; es-abstract-1.20.4/2021/OrdinaryToPrimitive.js000066400000000000000000000020511431761430200207120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); var inspect = require('object-inspect'); // https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive module.exports = function OrdinaryToPrimitive(O, hint) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); } var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; for (var i = 0; i < methodNames.length; i += 1) { var name = methodNames[i]; var method = Get(O, name); if (IsCallable(method)) { var result = Call(method, O); if (Type(result) !== 'Object') { return result; } } } throw new $TypeError('No primitive value for ' + inspect(O)); }; es-abstract-1.20.4/2021/PromiseResolve.js000066400000000000000000000007111431761430200177060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBind = require('call-bind'); var $resolve = GetIntrinsic('%Promise.resolve%', true); var $PromiseResolve = $resolve && callBind($resolve); // https://262.ecma-international.org/9.0/#sec-promise-resolve module.exports = function PromiseResolve(C, x) { if (!$PromiseResolve) { throw new SyntaxError('This environment does not support Promises.'); } return $PromiseResolve(C, x); }; es-abstract-1.20.4/2021/QuoteJSONString.js000066400000000000000000000026141431761430200177120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var StringToCodePoints = require('./StringToCodePoints'); var Type = require('./Type'); var UnicodeEscape = require('./UnicodeEscape'); var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint'); var has = require('has'); // https://ecma-international.org/ecma-262/12.0/#sec-quotejsonstring var escapes = { '\u0008': '\\b', '\u0009': '\\t', '\u000A': '\\n', '\u000C': '\\f', '\u000D': '\\r', '\u0022': '\\"', '\u005c': '\\\\' }; module.exports = function QuoteJSONString(value) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `value` must be a String'); } var product = '"'; if (value) { forEach(StringToCodePoints(value), function (C) { if (has(escapes, C)) { product += escapes[C]; } else { var cCharCode = $charCodeAt(C, 0); if (cCharCode < 0x20 || isLeadingSurrogate(C) || isTrailingSurrogate(C)) { product += UnicodeEscape(C); } else { product += UTF16EncodeCodePoint(cCharCode); } } }); } product += '"'; return product; }; es-abstract-1.20.4/2021/RegExpCreate.js000066400000000000000000000012031431761430200172430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RegExp = GetIntrinsic('%RegExp%'); // var RegExpAlloc = require('./RegExpAlloc'); // var RegExpInitialize = require('./RegExpInitialize'); var ToString = require('./ToString'); // https://262.ecma-international.org/6.0/#sec-regexpcreate module.exports = function RegExpCreate(P, F) { // var obj = RegExpAlloc($RegExp); // return RegExpInitialize(obj, P, F); // covers spec mechanics; bypass regex brand checking var pattern = typeof P === 'undefined' ? '' : ToString(P); var flags = typeof F === 'undefined' ? '' : ToString(F); return new $RegExp(pattern, flags); }; es-abstract-1.20.4/2021/RegExpExec.js000066400000000000000000000015671431761430200167410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var regexExec = require('call-bind/callBound')('RegExp.prototype.exec'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-regexpexec module.exports = function RegExpExec(R, S) { if (Type(R) !== 'Object') { throw new $TypeError('Assertion failed: `R` must be an Object'); } if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var exec = Get(R, 'exec'); if (IsCallable(exec)) { var result = Call(exec, R, [S]); if (result === null || Type(result) === 'Object') { return result; } throw new $TypeError('"exec" method must return `null` or an Object'); } return regexExec(R, S); }; es-abstract-1.20.4/2021/RequireObjectCoercible.js000066400000000000000000000001061431761430200213010ustar00rootroot00000000000000'use strict'; module.exports = require('../5/CheckObjectCoercible'); es-abstract-1.20.4/2021/SameValue.js000066400000000000000000000004631431761430200166160ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // http://262.ecma-international.org/5.1/#sec-9.12 module.exports = function SameValue(x, y) { if (x === y) { // 0 === -0, but they are not identical. if (x === 0) { return 1 / x === 1 / y; } return true; } return $isNaN(x) && $isNaN(y); }; es-abstract-1.20.4/2021/SameValueNonNumeric.js000066400000000000000000000011731431761430200206130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-samevaluenonnumeric module.exports = function SameValueNonNumeric(x, y) { var xType = Type(x); if (xType === 'Number' || xType === 'BigInt') { throw new $TypeError('Assertion failed: SameValueNonNumeric does not accept Number or BigInt values'); } if (xType !== Type(y)) { throw new $TypeError('SameValueNonNumeric requires two non-numeric values of the same type.'); } return SameValue(x, y); }; es-abstract-1.20.4/2021/SameValueZero.js000066400000000000000000000003371431761430200174560ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero module.exports = function SameValueZero(x, y) { return (x === y) || ($isNaN(x) && $isNaN(y)); }; es-abstract-1.20.4/2021/SecFromTime.js000066400000000000000000000006221431761430200171060ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var SecondsPerMinute = timeConstants.SecondsPerMinute; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function SecFromTime(t) { return modulo(floor(t / msPerSecond), SecondsPerMinute); }; es-abstract-1.20.4/2021/Set.js000066400000000000000000000023471431761430200154720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // IE 9 does not throw in strict mode when writability/configurability/extensibility is violated var noThrowOnStrictViolation = (function () { try { delete [].length; return true; } catch (e) { return false; } }()); // https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw module.exports = function Set(O, P, V, Throw) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (Type(Throw) !== 'Boolean') { throw new $TypeError('Assertion failed: `Throw` must be a Boolean'); } if (Throw) { O[P] = V; // eslint-disable-line no-param-reassign if (noThrowOnStrictViolation && !SameValue(O[P], V)) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; } try { O[P] = V; // eslint-disable-line no-param-reassign return noThrowOnStrictViolation ? SameValue(O[P], V) : true; } catch (e) { return false; } }; es-abstract-1.20.4/2021/SetFunctionLength.js000066400000000000000000000021231431761430200203320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var HasOwnProperty = require('./HasOwnProperty'); var IsExtensible = require('./IsExtensible'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/12.0/#sec-setfunctionlength module.exports = function SetFunctionLength(F, length) { if (typeof F !== 'function' || !IsExtensible(F) || HasOwnProperty(F, 'length')) { throw new $TypeError('Assertion failed: `F` must be an extensible function and lack an own `length` property'); } if (Type(length) !== 'Number') { throw new $TypeError('Assertion failed: `length` must be a Number'); } if (length !== Infinity && (!IsIntegralNumber(length) || length < 0)) { throw new $TypeError('Assertion failed: `length` must be ∞, or an integer >= 0'); } return DefinePropertyOrThrow(F, 'length', { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); }; es-abstract-1.20.4/2021/SetFunctionName.js000066400000000000000000000025451431761430200200010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname module.exports = function SetFunctionName(F, name) { if (typeof F !== 'function') { throw new $TypeError('Assertion failed: `F` must be a function'); } if (!IsExtensible(F) || has(F, 'name')) { throw new $TypeError('Assertion failed: `F` must be extensible, and must not have a `name` own property'); } var nameType = Type(name); if (nameType !== 'Symbol' && nameType !== 'String') { throw new $TypeError('Assertion failed: `name` must be a Symbol or a String'); } if (nameType === 'Symbol') { var description = getSymbolDescription(name); // eslint-disable-next-line no-param-reassign name = typeof description === 'undefined' ? '' : '[' + description + ']'; } if (arguments.length > 2) { var prefix = arguments[2]; // eslint-disable-next-line no-param-reassign name = prefix + ' ' + name; } return DefinePropertyOrThrow(F, 'name', { '[[Value]]': name, '[[Writable]]': false, '[[Enumerable]]': false, '[[Configurable]]': true }); }; es-abstract-1.20.4/2021/SetIntegrityLevel.js000066400000000000000000000035061431761430200203570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var forEach = require('../helpers/forEach'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel module.exports = function SetIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } if (!$preventExtensions) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.preventExtensions` support'); } var status = $preventExtensions(O); if (!status) { return false; } if (!$gOPN) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support'); } var theKeys = $gOPN(O); if (level === 'sealed') { forEach(theKeys, function (k) { DefinePropertyOrThrow(O, k, { configurable: false }); }); } else if (level === 'frozen') { forEach(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { var desc; if (IsAccessorDescriptor(ToPropertyDescriptor(currentDesc))) { desc = { configurable: false }; } else { desc = { configurable: false, writable: false }; } DefinePropertyOrThrow(O, k, desc); } }); } return true; }; es-abstract-1.20.4/2021/SpeciesConstructor.js000066400000000000000000000015141431761430200205730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor module.exports = function SpeciesConstructor(O, defaultConstructor) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var C = O.constructor; if (typeof C === 'undefined') { return defaultConstructor; } if (Type(C) !== 'Object') { throw new $TypeError('O.constructor is not an Object'); } var S = $species ? C[$species] : void 0; if (S == null) { return defaultConstructor; } if (IsConstructor(S)) { return S; } throw new $TypeError('no constructor found'); }; es-abstract-1.20.4/2021/SplitMatch.js000066400000000000000000000015771431761430200170130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); var $charAt = callBound('String.prototype.charAt'); // https://262.ecma-international.org/6.0/#sec-splitmatch module.exports = function SplitMatch(S, q, R) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsIntegralNumber(q)) { throw new $TypeError('Assertion failed: `q` must be an integer'); } if (Type(R) !== 'String') { throw new $TypeError('Assertion failed: `R` must be a String'); } var r = R.length; var s = S.length; if (q + r > s) { return false; } for (var i = 0; i < r; i += 1) { if ($charAt(S, q + i) !== $charAt(R, i)) { return false; } } return q + r; }; es-abstract-1.20.4/2021/StrictEqualityComparison.js000066400000000000000000000005511431761430200217530ustar00rootroot00000000000000'use strict'; var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.9.6 module.exports = function StrictEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType !== yType) { return false; } if (xType === 'Undefined' || xType === 'Null') { return true; } return x === y; // shortcut for steps 4-7 }; es-abstract-1.20.4/2021/StringCreate.js000066400000000000000000000021351431761430200173240ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var $StringPrototype = GetIntrinsic('%String.prototype%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var Type = require('./Type'); var setProto = require('../helpers/setProto'); // https://262.ecma-international.org/6.0/#sec-stringcreate module.exports = function StringCreate(value, prototype) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var S = $Object(value); if (prototype !== $StringPrototype) { if (setProto) { setProto(S, prototype); } else { throw new $SyntaxError('StringCreate: a `proto` argument that is not `String.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } } var length = value.length; DefinePropertyOrThrow(S, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); return S; }; es-abstract-1.20.4/2021/StringGetOwnProperty.js000066400000000000000000000026011431761430200210670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charAt = callBound('String.prototype.charAt'); var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsIntegralNumber = require('./IsIntegralNumber'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); var isNegativeZero = require('is-negative-zero'); // https://ecma-international.org/ecma-262/12.0/#sec-stringgetownproperty module.exports = function StringGetOwnProperty(S, P) { var str; if (Type(S) === 'Object') { try { str = $stringToString(S); } catch (e) { /**/ } } if (Type(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 (Type(P) !== 'String') { return void undefined; } var index = CanonicalNumericIndexString(P); var len = str.length; if (typeof index === 'undefined' || !IsIntegralNumber(index) || isNegativeZero(index) || index < 0 || len <= index) { return void undefined; } var resultStr = $charAt(S, index); return { '[[Configurable]]': false, '[[Enumerable]]': true, '[[Value]]': resultStr, '[[Writable]]': false }; }; es-abstract-1.20.4/2021/StringIndexOf.js000066400000000000000000000021411431761430200174520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); var $slice = callBound('String.prototype.slice'); // https://ecma-international.org/ecma-262/12.0/#sec-stringindexof module.exports = function StringIndexOf(string, searchValue, fromIndex) { if (Type(string) !== 'String') { throw new $TypeError('Assertion failed: `string` must be a String'); } if (Type(searchValue) !== 'String') { throw new $TypeError('Assertion failed: `searchValue` must be a String'); } if (!IsIntegralNumber(fromIndex) || fromIndex < 0) { throw new $TypeError('Assertion failed: `fromIndex` must be a non-negative integer'); } var len = string.length; if (searchValue === '' && fromIndex <= len) { return fromIndex; } var searchLen = searchValue.length; for (var i = fromIndex; i <= (len - searchLen); i += 1) { var candidate = $slice(string, i, i + searchLen); if (candidate === searchValue) { return i; } } return -1; }; es-abstract-1.20.4/2021/StringPad.js000066400000000000000000000023571431761430200166330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var $strSlice = callBound('String.prototype.slice'); // https://262.ecma-international.org/11.0/#sec-stringpad module.exports = function StringPad(O, maxLength, fillString, placement) { if (placement !== 'start' && placement !== 'end') { throw new $TypeError('Assertion failed: `placement` must be "start" or "end"'); } var S = ToString(O); var intMaxLength = ToLength(maxLength); var stringLength = S.length; if (intMaxLength <= stringLength) { return S; } var filler = typeof fillString === 'undefined' ? ' ' : ToString(fillString); if (filler === '') { return S; } var fillLen = intMaxLength - stringLength; // the String value consisting of repeated concatenations of filler truncated to length fillLen. var truncatedStringFiller = ''; while (truncatedStringFiller.length < fillLen) { truncatedStringFiller += filler; } truncatedStringFiller = $strSlice(truncatedStringFiller, 0, fillLen); if (placement === 'start') { return truncatedStringFiller + S; } return S + truncatedStringFiller; }; es-abstract-1.20.4/2021/StringToBigInt.js000066400000000000000000000011051431761430200175740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); // https://262.ecma-international.org/11.0/#sec-stringtobigint module.exports = function StringToBigInt(argument) { if (typeof argument !== 'string') { throw new $TypeError('`argument` must be a string'); } if (!$BigInt) { throw new $SyntaxError('BigInts are not supported in this environment'); } try { return $BigInt(argument); } catch (e) { return NaN; } }; es-abstract-1.20.4/2021/StringToCodePoints.js000066400000000000000000000013701431761430200204730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $push = callBound('Array.prototype.push'); var CodePointAt = require('./CodePointAt'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/12.0/#sec-stringtocodepoints module.exports = function StringToCodePoints(string) { if (Type(string) !== 'String') { throw new $TypeError('Assertion failed: `string` must be a String'); } var codePoints = []; var size = string.length; var position = 0; while (position < size) { var cp = CodePointAt(string, position); $push(codePoints, cp['[[CodePoint]]']); position += cp['[[CodeUnitCount]]']; } return codePoints; }; es-abstract-1.20.4/2021/SymbolDescriptiveString.js000066400000000000000000000010161431761430200215650ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $SymbolToString = callBound('Symbol.prototype.toString', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring module.exports = function SymbolDescriptiveString(sym) { if (Type(sym) !== 'Symbol') { throw new $TypeError('Assertion failed: `sym` must be a Symbol'); } return $SymbolToString(sym); }; es-abstract-1.20.4/2021/TestIntegrityLevel.js000066400000000000000000000024051431761430200205400ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var every = require('../helpers/every'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel module.exports = function TestIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } var status = IsExtensible(O); if (status) { return false; } var theKeys = OwnPropertyKeys(O); return theKeys.length === 0 || every(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { if (currentDesc.configurable) { return false; } if (level === 'frozen' && IsDataDescriptor(ToPropertyDescriptor(currentDesc)) && currentDesc.writable) { return false; } } return true; }); }; es-abstract-1.20.4/2021/TimeClip.js000066400000000000000000000007241431761430200164420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var $Number = GetIntrinsic('%Number%'); var $isFinite = require('../helpers/isFinite'); var abs = require('./abs'); var ToNumber = require('./ToNumber'); // https://262.ecma-international.org/5.1/#sec-15.9.1.14 module.exports = function TimeClip(time) { if (!$isFinite(time) || abs(time) > 8.64e15) { return NaN; } return $Number(new $Date(ToNumber(time))); }; es-abstract-1.20.4/2021/TimeFromYear.js000066400000000000000000000004051431761430200172730ustar00rootroot00000000000000'use strict'; var msPerDay = require('../helpers/timeConstants').msPerDay; var DayFromYear = require('./DayFromYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function TimeFromYear(y) { return msPerDay * DayFromYear(y); }; es-abstract-1.20.4/2021/TimeString.js000066400000000000000000000014501431761430200170160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var padTimeComponent = require('../helpers/padTimeComponent'); var HourFromTime = require('./HourFromTime'); var MinFromTime = require('./MinFromTime'); var SecFromTime = require('./SecFromTime'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-timestring module.exports = function TimeString(tv) { if (Type(tv) !== 'Number' || $isNaN(tv)) { throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); } var hour = HourFromTime(tv); var minute = MinFromTime(tv); var second = SecFromTime(tv); return padTimeComponent(hour) + ':' + padTimeComponent(minute) + ':' + padTimeComponent(second) + '\x20GMT'; }; es-abstract-1.20.4/2021/TimeWithinDay.js000066400000000000000000000003671431761430200174560ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function TimeWithinDay(t) { return modulo(t, msPerDay); }; es-abstract-1.20.4/2021/ToBigInt.js000066400000000000000000000011671431761430200164150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $asIntN = GetIntrinsic('%BigInt.asIntN%', true); var $Number = GetIntrinsic('%Number%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var ToPrimitive = require('./ToPrimitive'); // https://262.ecma-international.org/11.0/#sec-tobigint module.exports = function ToBigInt(argument) { if (!$BigInt) { throw new $SyntaxError('BigInts are not supported in this environment'); } var prim = ToPrimitive(argument, $Number); if (typeof prim === 'number') { return $asIntN(0, prim); } return $BigInt(prim); }; es-abstract-1.20.4/2021/ToBigInt64.js000066400000000000000000000016641431761430200165710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $pow = GetIntrinsic('%Math.pow%'); var ToBigInt = require('./ToBigInt'); var BigIntRemainder = require('./BigInt/remainder'); var modBigInt = require('../helpers/modBigInt'); // BigInt(2**63), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER var twoSixtyThree = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 31))); // BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32))); // https://262.ecma-international.org/11.0/#sec-tobigint64 module.exports = function ToBigInt64(argument) { var n = ToBigInt(argument); var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour); return int64bit >= twoSixtyThree ? int64bit - twoSixtyFour : int64bit; }; es-abstract-1.20.4/2021/ToBigUint64.js000066400000000000000000000012771431761430200167560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $pow = GetIntrinsic('%Math.pow%'); var ToBigInt = require('./ToBigInt'); var BigIntRemainder = require('./BigInt/remainder'); var modBigInt = require('../helpers/modBigInt'); // BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32))); // https://262.ecma-international.org/11.0/#sec-tobiguint64 module.exports = function ToBigUint64(argument) { var n = ToBigInt(argument); var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour); return int64bit; }; es-abstract-1.20.4/2021/ToBoolean.js000066400000000000000000000002021431761430200166050ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.2 module.exports = function ToBoolean(value) { return !!value; }; es-abstract-1.20.4/2021/ToDateString.js000066400000000000000000000007621431761430200173050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Date = GetIntrinsic('%Date%'); var $isNaN = require('../helpers/isNaN'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-todatestring module.exports = function ToDateString(tv) { if (Type(tv) !== 'Number') { throw new $TypeError('Assertion failed: `tv` must be a Number'); } if ($isNaN(tv)) { return 'Invalid Date'; } return $Date(tv); }; es-abstract-1.20.4/2021/ToIndex.js000066400000000000000000000012671431761430200163110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); var ToLength = require('./ToLength'); var SameValue = require('./SameValue'); // https://www.ecma-international.org/ecma-262/8.0/#sec-toindex module.exports = function ToIndex(value) { if (typeof value === 'undefined') { return 0; } var integerIndex = ToIntegerOrInfinity(value); if (integerIndex < 0) { throw new $RangeError('index must be >= 0'); } var index = ToLength(integerIndex); if (!SameValue(integerIndex, index)) { throw new $RangeError('index must be >= 0 and < 2 ** 53 - 1'); } return index; }; es-abstract-1.20.4/2021/ToInt16.js000066400000000000000000000004041431761430200161330ustar00rootroot00000000000000'use strict'; var ToUint16 = require('./ToUint16'); // https://ecma-international.org/ecma-262/6.0/#sec-toint16 module.exports = function ToInt16(argument) { var int16bit = ToUint16(argument); return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit; }; es-abstract-1.20.4/2021/ToInt32.js000066400000000000000000000002551431761430200161350ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.5 module.exports = function ToInt32(x) { return ToNumber(x) >> 0; }; es-abstract-1.20.4/2021/ToInt8.js000066400000000000000000000003671431761430200160640ustar00rootroot00000000000000'use strict'; var ToUint8 = require('./ToUint8'); // https://ecma-international.org/ecma-262/6.0/#sec-toint8 module.exports = function ToInt8(argument) { var int8bit = ToUint8(argument); return int8bit >= 0x80 ? int8bit - 0x100 : int8bit; }; es-abstract-1.20.4/2021/ToIntegerOrInfinity.js000066400000000000000000000011301431761430200206370ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // https://262.ecma-international.org/12.0/#sec-tointegerorinfinity module.exports = function ToIntegerOrInfinity(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0) { return 0; } if (!$isFinite(number)) { return number; } var integer = floor(abs(number)); if (integer === 0) { return 0; } return $sign(number) * integer; }; es-abstract-1.20.4/2021/ToLength.js000066400000000000000000000005521431761430200164570ustar00rootroot00000000000000'use strict'; var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); module.exports = function ToLength(argument) { var len = ToIntegerOrInfinity(argument); if (len <= 0) { return 0; } // includes converting -0 to +0 if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } return len; }; es-abstract-1.20.4/2021/ToNumber.js000066400000000000000000000041211431761430200164620ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Number = GetIntrinsic('%Number%'); var $RegExp = GetIntrinsic('%RegExp%'); var $parseInteger = GetIntrinsic('%parseInt%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var isPrimitive = require('../helpers/isPrimitive'); var $strSlice = callBound('String.prototype.slice'); var isBinary = regexTester(/^0b[01]+$/i); var isOctal = regexTester(/^0o[0-7]+$/i); var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i); var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); var hasNonWS = regexTester(nonWSregex); // whitespace from: https://es5.github.io/#x15.5.4.20 // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324 var ws = [ '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003', '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028', '\u2029\uFEFF' ].join(''); var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); var $replace = callBound('String.prototype.replace'); var $trim = function (value) { return $replace(value, trimRegex, ''); }; var ToPrimitive = require('./ToPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-tonumber module.exports = function ToNumber(argument) { var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (typeof value === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a number'); } if (typeof value === 'bigint') { throw new $TypeError('Conversion from \'BigInt\' to \'number\' is not allowed.'); } if (typeof value === 'string') { if (isBinary(value)) { return ToNumber($parseInteger($strSlice(value, 2), 2)); } else if (isOctal(value)) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; } var trimmed = $trim(value); if (trimmed !== value) { return ToNumber(trimmed); } } return $Number(value); }; es-abstract-1.20.4/2021/ToNumeric.js000066400000000000000000000010461431761430200166370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var isPrimitive = require('../helpers/isPrimitive'); var ToPrimitive = require('./ToPrimitive'); var ToNumber = require('./ToNumber'); var Type = require('./Type'); // https://262.ecma-international.org/6.0/#sec-tonumber module.exports = function ToNumeric(argument) { var primValue = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (Type(primValue) === 'BigInt') { return primValue; } return ToNumber(primValue); }; es-abstract-1.20.4/2021/ToObject.js000066400000000000000000000005161431761430200164440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); // https://ecma-international.org/ecma-262/6.0/#sec-toobject module.exports = function ToObject(value) { RequireObjectCoercible(value); return $Object(value); }; es-abstract-1.20.4/2021/ToPrimitive.js000066400000000000000000000004371431761430200172100ustar00rootroot00000000000000'use strict'; var toPrimitive = require('es-to-primitive/es2015'); // https://ecma-international.org/ecma-262/6.0/#sec-toprimitive module.exports = function ToPrimitive(input) { if (arguments.length > 1) { return toPrimitive(input, arguments[1]); } return toPrimitive(input); }; es-abstract-1.20.4/2021/ToPropertyDescriptor.js000066400000000000000000000026541431761430200211260ustar00rootroot00000000000000'use strict'; var has = require('has'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var ToBoolean = require('./ToBoolean'); var IsCallable = require('./IsCallable'); // https://262.ecma-international.org/5.1/#sec-8.10.5 module.exports = function ToPropertyDescriptor(Obj) { if (Type(Obj) !== 'Object') { throw new $TypeError('ToPropertyDescriptor requires an object'); } var desc = {}; if (has(Obj, 'enumerable')) { desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable); } if (has(Obj, 'configurable')) { desc['[[Configurable]]'] = ToBoolean(Obj.configurable); } if (has(Obj, 'value')) { desc['[[Value]]'] = Obj.value; } if (has(Obj, 'writable')) { desc['[[Writable]]'] = ToBoolean(Obj.writable); } if (has(Obj, 'get')) { var getter = Obj.get; if (typeof getter !== 'undefined' && !IsCallable(getter)) { throw new $TypeError('getter must be a function'); } desc['[[Get]]'] = getter; } if (has(Obj, 'set')) { var setter = Obj.set; if (typeof setter !== 'undefined' && !IsCallable(setter)) { throw new $TypeError('setter must be a function'); } desc['[[Set]]'] = setter; } if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); } return desc; }; es-abstract-1.20.4/2021/ToPropertyKey.js000066400000000000000000000006251431761430200175340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var ToPrimitive = require('./ToPrimitive'); var ToString = require('./ToString'); // https://ecma-international.org/ecma-262/6.0/#sec-topropertykey module.exports = function ToPropertyKey(argument) { var key = ToPrimitive(argument, $String); return typeof key === 'symbol' ? key : ToString(key); }; es-abstract-1.20.4/2021/ToString.js000066400000000000000000000006141431761430200165030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); // https://ecma-international.org/ecma-262/6.0/#sec-tostring module.exports = function ToString(argument) { if (typeof argument === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a string'); } return $String(argument); }; es-abstract-1.20.4/2021/ToUint16.js000066400000000000000000000010641431761430200163230ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // http://262.ecma-international.org/5.1/#sec-9.7 module.exports = function ToUint16(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x10000); }; es-abstract-1.20.4/2021/ToUint32.js000066400000000000000000000002571431761430200163240ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.6 module.exports = function ToUint32(x) { return ToNumber(x) >>> 0; }; es-abstract-1.20.4/2021/ToUint8.js000066400000000000000000000011021431761430200162350ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8 module.exports = function ToUint8(argument) { var number = ToNumber(argument); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x100); }; es-abstract-1.20.4/2021/ToUint8Clamp.js000066400000000000000000000010121431761430200172120ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp module.exports = function ToUint8Clamp(argument) { var number = ToNumber(argument); if ($isNaN(number) || number <= 0) { return 0; } if (number >= 0xFF) { return 0xFF; } var f = floor(argument); if (f + 0.5 < number) { return f + 1; } if (number < f + 0.5) { return f; } if (f % 2 !== 0) { return f + 1; } return f; }; es-abstract-1.20.4/2021/TrimString.js000066400000000000000000000014441431761430200170360ustar00rootroot00000000000000'use strict'; var trimStart = require('string.prototype.trimstart'); var trimEnd = require('string.prototype.trimend'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); // https://262.ecma-international.org/10.0/#sec-trimstring module.exports = function TrimString(string, where) { var str = RequireObjectCoercible(string); var S = ToString(str); var T; if (where === 'start') { T = trimStart(S); } else if (where === 'end') { T = trimEnd(S); } else if (where === 'start+end') { T = trimStart(trimEnd(S)); } else { throw new $TypeError('Assertion failed: invalid `where` value; must be "start", "end", or "start+end"'); } return T; }; es-abstract-1.20.4/2021/Type.js000066400000000000000000000004511431761430200156520ustar00rootroot00000000000000'use strict'; var ES5Type = require('../5/Type'); // https://262.ecma-international.org/11.0/#sec-ecmascript-data-types-and-values module.exports = function Type(x) { if (typeof x === 'symbol') { return 'Symbol'; } if (typeof x === 'bigint') { return 'BigInt'; } return ES5Type(x); }; es-abstract-1.20.4/2021/UTF16EncodeCodePoint.js000066400000000000000000000013111431761430200204550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var floor = require('./floor'); var modulo = require('./modulo'); var isCodePoint = require('../helpers/isCodePoint'); // https://ecma-international.org/ecma-262/12.0/#sec-utf16encoding module.exports = function UTF16EncodeCodePoint(cp) { if (!isCodePoint(cp)) { throw new $TypeError('Assertion failed: `cp` must be >= 0 and <= 0x10FFFF'); } if (cp <= 65535) { return $fromCharCode(cp); } var cu1 = $fromCharCode(floor((cp - 65536) / 1024) + 0xD800); var cu2 = $fromCharCode(modulo(cp - 65536, 1024) + 0xDC00); return cu1 + cu2; }; es-abstract-1.20.4/2021/UTF16SurrogatePairToCodePoint.js000066400000000000000000000014021431761430200223530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); // https://tc39.es/ecma262/2020/#sec-utf16decodesurrogatepair module.exports = function UTF16SurrogatePairToCodePoint(lead, trail) { if (!isLeadingSurrogate(lead) || !isTrailingSurrogate(trail)) { throw new $TypeError('Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code'); } // var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; return $fromCharCode(lead) + $fromCharCode(trail); }; es-abstract-1.20.4/2021/UnicodeEscape.js000066400000000000000000000015071431761430200174430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var $numberToString = callBound('Number.prototype.toString'); var $toLowerCase = callBound('String.prototype.toLowerCase'); var StringPad = require('./StringPad'); // https://262.ecma-international.org/11.0/#sec-unicodeescape module.exports = function UnicodeEscape(C) { if (typeof C !== 'string' || C.length !== 1) { throw new $TypeError('Assertion failed: `C` must be a single code unit'); } var n = $charCodeAt(C, 0); if (n > 0xFFFF) { throw new $TypeError('`Assertion failed: numeric value of `C` must be <= 0xFFFF'); } return '\\u' + StringPad($toLowerCase($numberToString(n, 16)), 4, '0', 'start'); }; es-abstract-1.20.4/2021/ValidateAndApplyPropertyDescriptor.js000066400000000000000000000121731431761430200237230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var isSamePropertyDescriptor = require('../helpers/isSamePropertyDescriptor'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-validateandapplypropertydescriptor // https://ecma-international.org/ecma-262/8.0/#sec-validateandapplypropertydescriptor // eslint-disable-next-line max-lines-per-function, max-statements, max-params module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) { // this uses the ES2017+ logic, since it fixes a number of bugs in the ES2015 logic. var oType = Type(O); if (oType !== 'Undefined' && oType !== 'Object') { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } if (Type(extensible) !== 'Boolean') { throw new $TypeError('Assertion failed: extensible must be a Boolean'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (Type(current) !== 'Undefined' && !isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } if (oType !== 'Undefined' && !IsPropertyKey(P)) { throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); } if (Type(current) === 'Undefined') { if (!extensible) { return false; } if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': Desc['[[Configurable]]'], '[[Enumerable]]': Desc['[[Enumerable]]'], '[[Value]]': Desc['[[Value]]'], '[[Writable]]': Desc['[[Writable]]'] } ); } } else { if (!IsAccessorDescriptor(Desc)) { throw new $TypeError('Assertion failed: Desc is not an accessor descriptor'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } } return true; } if (IsGenericDescriptor(Desc) && !('[[Configurable]]' in Desc) && !('[[Enumerable]]' in Desc)) { return true; } if (isSamePropertyDescriptor({ SameValue: SameValue }, Desc, current)) { return true; // removed by ES2017, but should still be correct } // "if every field in Desc is absent, return true" can't really match the assertion that it's a Property Descriptor if (!current['[[Configurable]]']) { if (Desc['[[Configurable]]']) { return false; } if ('[[Enumerable]]' in Desc && !Desc['[[Enumerable]]'] === !!current['[[Enumerable]]']) { return false; } } if (IsGenericDescriptor(Desc)) { // no further validation is required. } else if (IsDataDescriptor(current) !== IsDataDescriptor(Desc)) { if (!current['[[Configurable]]']) { return false; } if (IsDataDescriptor(current)) { if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Get]]': undefined } ); } } else if (oType !== 'Undefined') { DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': current['[[Configurable]]'], '[[Enumerable]]': current['[[Enumerable]]'], '[[Value]]': undefined } ); } } else if (IsDataDescriptor(current) && IsDataDescriptor(Desc)) { if (!current['[[Configurable]]'] && !current['[[Writable]]']) { if ('[[Writable]]' in Desc && Desc['[[Writable]]']) { return false; } if ('[[Value]]' in Desc && !SameValue(Desc['[[Value]]'], current['[[Value]]'])) { return false; } return true; } } else if (IsAccessorDescriptor(current) && IsAccessorDescriptor(Desc)) { if (!current['[[Configurable]]']) { if ('[[Set]]' in Desc && !SameValue(Desc['[[Set]]'], current['[[Set]]'])) { return false; } if ('[[Get]]' in Desc && !SameValue(Desc['[[Get]]'], current['[[Get]]'])) { return false; } return true; } } else { throw new $TypeError('Assertion failed: current and Desc are not both data, both accessors, or one accessor and one data.'); } if (oType !== 'Undefined') { return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } return true; }; es-abstract-1.20.4/2021/WeakRefDeref.js000066400000000000000000000011611431761430200172220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $deref = callBound('WeakRef.prototype.deref', true); var isWeakRef = require('is-weakref'); var AddToKeptObjects = require('./AddToKeptObjects'); // https://ecma-international.org/ecma-262/12.0/#sec-weakrefderef module.exports = function WeakRefDeref(weakRef) { if (!isWeakRef(weakRef)) { throw new $TypeError('Assertion failed: `weakRef` must be a WeakRef'); } var target = $deref(weakRef); if (target) { AddToKeptObjects(target); } return target; }; es-abstract-1.20.4/2021/WeekDay.js000066400000000000000000000003201431761430200162550ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.6 module.exports = function WeekDay(t) { return modulo(Day(t) + 4, 7); }; es-abstract-1.20.4/2021/YearFromTime.js000066400000000000000000000006271431761430200173010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var callBound = require('call-bind/callBound'); var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function YearFromTime(t) { // largest y such that this.TimeFromYear(y) <= t return $getUTCFullYear(new $Date(t)); }; es-abstract-1.20.4/2021/abs.js000066400000000000000000000003171431761430200154770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $abs = GetIntrinsic('%Math.abs%'); // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function abs(x) { return $abs(x); }; es-abstract-1.20.4/2021/clamp.js000066400000000000000000000011001431761430200160150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var max = GetIntrinsic('%Math.max%'); var min = GetIntrinsic('%Math.min%'); var Type = require('./Type'); // https://262.ecma-international.org/12.0/#clamping module.exports = function clamp(x, lower, upper) { if (Type(x) !== 'Number' || Type(lower) !== 'Number' || Type(upper) !== 'Number' || !(lower <= upper)) { throw new $TypeError('Assertion failed: all three arguments must be MVs, and `lower` must be `<= upper`'); } return min(max(lower, x), upper); }; es-abstract-1.20.4/2021/floor.js000066400000000000000000000003311431761430200160470ustar00rootroot00000000000000'use strict'; // var modulo = require('./modulo'); var $floor = Math.floor; // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function floor(x) { // return x - modulo(x, 1); return $floor(x); }; es-abstract-1.20.4/2021/modulo.js000066400000000000000000000002501431761430200162250ustar00rootroot00000000000000'use strict'; var mod = require('../helpers/mod'); // https://262.ecma-international.org/5.1/#sec-5.2 module.exports = function modulo(x, y) { return mod(x, y); }; es-abstract-1.20.4/2021/msFromTime.js000066400000000000000000000003751431761430200170200ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerSecond = require('../helpers/timeConstants').msPerSecond; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function msFromTime(t) { return modulo(t, msPerSecond); }; es-abstract-1.20.4/2021/substring.js000066400000000000000000000013441431761430200167530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); var callBound = require('call-bind/callBound'); var $slice = callBound('String.prototype.slice'); // https://262.ecma-international.org/12.0/#substring module.exports = function substring(S, inclusiveStart, exclusiveEnd) { if (Type(S) !== 'String' || !IsIntegralNumber(inclusiveStart) || (arguments.length > 2 && !IsIntegralNumber(exclusiveEnd))) { throw new $TypeError('`S` must be a String, and `inclusiveStart` and `exclusiveEnd` must be integers'); } return $slice(S, inclusiveStart, arguments.length > 2 ? exclusiveEnd : S.length); }; es-abstract-1.20.4/2021/thisBigIntValue.js000066400000000000000000000010471431761430200177740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $bigIntValueOf = callBound('BigInt.prototype.valueOf', true); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-thisbigintvalue module.exports = function thisBigIntValue(value) { var type = Type(value); if (type === 'BigInt') { return value; } if (!$bigIntValueOf) { throw new $TypeError('BigInt is not supported'); } return $bigIntValueOf(value); }; es-abstract-1.20.4/2021/thisBooleanValue.js000066400000000000000000000005571431761430200202040ustar00rootroot00000000000000'use strict'; var $BooleanValueOf = require('call-bind/callBound')('Boolean.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-boolean-prototype-object module.exports = function thisBooleanValue(value) { if (Type(value) === 'Boolean') { return value; } return $BooleanValueOf(value); }; es-abstract-1.20.4/2021/thisNumberValue.js000066400000000000000000000006061431761430200200500ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var Type = require('./Type'); var $NumberValueOf = callBound('Number.prototype.valueOf'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object module.exports = function thisNumberValue(value) { if (Type(value) === 'Number') { return value; } return $NumberValueOf(value); }; es-abstract-1.20.4/2021/thisStringValue.js000066400000000000000000000005511431761430200200650ustar00rootroot00000000000000'use strict'; var $StringValueOf = require('call-bind/callBound')('String.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object module.exports = function thisStringValue(value) { if (Type(value) === 'String') { return value; } return $StringValueOf(value); }; es-abstract-1.20.4/2021/thisSymbolValue.js000066400000000000000000000010021431761430200200540ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-thissymbolvalue module.exports = function thisSymbolValue(value) { if (!$SymbolValueOf) { throw new SyntaxError('Symbols are not supported; thisSymbolValue requires that `value` be a Symbol or a Symbol object'); } if (Type(value) === 'Symbol') { return value; } return $SymbolValueOf(value); }; es-abstract-1.20.4/2021/thisTimeValue.js000066400000000000000000000001021431761430200175050ustar00rootroot00000000000000'use strict'; module.exports = require('../2018/thisTimeValue'); es-abstract-1.20.4/2022/000077500000000000000000000000001431761430200143745ustar00rootroot00000000000000es-abstract-1.20.4/2022/AddEntriesFromIterable.js000066400000000000000000000027571431761430200212630ustar00rootroot00000000000000'use strict'; var inspect = require('object-inspect'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var GetIterator = require('./GetIterator'); var IsCallable = require('./IsCallable'); var IteratorClose = require('./IteratorClose'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); var Type = require('./Type'); // https://262.ecma-international.org/10.0//#sec-add-entries-from-iterable module.exports = function AddEntriesFromIterable(target, iterable, adder) { if (!IsCallable(adder)) { throw new $TypeError('Assertion failed: `adder` is not callable'); } if (iterable == null) { throw new $TypeError('Assertion failed: `iterable` is present, and not nullish'); } var iteratorRecord = GetIterator(iterable); while (true) { // eslint-disable-line no-constant-condition var next = IteratorStep(iteratorRecord); if (!next) { return target; } var nextItem = IteratorValue(next); if (Type(nextItem) !== 'Object') { var error = new $TypeError('iterator next must return an Object, got ' + inspect(nextItem)); return IteratorClose( iteratorRecord, function () { throw error; } // eslint-disable-line no-loop-func ); } try { var k = Get(nextItem, '0'); var v = Get(nextItem, '1'); Call(adder, target, [k, v]); } catch (e) { return IteratorClose( iteratorRecord, function () { throw e; } ); } } }; es-abstract-1.20.4/2022/AddToKeptObjects.js000066400000000000000000000012051431761430200200610ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var SLOT = require('internal-slot'); var $TypeError = GetIntrinsic('%TypeError%'); var ClearKeptObjects = require('./ClearKeptObjects'); var Type = require('./Type'); var $push = callBound('Array.prototype.push'); // https://ecma-international.org/ecma-262/12.0/#sec-addtokeptobjects module.exports = function AddToKeptObjects(object) { if (Type(object) !== 'Object') { throw new $TypeError('Assertion failed: `object` must be an Object'); } $push(SLOT.get(ClearKeptObjects, '[[es-abstract internal: KeptAlive]]'), object); }; es-abstract-1.20.4/2022/AdvanceStringIndex.js000066400000000000000000000017621431761430200204600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var CodePointAt = require('./CodePointAt'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var $TypeError = GetIntrinsic('%TypeError%'); // https://ecma-international.org/ecma-262/12.0/#sec-advancestringindex module.exports = function AdvanceStringIndex(S, index, unicode) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsIntegralNumber(index) || index < 0 || index > MAX_SAFE_INTEGER) { throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53'); } if (Type(unicode) !== 'Boolean') { throw new $TypeError('Assertion failed: `unicode` must be a Boolean'); } if (!unicode) { return index + 1; } var length = S.length; if ((index + 1) >= length) { return index + 1; } var cp = CodePointAt(S, index); return index + cp['[[CodeUnitCount]]']; }; es-abstract-1.20.4/2022/ApplyStringOrNumericBinaryOperator.js000066400000000000000000000061631431761430200237210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var HasOwnProperty = require('./HasOwnProperty'); var ToNumeric = require('./ToNumeric'); var ToPrimitive = require('./ToPrimitive'); var ToString = require('./ToString'); var Type = require('./Type'); var NumberAdd = require('./Number/add'); var NumberBitwiseAND = require('./Number/bitwiseAND'); var NumberBitwiseOR = require('./Number/bitwiseOR'); var NumberBitwiseXOR = require('./Number/bitwiseXOR'); var NumberDivide = require('./Number/divide'); var NumberExponentiate = require('./Number/exponentiate'); var NumberLeftShift = require('./Number/leftShift'); var NumberMultiply = require('./Number/multiply'); var NumberRemainder = require('./Number/remainder'); var NumberSignedRightShift = require('./Number/signedRightShift'); var NumberSubtract = require('./Number/subtract'); var NumberUnsignedRightShift = require('./Number/unsignedRightShift'); var BigIntAdd = require('./BigInt/add'); var BigIntBitwiseAND = require('./BigInt/bitwiseAND'); var BigIntBitwiseOR = require('./BigInt/bitwiseOR'); var BigIntBitwiseXOR = require('./BigInt/bitwiseXOR'); var BigIntDivide = require('./BigInt/divide'); var BigIntExponentiate = require('./BigInt/exponentiate'); var BigIntLeftShift = require('./BigInt/leftShift'); var BigIntMultiply = require('./BigInt/multiply'); var BigIntRemainder = require('./BigInt/remainder'); var BigIntSignedRightShift = require('./BigInt/signedRightShift'); var BigIntSubtract = require('./BigInt/subtract'); var BigIntUnsignedRightShift = require('./BigInt/unsignedRightShift'); // https://ecma-international.org/ecma-262/12.0/#sec-applystringornumericbinaryoperator // https://ecma-international.org/ecma-262/12.0/#step-applystringornumericbinaryoperator-operations-table var table = { '**': [NumberExponentiate, BigIntExponentiate], '*': [NumberMultiply, BigIntMultiply], '/': [NumberDivide, BigIntDivide], '%': [NumberRemainder, BigIntRemainder], '+': [NumberAdd, BigIntAdd], '-': [NumberSubtract, BigIntSubtract], '<<': [NumberLeftShift, BigIntLeftShift], '>>': [NumberSignedRightShift, BigIntSignedRightShift], '>>>': [NumberUnsignedRightShift, BigIntUnsignedRightShift], '&': [NumberBitwiseAND, BigIntBitwiseAND], '^': [NumberBitwiseXOR, BigIntBitwiseXOR], '|': [NumberBitwiseOR, BigIntBitwiseOR] }; module.exports = function ApplyStringOrNumericBinaryOperator(lval, opText, rval) { if (Type(opText) !== 'String' || !HasOwnProperty(table, opText)) { throw new $TypeError('Assertion failed: `opText` must be a valid operation string'); } if (opText === '+') { var lprim = ToPrimitive(lval); var rprim = ToPrimitive(rval); if (Type(lprim) === 'String' || Type(rprim) === 'String') { var lstr = ToString(lprim); var rstr = ToString(rprim); return lstr + rstr; } /* eslint no-param-reassign: 1 */ lval = lprim; rval = rprim; } var lnum = ToNumeric(lval); var rnum = ToNumeric(rval); var T = Type(lnum); if (T !== Type(rnum)) { throw new $TypeError('types of ' + lnum + ' and ' + rnum + ' differ'); } var Operation = table[opText][T === 'BigInt' ? 1 : 0]; return Operation(lnum, rnum); }; es-abstract-1.20.4/2022/ArrayCreate.js000066400000000000000000000032031431761430200171320ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ArrayPrototype = GetIntrinsic('%Array.prototype%'); var $RangeError = GetIntrinsic('%RangeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || ( // eslint-disable-next-line no-proto, no-negated-condition [].__proto__ !== $ArrayPrototype ? null : function (O, proto) { O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign return O; } ); // https://www.ecma-international.org/ecma-262/12.0/#sec-arraycreate module.exports = function ArrayCreate(length) { if (!IsIntegralNumber(length) || length < 0) { throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0'); } if (length > MAX_ARRAY_LENGTH) { throw new $RangeError('length is greater than (2**32 - 1)'); } var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype; var A = []; // steps 3, 5 if (proto !== $ArrayPrototype) { // step 4 if (!$setProto) { throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } $setProto(A, proto); } if (length !== 0) { // bypasses the need for step 6 A.length = length; } /* step 6, the above as a shortcut for the below OrdinaryDefineOwnProperty(A, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': true }); */ return A; }; es-abstract-1.20.4/2022/ArraySetLength.js000066400000000000000000000051511431761430200176300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var assign = require('object.assign'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsArray = require('./IsArray'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function ArraySetLength(A, Desc) { if (!IsArray(A)) { throw new $TypeError('Assertion failed: A must be an Array'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!('[[Value]]' in Desc)) { return OrdinaryDefineOwnProperty(A, 'length', Desc); } var newLenDesc = assign({}, Desc); var newLen = ToUint32(Desc['[[Value]]']); var numberLen = ToNumber(Desc['[[Value]]']); if (newLen !== numberLen) { throw new $RangeError('Invalid array length'); } newLenDesc['[[Value]]'] = newLen; var oldLenDesc = OrdinaryGetOwnProperty(A, 'length'); if (!IsDataDescriptor(oldLenDesc)) { throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`'); } var oldLen = oldLenDesc['[[Value]]']; if (newLen >= oldLen) { return OrdinaryDefineOwnProperty(A, 'length', newLenDesc); } if (!oldLenDesc['[[Writable]]']) { return false; } var newWritable; if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) { newWritable = true; } else { newWritable = false; newLenDesc['[[Writable]]'] = true; } var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc); if (!succeeded) { return false; } while (newLen < oldLen) { oldLen -= 1; // eslint-disable-next-line no-param-reassign var deleteSucceeded = delete A[ToString(oldLen)]; if (!deleteSucceeded) { newLenDesc['[[Value]]'] = oldLen + 1; if (!newWritable) { newLenDesc['[[Writable]]'] = false; OrdinaryDefineOwnProperty(A, 'length', newLenDesc); return false; } } } if (!newWritable) { return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false }); } return true; }; es-abstract-1.20.4/2022/ArraySpeciesCreate.js000066400000000000000000000025321431761430200204520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var ArrayCreate = require('./ArrayCreate'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsConstructor = require('./IsConstructor'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/12.0/#sec-arrayspeciescreate module.exports = function ArraySpeciesCreate(originalArray, length) { if (!IsIntegralNumber(length) || length < 0) { throw new $TypeError('Assertion failed: length must be an integer >= 0'); } var isArray = IsArray(originalArray); if (!isArray) { return ArrayCreate(length); } var C = Get(originalArray, 'constructor'); // TODO: figure out how to make a cross-realm normal Array, a same-realm Array // if (IsConstructor(C)) { // if C is another realm's Array, C = undefined // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ? // } if ($species && Type(C) === 'Object') { C = Get(C, $species); if (C === null) { C = void 0; } } if (typeof C === 'undefined') { return ArrayCreate(length); } if (!IsConstructor(C)) { throw new $TypeError('C must be a constructor'); } return new C(length); // Construct(C, length); }; es-abstract-1.20.4/2022/BigInt/000077500000000000000000000000001431761430200155505ustar00rootroot00000000000000es-abstract-1.20.4/2022/BigInt/add.js000066400000000000000000000007131431761430200166370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-add module.exports = function BigIntAdd(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x + y; }; es-abstract-1.20.4/2022/BigInt/bitwiseAND.js000066400000000000000000000007671431761430200201110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var BigIntBitwiseOp = require('../BigIntBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseAND module.exports = function BigIntBitwiseAND(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntBitwiseOp('&', x, y); }; es-abstract-1.20.4/2022/BigInt/bitwiseNOT.js000066400000000000000000000007021431761430200201340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseNOT module.exports = function BigIntBitwiseNOT(x) { if (Type(x) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` argument must be a BigInt'); } return -x - $BigInt(1); }; es-abstract-1.20.4/2022/BigInt/bitwiseOR.js000066400000000000000000000007651431761430200200250ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var BigIntBitwiseOp = require('../BigIntBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseOR module.exports = function BigIntBitwiseOR(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntBitwiseOp('|', x, y); }; es-abstract-1.20.4/2022/BigInt/bitwiseXOR.js000066400000000000000000000007671431761430200201570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var BigIntBitwiseOp = require('../BigIntBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseXOR module.exports = function BigIntBitwiseXOR(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntBitwiseOp('^', x, y); }; es-abstract-1.20.4/2022/BigInt/divide.js000066400000000000000000000011671431761430200173570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-divide module.exports = function BigIntDivide(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } if (y === $BigInt(0)) { throw new $RangeError('Division by zero'); } // shortcut for the actual spec mechanics return x / y; }; es-abstract-1.20.4/2022/BigInt/equal.js000066400000000000000000000007201431761430200172140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-equal module.exports = function BigIntEqual(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x === y; }; es-abstract-1.20.4/2022/BigInt/exponentiate.js000066400000000000000000000015671431761430200206220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-exponentiate module.exports = function BigIntExponentiate(base, exponent) { if (Type(base) !== 'BigInt' || Type(exponent) !== 'BigInt') { throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be BigInts'); } if (exponent < $BigInt(0)) { throw new $RangeError('Exponent must be positive'); } if (/* base === $BigInt(0) && */ exponent === $BigInt(0)) { return $BigInt(1); } var square = base; var remaining = exponent; while (remaining > $BigInt(0)) { square += exponent; --remaining; // eslint-disable-line no-plusplus } return square; }; es-abstract-1.20.4/2022/BigInt/index.js000066400000000000000000000023721431761430200172210ustar00rootroot00000000000000'use strict'; var add = require('./add'); var bitwiseAND = require('./bitwiseAND'); var bitwiseNOT = require('./bitwiseNOT'); var bitwiseOR = require('./bitwiseOR'); var bitwiseXOR = require('./bitwiseXOR'); var divide = require('./divide'); var equal = require('./equal'); var exponentiate = require('./exponentiate'); var leftShift = require('./leftShift'); var lessThan = require('./lessThan'); var multiply = require('./multiply'); var remainder = require('./remainder'); var sameValue = require('./sameValue'); var sameValueZero = require('./sameValueZero'); var signedRightShift = require('./signedRightShift'); var subtract = require('./subtract'); var toString = require('./toString'); var unaryMinus = require('./unaryMinus'); var unsignedRightShift = require('./unsignedRightShift'); module.exports = { add: add, bitwiseAND: bitwiseAND, bitwiseNOT: bitwiseNOT, bitwiseOR: bitwiseOR, bitwiseXOR: bitwiseXOR, divide: divide, equal: equal, exponentiate: exponentiate, leftShift: leftShift, lessThan: lessThan, multiply: multiply, remainder: remainder, sameValue: sameValue, sameValueZero: sameValueZero, signedRightShift: signedRightShift, subtract: subtract, toString: toString, unaryMinus: unaryMinus, unsignedRightShift: unsignedRightShift }; es-abstract-1.20.4/2022/BigInt/leftShift.js000066400000000000000000000007301431761430200200360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-leftShift module.exports = function BigIntLeftShift(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x << y; }; es-abstract-1.20.4/2022/BigInt/lessThan.js000066400000000000000000000007251431761430200176730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-lessThan module.exports = function BigIntLessThan(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x < y; }; es-abstract-1.20.4/2022/BigInt/multiply.js000066400000000000000000000007251431761430200177710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-multiply module.exports = function BigIntMultiply(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x * y; }; es-abstract-1.20.4/2022/BigInt/remainder.js000066400000000000000000000013021431761430200200500ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var zero = $BigInt && $BigInt(0); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-remainder module.exports = function BigIntRemainder(n, d) { if (Type(n) !== 'BigInt' || Type(d) !== 'BigInt') { throw new $TypeError('Assertion failed: `n` and `d` arguments must be BigInts'); } if (d === zero) { throw new $RangeError('Division by zero'); } if (n === zero) { return zero; } // shortcut for the actual spec mechanics return n % d; }; es-abstract-1.20.4/2022/BigInt/sameValue.js000066400000000000000000000007361431761430200200360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var BigIntEqual = require('./equal'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValue module.exports = function BigIntSameValue(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntEqual(x, y); }; es-abstract-1.20.4/2022/BigInt/sameValueZero.js000066400000000000000000000007461431761430200206770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var BigIntEqual = require('./equal'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValueZero module.exports = function BigIntSameValueZero(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntEqual(x, y); }; es-abstract-1.20.4/2022/BigInt/signedRightShift.js000066400000000000000000000007711431761430200213600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var BigIntLeftShift = require('./leftShift'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-signedRightShift module.exports = function BigIntSignedRightShift(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } return BigIntLeftShift(x, -y); }; es-abstract-1.20.4/2022/BigInt/subtract.js000066400000000000000000000007251431761430200177410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-subtract module.exports = function BigIntSubtract(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } // shortcut for the actual spec mechanics return x - y; }; es-abstract-1.20.4/2022/BigInt/toString.js000066400000000000000000000006531431761430200177230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-tostring module.exports = function BigIntToString(x) { if (Type(x) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` must be a BigInt'); } return $String(x); }; es-abstract-1.20.4/2022/BigInt/unaryMinus.js000066400000000000000000000007771431761430200202730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var zero = $BigInt && $BigInt(0); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unaryMinus module.exports = function BigIntUnaryMinus(x) { if (Type(x) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` argument must be a BigInt'); } if (x === zero) { return zero; } return -x; }; es-abstract-1.20.4/2022/BigInt/unsignedRightShift.js000066400000000000000000000007761431761430200217300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unsignedRightShift module.exports = function BigIntUnsignedRightShift(x, y) { if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); } throw new $TypeError('BigInts have no unsigned right shift, use >> instead'); }; es-abstract-1.20.4/2022/BigIntBitwiseOp.js000066400000000000000000000033071431761430200177370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // var $BigInt = GetIntrinsic('%BigInt%', true); // var $pow = GetIntrinsic('%Math.pow%'); // var BinaryAnd = require('./BinaryAnd'); // var BinaryOr = require('./BinaryOr'); // var BinaryXor = require('./BinaryXor'); var Type = require('./Type'); // var modulo = require('./modulo'); // var zero = $BigInt && $BigInt(0); // var negOne = $BigInt && $BigInt(-1); // var two = $BigInt && $BigInt(2); // https://262.ecma-international.org/11.0/#sec-bigintbitwiseop module.exports = function BigIntBitwiseOp(op, x, y) { if (op !== '&' && op !== '|' && op !== '^') { throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`'); } if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { throw new $TypeError('`x` and `y` must be BigInts'); } if (op === '&') { return x & y; } if (op === '|') { return x | y; } return x ^ y; /* var result = zero; var shift = 0; while (x !== zero && x !== negOne && y !== zero && y !== negOne) { var xDigit = modulo(x, two); var yDigit = modulo(y, two); if (op === '&') { result += $pow(2, shift) * BinaryAnd(xDigit, yDigit); } else if (op === '|') { result += $pow(2, shift) * BinaryOr(xDigit, yDigit); } else if (op === '^') { result += $pow(2, shift) * BinaryXor(xDigit, yDigit); } shift += 1; x = (x - xDigit) / two; y = (y - yDigit) / two; } var tmp; if (op === '&') { tmp = BinaryAnd(modulo(x, two), modulo(y, two)); } else if (op === '|') { tmp = BinaryAnd(modulo(x, two), modulo(y, two)); } else { tmp = BinaryXor(modulo(x, two), modulo(y, two)); } if (tmp !== 0) { result -= $pow(2, shift); } return result; */ }; es-abstract-1.20.4/2022/BinaryAnd.js000066400000000000000000000005541431761430200166050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // https://262.ecma-international.org/11.0/#sec-binaryand module.exports = function BinaryAnd(x, y) { if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); } return x & y; }; es-abstract-1.20.4/2022/BinaryOr.js000066400000000000000000000005521431761430200164610ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // https://262.ecma-international.org/11.0/#sec-binaryor module.exports = function BinaryOr(x, y) { if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); } return x | y; }; es-abstract-1.20.4/2022/BinaryXor.js000066400000000000000000000005541431761430200166530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // https://262.ecma-international.org/11.0/#sec-binaryxor module.exports = function BinaryXor(x, y) { if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); } return x ^ y; }; es-abstract-1.20.4/2022/ByteListBitwiseOp.js000066400000000000000000000024531431761430200203230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $push = callBound('Array.prototype.push'); var IsArray = require('./IsArray'); var isByteValue = require('../helpers/isByteValue'); // https://ecma-international.org/ecma-262/12.0/#sec-bytelistbitwiseop module.exports = function ByteListBitwiseOp(op, xBytes, yBytes) { if (op !== '&' && op !== '^' && op !== '|') { throw new $TypeError('Assertion failed: `op` must be `&`, `^`, or `|`'); } if (!IsArray(xBytes) || !IsArray(yBytes) || xBytes.length !== yBytes.length) { throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be same-length sequences of byte values (an integer 0-255, inclusive)'); } var result = []; for (var i = 0; i < xBytes.length; i += 1) { var xByte = xBytes[i]; var yByte = yBytes[i]; if (!isByteValue(xByte) || !isByteValue(yByte)) { throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be same-length sequences of byte values (an integer 0-255, inclusive)'); } var resultByte; if (op === '&') { resultByte = xByte & yByte; } else if (op === '^') { resultByte = xByte ^ yByte; } else { resultByte = xByte | yByte; } $push(result, resultByte); } return result; }; es-abstract-1.20.4/2022/ByteListEqual.js000066400000000000000000000016211431761430200174610ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsArray = require('./IsArray'); var isByteValue = require('../helpers/isByteValue'); // https://ecma-international.org/ecma-262/12.0/#sec-bytelistequal module.exports = function ByteListEqual(xBytes, yBytes) { if (!IsArray(xBytes) || !IsArray(yBytes)) { throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be sequences of byte values (an integer 0-255, inclusive)'); } if (xBytes.length !== yBytes.length) { return false; } for (var i = 0; i < xBytes.length; i += 1) { var xByte = xBytes[i]; var yByte = yBytes[i]; if (!isByteValue(xByte) || !isByteValue(yByte)) { throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be sequences of byte values (an integer 0-255, inclusive)'); } if (xByte !== yByte) { return false; } } return true; }; es-abstract-1.20.4/2022/Call.js000066400000000000000000000011571431761430200156110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsArray = require('./IsArray'); var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%'); // https://ecma-international.org/ecma-262/6.0/#sec-call module.exports = function Call(F, V) { var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } return $apply(F, V, argumentsList); }; es-abstract-1.20.4/2022/CanonicalNumericIndexString.js000066400000000000000000000012161431761430200223230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring module.exports = function CanonicalNumericIndexString(argument) { if (Type(argument) !== 'String') { throw new $TypeError('Assertion failed: `argument` must be a String'); } if (argument === '-0') { return -0; } var n = ToNumber(argument); if (SameValue(ToString(n), argument)) { return n; } return void 0; }; es-abstract-1.20.4/2022/CharacterRange.js000066400000000000000000000014161431761430200176050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var $TypeError = GetIntrinsic('%TypeError%'); var $charCodeAt = callBound('%String.prototype.charCodeAt%'); var $push = callBound('%Array.prototype.push%'); module.exports = function CharacterRange(A, B) { if (A.length !== 1 || B.length !== 1) { throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); } var a = A[0]; var b = B[0]; var i = $charCodeAt(a, 0); var j = $charCodeAt(b, 0); if (!(i <= j)) { throw new $TypeError('Assertion failed: i is not <= j'); } var arr = []; for (var k = i; k <= j; k += 1) { $push(arr, $fromCharCode(k)); } return arr; }; es-abstract-1.20.4/2022/ClearKeptObjects.js000066400000000000000000000004561431761430200201230ustar00rootroot00000000000000'use strict'; var SLOT = require('internal-slot'); var keptObjects = []; // https://ecma-international.org/ecma-262/12.0/#sec-clear-kept-objects module.exports = function ClearKeptObjects() { keptObjects.length = 0; }; SLOT.set(module.exports, '[[es-abstract internal: KeptAlive]]', keptObjects); es-abstract-1.20.4/2022/CodePointAt.js000066400000000000000000000033141431761430200171040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var Type = require('./Type'); var UTF16SurrogatePairToCodePoint = require('./UTF16SurrogatePairToCodePoint'); var $charAt = callBound('String.prototype.charAt'); var $charCodeAt = callBound('String.prototype.charCodeAt'); // https://ecma-international.org/ecma-262/12.0/#sec-codepointat module.exports = function CodePointAt(string, position) { if (Type(string) !== 'String') { throw new $TypeError('Assertion failed: `string` must be a String'); } var size = string.length; if (position < 0 || position >= size) { throw new $TypeError('Assertion failed: `position` must be >= 0, and < the length of `string`'); } var first = $charCodeAt(string, position); var cp = $charAt(string, position); var firstIsLeading = isLeadingSurrogate(first); var firstIsTrailing = isTrailingSurrogate(first); if (!firstIsLeading && !firstIsTrailing) { return { '[[CodePoint]]': cp, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': false }; } if (firstIsTrailing || (position + 1 === size)) { return { '[[CodePoint]]': cp, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': true }; } var second = $charCodeAt(string, position + 1); if (!isTrailingSurrogate(second)) { return { '[[CodePoint]]': cp, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': true }; } return { '[[CodePoint]]': UTF16SurrogatePairToCodePoint(first, second), '[[CodeUnitCount]]': 2, '[[IsUnpairedSurrogate]]': false }; }; es-abstract-1.20.4/2022/CodePointsToString.js000066400000000000000000000014241431761430200204740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint'); var IsArray = require('./IsArray'); var forEach = require('../helpers/forEach'); var isCodePoint = require('../helpers/isCodePoint'); // https://ecma-international.org/ecma-262/12.0/#sec-codepointstostring module.exports = function CodePointsToString(text) { if (!IsArray(text)) { throw new $TypeError('Assertion failed: `text` must be a sequence of Unicode Code Points'); } var result = ''; forEach(text, function (cp) { if (!isCodePoint(cp)) { throw new $TypeError('Assertion failed: `text` must be a sequence of Unicode Code Points'); } result += UTF16EncodeCodePoint(cp); }); return result; }; es-abstract-1.20.4/2022/CompletePropertyDescriptor.js000066400000000000000000000017351431761430200223140ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor module.exports = function CompletePropertyDescriptor(Desc) { /* eslint no-param-reassign: 0 */ assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { if (!has(Desc, '[[Value]]')) { Desc['[[Value]]'] = void 0; } if (!has(Desc, '[[Writable]]')) { Desc['[[Writable]]'] = false; } } else { if (!has(Desc, '[[Get]]')) { Desc['[[Get]]'] = void 0; } if (!has(Desc, '[[Set]]')) { Desc['[[Set]]'] = void 0; } } if (!has(Desc, '[[Enumerable]]')) { Desc['[[Enumerable]]'] = false; } if (!has(Desc, '[[Configurable]]')) { Desc['[[Configurable]]'] = false; } return Desc; }; es-abstract-1.20.4/2022/CopyDataProperties.js000066400000000000000000000040061431761430200205130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var every = require('../helpers/every'); var some = require('../helpers/some'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsIntegralNumber = require('./IsIntegralNumber'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToNumber = require('./ToNumber'); var ToObject = require('./ToObject'); var Type = require('./Type'); // https://www.ecma-international.org/ecma-262/12.0/#sec-copydataproperties module.exports = function CopyDataProperties(target, source, excludedItems) { if (Type(target) !== 'Object') { throw new $TypeError('Assertion failed: "target" must be an Object'); } if (!IsArray(excludedItems) || !every(excludedItems, IsPropertyKey)) { throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); } if (typeof source === 'undefined' || source === null) { return target; } var from = ToObject(source); var keys = OwnPropertyKeys(from); forEach(keys, function (nextKey) { var excluded = some(excludedItems, function (e) { return SameValue(e, nextKey) === true; }); /* var excluded = false; forEach(excludedItems, function (e) { if (SameValue(e, nextKey) === true) { excluded = true; } }); */ var enumerable = $isEnumerable(from, nextKey) || ( // this is to handle string keys being non-enumerable in older engines typeof source === 'string' && nextKey >= 0 && IsIntegralNumber(ToNumber(nextKey)) ); if (excluded === false && enumerable) { var propValue = Get(from, nextKey); CreateDataPropertyOrThrow(target, nextKey, propValue); } }); return target; }; es-abstract-1.20.4/2022/CreateDataProperty.js000066400000000000000000000023771431761430200205050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty module.exports = function CreateDataProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var oldDesc = OrdinaryGetOwnProperty(O, P); var extensible = !oldDesc || IsExtensible(O); var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]']; if (nonConfigurable || !extensible) { return false; } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Value]]': V, '[[Writable]]': true } ); }; es-abstract-1.20.4/2022/CreateDataPropertyOrThrow.js000066400000000000000000000013361431761430200220240ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var CreateDataProperty = require('./CreateDataProperty'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow module.exports = function CreateDataPropertyOrThrow(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var success = CreateDataProperty(O, P, V); if (!success) { throw new $TypeError('unable to create data property'); } return success; }; es-abstract-1.20.4/2022/CreateHTML.js000066400000000000000000000016371431761430200166310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $replace = callBound('String.prototype.replace'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createhtml module.exports = function CreateHTML(string, tag, attribute, value) { if (Type(tag) !== 'String' || Type(attribute) !== 'String') { throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings'); } var str = RequireObjectCoercible(string); var S = ToString(str); var p1 = '<' + tag; if (attribute !== '') { var V = ToString(value); var escapedV = $replace(V, /\x22/g, '"'); p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22'; } return p1 + '>' + S + ''; }; es-abstract-1.20.4/2022/CreateIterResultObject.js000066400000000000000000000006601431761430200213110ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject module.exports = function CreateIterResultObject(value, done) { if (Type(done) !== 'Boolean') { throw new $TypeError('Assertion failed: Type(done) is not Boolean'); } return { value: value, done: done }; }; es-abstract-1.20.4/2022/CreateListFromArrayLike.js000066400000000000000000000025231431761430200214230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $indexOf = callBound('Array.prototype.indexOf', true) || callBound('String.prototype.indexOf'); var $push = callBound('Array.prototype.push'); var Get = require('./Get'); var IsArray = require('./IsArray'); var LengthOfArrayLike = require('./LengthOfArrayLike'); var ToString = require('./ToString'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-createlistfromarraylike module.exports = function CreateListFromArrayLike(obj) { var elementTypes = arguments.length > 1 ? arguments[1] : ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object']; if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } if (!IsArray(elementTypes)) { throw new $TypeError('Assertion failed: `elementTypes`, if provided, must be an array'); } var len = LengthOfArrayLike(obj); var list = []; var index = 0; while (index < len) { var indexName = ToString(index); var next = Get(obj, indexName); var nextType = Type(next); if ($indexOf(elementTypes, nextType) < 0) { throw new $TypeError('item type ' + nextType + ' is not a valid elementType'); } $push(list, next); index += 1; } return list; }; es-abstract-1.20.4/2022/CreateMethodProperty.js000066400000000000000000000017231431761430200210460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty module.exports = function CreateMethodProperty(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var newDesc = { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': V, '[[Writable]]': true }; return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, newDesc ); }; es-abstract-1.20.4/2022/CreateNonEnumerableDataPropertyOrThrow.js000066400000000000000000000014211431761430200244720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://262.ecma-international.org/13.0/#sec-createnonenumerabledatapropertyorthrow module.exports = function CreateNonEnumerableDataPropertyOrThrow(O, P, V) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var newDesc = { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': V, '[[Writable]]': true }; return DefinePropertyOrThrow(O, P, newDesc); }; es-abstract-1.20.4/2022/CreateRegExpStringIterator.js000066400000000000000000000071741431761430200221620ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var IteratorPrototype = GetIntrinsic('%IteratorPrototype%', true); var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); var AdvanceStringIndex = require('./AdvanceStringIndex'); var CreateIterResultObject = require('./CreateIterResultObject'); var CreateMethodProperty = require('./CreateMethodProperty'); var Get = require('./Get'); var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); var RegExpExec = require('./RegExpExec'); var Set = require('./Set'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var Type = require('./Type'); var SLOT = require('internal-slot'); var RegExpStringIterator = function RegExpStringIterator(R, S, global, fullUnicode) { if (Type(S) !== 'String') { throw new $TypeError('`S` must be a string'); } if (Type(global) !== 'Boolean') { throw new $TypeError('`global` must be a boolean'); } if (Type(fullUnicode) !== 'Boolean') { throw new $TypeError('`fullUnicode` must be a boolean'); } SLOT.set(this, '[[IteratingRegExp]]', R); SLOT.set(this, '[[IteratedString]]', S); SLOT.set(this, '[[Global]]', global); SLOT.set(this, '[[Unicode]]', fullUnicode); SLOT.set(this, '[[Done]]', false); }; if (IteratorPrototype) { RegExpStringIterator.prototype = OrdinaryObjectCreate(IteratorPrototype); } var RegExpStringIteratorNext = function next() { var O = this; // eslint-disable-line no-invalid-this if (Type(O) !== 'Object') { throw new $TypeError('receiver must be an object'); } if ( !(O instanceof RegExpStringIterator) || !SLOT.has(O, '[[IteratingRegExp]]') || !SLOT.has(O, '[[IteratedString]]') || !SLOT.has(O, '[[Global]]') || !SLOT.has(O, '[[Unicode]]') || !SLOT.has(O, '[[Done]]') ) { throw new $TypeError('"this" value must be a RegExpStringIterator instance'); } if (SLOT.get(O, '[[Done]]')) { return CreateIterResultObject(undefined, true); } var R = SLOT.get(O, '[[IteratingRegExp]]'); var S = SLOT.get(O, '[[IteratedString]]'); var global = SLOT.get(O, '[[Global]]'); var fullUnicode = SLOT.get(O, '[[Unicode]]'); var match = RegExpExec(R, S); if (match === null) { SLOT.set(O, '[[Done]]', true); return CreateIterResultObject(undefined, true); } if (global) { var matchStr = ToString(Get(match, '0')); if (matchStr === '') { var thisIndex = ToLength(Get(R, 'lastIndex')); var nextIndex = AdvanceStringIndex(S, thisIndex, fullUnicode); Set(R, 'lastIndex', nextIndex, true); } return CreateIterResultObject(match, false); } SLOT.set(O, '[[Done]]', true); return CreateIterResultObject(match, false); }; CreateMethodProperty(RegExpStringIterator.prototype, 'next', RegExpStringIteratorNext); if (hasSymbols) { if (Symbol.toStringTag) { if ($defineProperty) { $defineProperty(RegExpStringIterator.prototype, Symbol.toStringTag, { configurable: true, enumerable: false, value: 'RegExp String Iterator', writable: false }); } else { RegExpStringIterator.prototype[Symbol.toStringTag] = 'RegExp String Iterator'; } } if (Symbol.iterator && typeof RegExpStringIterator.prototype[Symbol.iterator] !== 'function') { var iteratorFn = function SymbolIterator() { return this; }; CreateMethodProperty(RegExpStringIterator.prototype, Symbol.iterator, iteratorFn); } } // https://262.ecma-international.org/11.0/#sec-createregexpstringiterator module.exports = function CreateRegExpStringIterator(R, S, global, fullUnicode) { // assert R.global === global && R.unicode === fullUnicode? return new RegExpStringIterator(R, S, global, fullUnicode); }; es-abstract-1.20.4/2022/DateFromTime.js000066400000000000000000000020141431761430200172470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); var MonthFromTime = require('./MonthFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.5 module.exports = function DateFromTime(t) { var m = MonthFromTime(t); var d = DayWithinYear(t); if (m === 0) { return d + 1; } if (m === 1) { return d - 30; } var leap = InLeapYear(t); if (m === 2) { return d - 58 - leap; } if (m === 3) { return d - 89 - leap; } if (m === 4) { return d - 119 - leap; } if (m === 5) { return d - 150 - leap; } if (m === 6) { return d - 180 - leap; } if (m === 7) { return d - 211 - leap; } if (m === 8) { return d - 242 - leap; } if (m === 9) { return d - 272 - leap; } if (m === 10) { return d - 303 - leap; } if (m === 11) { return d - 333 - leap; } throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m); }; es-abstract-1.20.4/2022/DateString.js000066400000000000000000000020371431761430200170000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; var $isNaN = require('../helpers/isNaN'); var padTimeComponent = require('../helpers/padTimeComponent'); var Type = require('./Type'); var WeekDay = require('./WeekDay'); var MonthFromTime = require('./MonthFromTime'); var YearFromTime = require('./YearFromTime'); var DateFromTime = require('./DateFromTime'); // https://262.ecma-international.org/9.0/#sec-datestring module.exports = function DateString(tv) { if (Type(tv) !== 'Number' || $isNaN(tv)) { throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); } var weekday = weekdays[WeekDay(tv)]; var month = months[MonthFromTime(tv)]; var day = padTimeComponent(DateFromTime(tv)); var year = padTimeComponent(YearFromTime(tv), 4); return weekday + '\x20' + month + '\x20' + day + '\x20' + year; }; es-abstract-1.20.4/2022/Day.js000066400000000000000000000003521431761430200154470ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function Day(t) { return floor(t / msPerDay); }; es-abstract-1.20.4/2022/DayFromYear.js000066400000000000000000000004001431761430200171060ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DayFromYear(y) { return (365 * (y - 1970)) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400); }; es-abstract-1.20.4/2022/DayWithinYear.js000066400000000000000000000004361431761430200174560ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var DayFromYear = require('./DayFromYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function DayWithinYear(t) { return Day(t) - DayFromYear(YearFromTime(t)); }; es-abstract-1.20.4/2022/DaysInYear.js000066400000000000000000000004551431761430200167460ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DaysInYear(y) { if (modulo(y, 4) !== 0) { return 365; } if (modulo(y, 100) !== 0) { return 366; } if (modulo(y, 400) !== 0) { return 365; } return 366; }; es-abstract-1.20.4/2022/DefinePropertyOrThrow.js000066400000000000000000000026721431761430200212250ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow module.exports = function DefinePropertyOrThrow(O, P, desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } var Desc = isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, desc) ? desc : ToPropertyDescriptor(desc); if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor'); } return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); }; es-abstract-1.20.4/2022/DeletePropertyOrThrow.js000066400000000000000000000012731431761430200212310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow module.exports = function DeletePropertyOrThrow(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // eslint-disable-next-line no-param-reassign var success = delete O[P]; if (!success) { throw new $TypeError('Attempt to delete property failed.'); } return success; }; es-abstract-1.20.4/2022/EnumerableOwnPropertyNames.js000066400000000000000000000021301431761430200222220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var objectKeys = require('object-keys'); var callBound = require('call-bind/callBound'); var callBind = require('call-bind'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%')); var forEach = require('../helpers/forEach'); var Type = require('./Type'); // https://262.ecma-international.org/8.0/#sec-enumerableownproperties module.exports = function EnumerableOwnPropertyNames(O, kind) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var keys = objectKeys(O); if (kind === 'key') { return keys; } if (kind === 'value' || kind === 'key+value') { var results = []; forEach(keys, function (key) { if ($isEnumerable(O, key)) { $pushApply(results, [ kind === 'value' ? O[key] : [key, O[key]] ]); } }); return results; } throw new $TypeError('Assertion failed: "kind" is not "key", "value", or "key+value": ' + kind); }; es-abstract-1.20.4/2022/FlattenIntoArray.js000066400000000000000000000033301431761430200201570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var Call = require('./Call'); var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var Get = require('./Get'); var HasProperty = require('./HasProperty'); var IsArray = require('./IsArray'); var LengthOfArrayLike = require('./LengthOfArrayLike'); var ToString = require('./ToString'); // https://262.ecma-international.org/11.0/#sec-flattenintoarray // eslint-disable-next-line max-params module.exports = function FlattenIntoArray(target, source, sourceLen, start, depth) { var mapperFunction; if (arguments.length > 5) { mapperFunction = arguments[5]; } var targetIndex = start; var sourceIndex = 0; while (sourceIndex < sourceLen) { var P = ToString(sourceIndex); var exists = HasProperty(source, P); if (exists === true) { var element = Get(source, P); if (typeof mapperFunction !== 'undefined') { if (arguments.length <= 6) { throw new $TypeError('Assertion failed: thisArg is required when mapperFunction is provided'); } element = Call(mapperFunction, arguments[6], [element, sourceIndex, source]); } var shouldFlatten = false; if (depth > 0) { shouldFlatten = IsArray(element); } if (shouldFlatten) { var elementLen = LengthOfArrayLike(element); targetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1); } else { if (targetIndex >= MAX_SAFE_INTEGER) { throw new $TypeError('index too large'); } CreateDataPropertyOrThrow(target, ToString(targetIndex), element); targetIndex += 1; } } sourceIndex += 1; } return targetIndex; }; es-abstract-1.20.4/2022/FromPropertyDescriptor.js000066400000000000000000000007021431761430200214400ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor module.exports = function FromPropertyDescriptor(Desc) { if (typeof Desc !== 'undefined') { assertRecord(Type, 'Property Descriptor', 'Desc', Desc); } return fromPropertyDescriptor(Desc); }; es-abstract-1.20.4/2022/Get.js000066400000000000000000000011321431761430200154460ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var inspect = require('object-inspect'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-get-o-p module.exports = function Get(O, P) { // 7.3.1.1 if (Type(O) !== 'Object') { 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)); } // 7.3.1.3 return O[P]; }; es-abstract-1.20.4/2022/GetIterator.js000066400000000000000000000032701431761430200171650ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $asyncIterator = GetIntrinsic('%Symbol.asyncIterator%', true); var inspect = require('object-inspect'); var hasSymbols = require('has-symbols')(); var getIteratorMethod = require('../helpers/getIteratorMethod'); var AdvanceStringIndex = require('./AdvanceStringIndex'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsArray = require('./IsArray'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-getiterator module.exports = function GetIterator(obj, hint, method) { var actualHint = hint; if (arguments.length < 2) { actualHint = 'sync'; } if (actualHint !== 'sync' && actualHint !== 'async') { throw new $TypeError("Assertion failed: `hint` must be one of 'sync' or 'async', got " + inspect(hint)); } var actualMethod = method; if (arguments.length < 3) { if (actualHint === 'async') { if (hasSymbols && $asyncIterator) { actualMethod = GetMethod(obj, $asyncIterator); } if (actualMethod === undefined) { throw new $TypeError("async from sync iterators aren't currently supported"); } } else { actualMethod = getIteratorMethod( { AdvanceStringIndex: AdvanceStringIndex, GetMethod: GetMethod, IsArray: IsArray }, obj ); } } var iterator = Call(actualMethod, obj); if (Type(iterator) !== 'Object') { throw new $TypeError('iterator must return an object'); } return iterator; // TODO: This should return an IteratorRecord /* var nextMethod = GetV(iterator, 'next'); return { '[[Iterator]]': iterator, '[[NextMethod]]': nextMethod, '[[Done]]': false }; */ }; es-abstract-1.20.4/2022/GetMatchIndexPair.js000066400000000000000000000015271431761430200202370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var assertRecord = require('../helpers/assertRecord'); // https://ecma-international.org/ecma-262/13.0/#sec-getmatchindexpair module.exports = function GetMatchIndexPair(S, match) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } assertRecord(Type, 'Match Record', 'match', match); if (!(match['[[StartIndex]]'] <= S.length)) { throw new $TypeError('`match` [[StartIndex]] must be a non-negative integer <= the length of S'); } if (!(match['[[EndIndex]]'] <= S.length)) { throw new $TypeError('`match` [[EndIndex]] must be an integer between [[StartIndex]] and the length of S, inclusive'); } return [match['[[StartIndex]]'], match['[[EndIndex]]']]; }; es-abstract-1.20.4/2022/GetMatchString.js000066400000000000000000000016051431761430200176170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var substring = require('./substring'); var Type = require('./Type'); var assertRecord = require('../helpers/assertRecord'); // https://ecma-international.org/ecma-262/13.0/#sec-getmatchstring module.exports = function GetMatchString(S, match) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } assertRecord(Type, 'Match Record', 'match', match); if (!(match['[[StartIndex]]'] <= S.length)) { throw new $TypeError('`match` [[StartIndex]] must be a non-negative integer <= the length of S'); } if (!(match['[[EndIndex]]'] <= S.length)) { throw new $TypeError('`match` [[EndIndex]] must be an integer between [[StartIndex]] and the length of S, inclusive'); } return substring(S, match['[[StartIndex]]'], match['[[EndIndex]]']); }; es-abstract-1.20.4/2022/GetMethod.js000066400000000000000000000012271431761430200166140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetV = require('./GetV'); var IsCallable = require('./IsCallable'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-getmethod module.exports = function GetMethod(O, P) { // 7.3.9.1 if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); } // 7.3.9.2 var func = GetV(O, P); // 7.3.9.4 if (func == null) { return void 0; } // 7.3.9.5 if (!IsCallable(func)) { throw new $TypeError(P + 'is not a function'); } // 7.3.9.6 return func; }; es-abstract-1.20.4/2022/GetOwnPropertyKeys.js000066400000000000000000000014751431761430200205450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%', true); var keys = require('object-keys'); var esType = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys module.exports = function GetOwnPropertyKeys(O, Type) { if (esType(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (Type === 'Symbol') { return $gOPS ? $gOPS(O) : []; } if (Type === 'String') { if (!$gOPN) { return keys(O); } return $gOPN(O); } throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`'); }; es-abstract-1.20.4/2022/GetPromiseResolve.js000066400000000000000000000012641431761430200203530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var IsConstructor = require('./IsConstructor'); // https://ecma-international.org/ecma-262/12.0/#sec-getpromiseresolve module.exports = function GetPromiseResolve(promiseConstructor) { if (!IsConstructor(promiseConstructor)) { throw new $TypeError('Assertion failed: `promiseConstructor` must be a constructor'); } var promiseResolve = Get(promiseConstructor, 'resolve'); if (IsCallable(promiseResolve) === false) { throw new $TypeError('`resolve` method is not callable'); } return promiseResolve; }; es-abstract-1.20.4/2022/GetPrototypeFromConstructor.js000066400000000000000000000016311431761430200224720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Function = GetIntrinsic('%Function%'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic if (!IsConstructor(constructor)) { throw new $TypeError('Assertion failed: `constructor` must be a constructor'); } var proto = Get(constructor, 'prototype'); if (Type(proto) !== 'Object') { if (!(constructor instanceof $Function)) { // ignore other realms, for now throw new $TypeError('cross-realm constructors not currently supported'); } proto = intrinsic; } return proto; }; es-abstract-1.20.4/2022/GetStringIndex.js000066400000000000000000000015321431761430200176310ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var StringToCodePoints = require('./StringToCodePoints'); var Type = require('./Type'); var $indexOf = callBound('String.prototype.indexOf'); // https://ecma-international.org/ecma-262/13.0/#sec-getstringindex module.exports = function GetStringIndex(S, e) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsIntegralNumber(e) || e < 0) { throw new $TypeError('Assertion failed: `e` must be a non-negative integer'); } if (S === '') { return 0; } var codepoints = StringToCodePoints(S); var eUTF = e >= codepoints.length ? S.length : $indexOf(S, codepoints[e]); return eUTF; }; es-abstract-1.20.4/2022/GetSubstitution.js000066400000000000000000000105501431761430200201070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var every = require('../helpers/every'); var $charAt = callBound('String.prototype.charAt'); var $strSlice = callBound('String.prototype.slice'); var $indexOf = callBound('String.prototype.indexOf'); var $parseInt = parseInt; var isDigit = regexTester(/^[0-9]$/); var inspect = require('object-inspect'); var Get = require('./Get'); var IsArray = require('./IsArray'); var IsIntegralNumber = require('./IsIntegralNumber'); var ToObject = require('./ToObject'); var ToString = require('./ToString'); var Type = require('./Type'); var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false var isStringOrHole = function (capture, index, arr) { return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined'); }; // http://www.ecma-international.org/ecma-262/12.0/#sec-getsubstitution // eslint-disable-next-line max-statements, max-params, max-lines-per-function module.exports = function GetSubstitution(matched, str, position, captures, namedCaptures, replacement) { if (Type(matched) !== 'String') { throw new $TypeError('Assertion failed: `matched` must be a String'); } var matchLength = matched.length; if (Type(str) !== 'String') { throw new $TypeError('Assertion failed: `str` must be a String'); } var stringLength = str.length; if (!IsIntegralNumber(position) || position < 0 || position > stringLength) { throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position)); } if (!IsArray(captures) || !every(captures, isStringOrHole)) { throw new $TypeError('Assertion failed: `captures` must be a possibly-empty List of Strings, got ' + inspect(captures)); } if (Type(replacement) !== 'String') { throw new $TypeError('Assertion failed: `replacement` must be a String'); } var tailPos = position + matchLength; var m = captures.length; if (Type(namedCaptures) !== 'Undefined') { namedCaptures = ToObject(namedCaptures); // eslint-disable-line no-param-reassign } var result = ''; for (var i = 0; i < replacement.length; i += 1) { // if this is a $, and it's not the end of the replacement var current = $charAt(replacement, i); var isLast = (i + 1) >= replacement.length; var nextIsLast = (i + 2) >= replacement.length; if (current === '$' && !isLast) { var next = $charAt(replacement, i + 1); if (next === '$') { result += '$'; i += 1; } else if (next === '&') { result += matched; i += 1; } else if (next === '`') { result += position === 0 ? '' : $strSlice(str, 0, position - 1); i += 1; } else if (next === "'") { result += tailPos >= stringLength ? '' : $strSlice(str, tailPos); i += 1; } else { var nextNext = nextIsLast ? null : $charAt(replacement, i + 2); if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) { // $1 through $9, and not followed by a digit var n = $parseInt(next, 10); // if (n > m, impl-defined) result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1]; i += 1; } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) { // $00 through $99 var nn = next + nextNext; var nnI = $parseInt(nn, 10) - 1; // if nn === '00' or nn > m, impl-defined result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI]; i += 2; } else if (next === '<') { // eslint-disable-next-line max-depth if (Type(namedCaptures) === 'Undefined') { result += '$<'; i += 2; } else { var endIndex = $indexOf(replacement, '>', i); // eslint-disable-next-line max-depth if (endIndex > -1) { var groupName = $strSlice(replacement, i + '$<'.length, endIndex); var capture = Get(namedCaptures, groupName); // eslint-disable-next-line max-depth if (Type(capture) !== 'Undefined') { result += ToString(capture); } i += ('<' + groupName + '>').length; } } } else { result += '$'; } } } else { // the final $, or else not a $ result += $charAt(replacement, i); } } return result; }; es-abstract-1.20.4/2022/GetV.js000066400000000000000000000007321431761430200156010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var ToObject = require('./ToObject'); // https://ecma-international.org/ecma-262/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'); } // 7.3.2.2-3 var O = ToObject(V); // 7.3.2.4 return O[P]; }; es-abstract-1.20.4/2022/HasOwnProperty.js000066400000000000000000000010511431761430200176730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var has = require('has'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty module.exports = function HasOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return has(O, P); }; es-abstract-1.20.4/2022/HasProperty.js000066400000000000000000000010051431761430200172060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty module.exports = function HasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2022/HourFromTime.js000066400000000000000000000005761431761430200173220ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerHour = timeConstants.msPerHour; var HoursPerDay = timeConstants.HoursPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function HourFromTime(t) { return modulo(floor(t / msPerHour), HoursPerDay); }; es-abstract-1.20.4/2022/InLeapYear.js000066400000000000000000000007761431761430200167350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DaysInYear = require('./DaysInYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function InLeapYear(t) { var days = DaysInYear(YearFromTime(t)); if (days === 365) { return 0; } if (days === 366) { return 1; } throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days); }; es-abstract-1.20.4/2022/InstallErrorCause.js000066400000000000000000000013021431761430200203270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var CreateNonEnumerableDataPropertyOrThrow = require('./CreateNonEnumerableDataPropertyOrThrow'); var Get = require('./Get'); var HasProperty = require('./HasProperty'); var Type = require('./Type'); // https://262.ecma-international.org/13.0/#sec-installerrorcause module.exports = function InstallErrorCause(O, options) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (Type(options) === 'Object' && HasProperty(options, 'cause')) { var cause = Get(options, 'cause'); CreateNonEnumerableDataPropertyOrThrow(O, 'cause', cause); } }; es-abstract-1.20.4/2022/InstanceofOperator.js000066400000000000000000000016261431761430200205440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $hasInstance = GetIntrinsic('Symbol.hasInstance', true); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var OrdinaryHasInstance = require('./OrdinaryHasInstance'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator module.exports = function InstanceofOperator(O, C) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var instOfHandler = $hasInstance ? GetMethod(C, $hasInstance) : void 0; if (typeof instOfHandler !== 'undefined') { return ToBoolean(Call(instOfHandler, C, [O])); } if (!IsCallable(C)) { throw new $TypeError('`C` is not Callable'); } return OrdinaryHasInstance(C, O); }; es-abstract-1.20.4/2022/Invoke.js000066400000000000000000000013131431761430200161630ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var IsArray = require('./IsArray'); var GetV = require('./GetV'); var IsPropertyKey = require('./IsPropertyKey'); // https://ecma-international.org/ecma-262/6.0/#sec-invoke module.exports = function Invoke(O, P) { if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } var argumentsList = arguments.length > 2 ? arguments[2] : []; if (!IsArray(argumentsList)) { throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); } var func = GetV(O, P); return Call(func, O, argumentsList); }; es-abstract-1.20.4/2022/IsAccessorDescriptor.js000066400000000000000000000007211431761430200210270ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor module.exports = function IsAccessorDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { return false; } return true; }; es-abstract-1.20.4/2022/IsArray.js000066400000000000000000000001731431761430200163050ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-isarray module.exports = require('../helpers/IsArray'); es-abstract-1.20.4/2022/IsBigIntElementType.js000066400000000000000000000003021431761430200205510ustar00rootroot00000000000000'use strict'; // https://262.ecma-international.org/11.0/#sec-isbigintelementtype module.exports = function IsBigIntElementType(type) { return type === 'BigUint64' || type === 'BigInt64'; }; es-abstract-1.20.4/2022/IsCallable.js000066400000000000000000000001541431761430200167250ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.11 module.exports = require('is-callable'); es-abstract-1.20.4/2022/IsCompatiblePropertyDescriptor.js000066400000000000000000000005511431761430200231120ustar00rootroot00000000000000'use strict'; var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://262.ecma-international.org/13.0/#sec-iscompatiblepropertydescriptor module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { return ValidateAndApplyPropertyDescriptor(undefined, '', Extensible, Desc, Current); }; es-abstract-1.20.4/2022/IsConcatSpreadable.js000066400000000000000000000011621431761430200204200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true); var Get = require('./Get'); var IsArray = require('./IsArray'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable module.exports = function IsConcatSpreadable(O) { if (Type(O) !== 'Object') { return false; } if ($isConcatSpreadable) { var spreadable = Get(O, $isConcatSpreadable); if (typeof spreadable !== 'undefined') { return ToBoolean(spreadable); } } return IsArray(O); }; es-abstract-1.20.4/2022/IsConstructor.js000066400000000000000000000021751431761430200175600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('../GetIntrinsic.js'); var $construct = GetIntrinsic('%Reflect.construct%', true); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); try { DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} }); } catch (e) { // Accessor properties aren't supported DefinePropertyOrThrow = null; } // https://ecma-international.org/ecma-262/6.0/#sec-isconstructor if (DefinePropertyOrThrow && $construct) { var isConstructorMarker = {}; var badArrayLike = {}; DefinePropertyOrThrow(badArrayLike, 'length', { '[[Get]]': function () { throw isConstructorMarker; }, '[[Enumerable]]': true }); module.exports = function IsConstructor(argument) { try { // `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`: $construct(argument, badArrayLike); } catch (err) { return err === isConstructorMarker; } }; } else { module.exports = function IsConstructor(argument) { // unfortunately there's no way to truly check this without try/catch `new argument` in old environments return typeof argument === 'function' && !!argument.prototype; }; } es-abstract-1.20.4/2022/IsDataDescriptor.js000066400000000000000000000007201431761430200201350ustar00rootroot00000000000000'use strict'; var has = require('has'); var assertRecord = require('../helpers/assertRecord'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor module.exports = function IsDataDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { return false; } return true; }; es-abstract-1.20.4/2022/IsExtensible.js000066400000000000000000000007751431761430200173410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $isExtensible = GetIntrinsic('%Object.isExtensible%', true); var isPrimitive = require('../helpers/isPrimitive'); // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o module.exports = $preventExtensions ? function IsExtensible(obj) { return !isPrimitive(obj) && $isExtensible(obj); } : function IsExtensible(obj) { return !isPrimitive(obj); }; es-abstract-1.20.4/2022/IsGenericDescriptor.js000066400000000000000000000010601431761430200206360ustar00rootroot00000000000000'use strict'; var assertRecord = require('../helpers/assertRecord'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor module.exports = function IsGenericDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) { return true; } return false; }; es-abstract-1.20.4/2022/IsIntegralNumber.js000066400000000000000000000007311431761430200201450ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var Type = require('./Type'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); // https://tc39.es/ecma262/#sec-isintegralnumber module.exports = function IsIntegralNumber(argument) { if (Type(argument) !== 'Number' || $isNaN(argument) || !$isFinite(argument)) { return false; } var absValue = abs(argument); return floor(absValue) === absValue; }; es-abstract-1.20.4/2022/IsLessThan.js000066400000000000000000000047611431761430200167570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var IsStringPrefix = require('./IsStringPrefix'); var StringToBigInt = require('./StringToBigInt'); var ToNumeric = require('./ToNumeric'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); var BigIntLessThan = require('./BigInt/lessThan'); var NumberLessThan = require('./Number/lessThan'); // https://262.ecma-international.org/13.0/#sec-islessthan // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function IsLessThan(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); } var px; var py; if (LeftFirst) { px = ToPrimitive(x, $Number); py = ToPrimitive(y, $Number); } else { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } var pxType = Type(px); var pyType = Type(py); if (pxType === 'String' && pyType === 'String') { if (IsStringPrefix(py, px)) { return false; } if (IsStringPrefix(px, py)) { return true; } /* c. Let k be the smallest non-negative integer such that the code unit at index k within px is different from the code unit at index k within py. (There must be such a k, for neither String is a prefix of the other.) d. Let m be the integer that is the numeric value of the code unit at index k within px. e. Let n be the integer that is the numeric value of the code unit at index k within py. f. If m < n, return true. Otherwise, return false. */ return px < py; // both strings, neither a prefix of the other. shortcut for steps 3 c-f } var nx; var ny; if (pxType === 'BigInt' && pyType === 'String') { ny = StringToBigInt(py); if ($isNaN(ny)) { return void undefined; } return BigIntLessThan(px, ny); } if (pxType === 'String' && pyType === 'BigInt') { nx = StringToBigInt(px); if ($isNaN(nx)) { return void undefined; } return BigIntLessThan(nx, py); } nx = ToNumeric(px); ny = ToNumeric(py); var nxType = Type(nx); if (nxType === Type(ny)) { return nxType === 'Number' ? NumberLessThan(nx, ny) : BigIntLessThan(nx, ny); } if ($isNaN(nx) || $isNaN(ny)) { return void undefined; } if (nx === -Infinity || ny === Infinity) { return true; } if (nx === Infinity || ny === -Infinity) { return false; } return nx < ny; // by now, these are both nonzero, finite, and not equal }; es-abstract-1.20.4/2022/IsLooselyEqual.js000066400000000000000000000033061431761430200176460ustar00rootroot00000000000000'use strict'; var isFinite = require('../helpers/isFinite'); var isNaN = require('../helpers/isNaN'); var IsStrictlyEqual = require('./IsStrictlyEqual'); var StringToBigInt = require('./StringToBigInt'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://262.ecma-international.org/13.0/#sec-islooselyequal module.exports = function IsLooselyEqual(x, y) { var xType = Type(x); var yType = Type(y); if (xType === yType) { return IsStrictlyEqual(x, y); } if (x == null && y == null) { return true; } if (xType === 'Number' && yType === 'String') { return IsLooselyEqual(x, ToNumber(y)); } if (xType === 'String' && yType === 'Number') { return IsLooselyEqual(ToNumber(x), y); } if (xType === 'BigInt' && yType === 'String') { var n = StringToBigInt(y); if (isNaN(n)) { return false; } return IsLooselyEqual(x, n); } if (xType === 'String' && yType === 'BigInt') { return IsLooselyEqual(y, x); } if (xType === 'Boolean') { return IsLooselyEqual(ToNumber(x), y); } if (yType === 'Boolean') { return IsLooselyEqual(x, ToNumber(y)); } if ((xType === 'String' || xType === 'Number' || xType === 'Symbol' || xType === 'BigInt') && yType === 'Object') { return IsLooselyEqual(x, ToPrimitive(y)); } if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol' || yType === 'BigInt')) { return IsLooselyEqual(ToPrimitive(x), y); } if ((xType === 'BigInt' && yType === 'Number') || (xType === 'Number' && yType === 'BigInt')) { if (!isFinite(x) || !isFinite(y)) { return false; } // eslint-disable-next-line eqeqeq return x == y; // shortcut for step 13.b. } return false; }; es-abstract-1.20.4/2022/IsNoTearConfiguration.js000066400000000000000000000007231431761430200211500ustar00rootroot00000000000000'use strict'; var IsUnclampedIntegerElementType = require('./IsUnclampedIntegerElementType'); var IsBigIntElementType = require('./IsBigIntElementType'); // https://262.ecma-international.org/11.0/#sec-isnotearconfiguration module.exports = function IsNoTearConfiguration(type, order) { if (IsUnclampedIntegerElementType(type)) { return true; } if (IsBigIntElementType(type) && order !== 'Init' && order !== 'Unordered') { return true; } return false; }; es-abstract-1.20.4/2022/IsPromise.js000066400000000000000000000007451431761430200166520ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $PromiseThen = callBound('Promise.prototype.then', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ispromise module.exports = function IsPromise(x) { if (Type(x) !== 'Object') { return false; } if (!$PromiseThen) { // Promises are not supported return false; } try { $PromiseThen(x); // throws if not a promise } catch (e) { return false; } return true; }; es-abstract-1.20.4/2022/IsPropertyKey.js000066400000000000000000000003171431761430200175240ustar00rootroot00000000000000'use strict'; // https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey module.exports = function IsPropertyKey(argument) { return typeof argument === 'string' || typeof argument === 'symbol'; }; es-abstract-1.20.4/2022/IsRegExp.js000066400000000000000000000010411431761430200164140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $match = GetIntrinsic('%Symbol.match%', true); var hasRegExpMatcher = require('is-regex'); var ToBoolean = require('./ToBoolean'); // https://ecma-international.org/ecma-262/6.0/#sec-isregexp module.exports = function IsRegExp(argument) { if (!argument || typeof argument !== 'object') { return false; } if ($match) { var isRegExp = argument[$match]; if (typeof isRegExp !== 'undefined') { return ToBoolean(isRegExp); } } return hasRegExpMatcher(argument); }; es-abstract-1.20.4/2022/IsSharedArrayBuffer.js000066400000000000000000000007151431761430200205700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var isSharedArrayBuffer = require('is-shared-array-buffer'); // https://262.ecma-international.org/8.0/#sec-issharedarraybuffer module.exports = function IsSharedArrayBuffer(obj) { if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } return isSharedArrayBuffer(obj); }; es-abstract-1.20.4/2022/IsStrictlyEqual.js000066400000000000000000000010551431761430200200340ustar00rootroot00000000000000'use strict'; var SameValueNonNumeric = require('./SameValueNonNumeric'); var Type = require('./Type'); var BigIntEqual = require('./BigInt/equal'); var NumberEqual = require('./Number/equal'); // https://262.ecma-international.org/13.0/#sec-isstrictlyequal module.exports = function IsStrictlyEqual(x, y) { var xType = Type(x); var yType = Type(y); if (xType !== yType) { return false; } if (xType === 'Number' || xType === 'BigInt') { return xType === 'Number' ? NumberEqual(x, y) : BigIntEqual(x, y); } return SameValueNonNumeric(x, y); }; es-abstract-1.20.4/2022/IsStringPrefix.js000066400000000000000000000010331431761430200176470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var StringIndexOf = require('./StringIndexOf'); var Type = require('./Type'); // https://262.ecma-international.org/13.0/#sec-isstringprefix module.exports = function IsStringPrefix(p, q) { if (Type(p) !== 'String') { throw new $TypeError('Assertion failed: "p" must be a String'); } if (Type(q) !== 'String') { throw new $TypeError('Assertion failed: "q" must be a String'); } return StringIndexOf(q, p, 0) === 0; }; es-abstract-1.20.4/2022/IsStringWellFormedUnicode.js000066400000000000000000000013141431761430200217630ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var CodePointAt = require('./CodePointAt'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); // https://262.ecma-international.org/13.0/#sec-isstringwellformedunicode module.exports = function IsStringWellFormedUnicode(string) { if (Type(string) !== 'String') { throw new $TypeError('Assertion failed: `string` must be a String'); } var strLen = string.length; // step 1 var k = 0; // step 2 while (k !== strLen) { // step 3 var cp = CodePointAt(string, k); // step 3.a if (cp['[[IsUnpairedSurrogate]]']) { return false; // step 3.b } k += cp['[[CodeUnitCount]]']; // step 3.c } return true; // step 4 }; es-abstract-1.20.4/2022/IsUnclampedIntegerElementType.js000066400000000000000000000004521431761430200226310ustar00rootroot00000000000000'use strict'; // https://262.ecma-international.org/11.0/#sec-isunclampedintegerelementtype module.exports = function IsUnclampedIntegerElementType(type) { return type === 'Int8' || type === 'Uint8' || type === 'Int16' || type === 'Uint16' || type === 'Int32' || type === 'Uint32'; }; es-abstract-1.20.4/2022/IsUnsignedElementType.js000066400000000000000000000004121431761430200211530ustar00rootroot00000000000000'use strict'; // https://262.ecma-international.org/11.0/#sec-isunsignedelementtype module.exports = function IsUnsignedElementType(type) { return type === 'Uint8' || type === 'Uint8C' || type === 'Uint16' || type === 'Uint32' || type === 'BigUint64'; }; es-abstract-1.20.4/2022/IterableToList.js000066400000000000000000000013211431761430200176150ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $arrayPush = callBound('Array.prototype.push'); var GetIterator = require('./GetIterator'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); // https://262.ecma-international.org/12.0/#sec-iterabletolist module.exports = function IterableToList(items) { var iterator; if (arguments.length > 1) { iterator = GetIterator(items, 'sync', arguments[1]); } else { iterator = GetIterator(items, 'sync'); } var values = []; var next = true; while (next) { next = IteratorStep(iterator); if (next) { var nextValue = IteratorValue(next); $arrayPush(values, nextValue); } } return values; }; es-abstract-1.20.4/2022/IteratorClose.js000066400000000000000000000027111431761430200175120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var GetMethod = require('./GetMethod'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose module.exports = function IteratorClose(iterator, completion) { if (Type(iterator) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterator) is not Object'); } if (!IsCallable(completion)) { throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record'); } var completionThunk = completion; var iteratorReturn = GetMethod(iterator, 'return'); if (typeof iteratorReturn === 'undefined') { return completionThunk(); } var completionRecord; try { var innerResult = Call(iteratorReturn, iterator, []); } catch (e) { // if we hit here, then "e" is the innerResult completion that needs re-throwing // if the completion is of type "throw", this will throw. completionThunk(); completionThunk = null; // ensure it's not called twice. // if not, then return the innerResult completion throw e; } completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does completionThunk = null; // ensure it's not called twice. if (Type(innerResult) !== 'Object') { throw new $TypeError('iterator .return must return an object'); } return completionRecord; }; es-abstract-1.20.4/2022/IteratorComplete.js000066400000000000000000000007621431761430200202210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToBoolean = require('./ToBoolean'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete module.exports = function IteratorComplete(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return ToBoolean(Get(iterResult, 'done')); }; es-abstract-1.20.4/2022/IteratorNext.js000066400000000000000000000007551431761430200173710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Invoke = require('./Invoke'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext module.exports = function IteratorNext(iterator, value) { var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]); if (Type(result) !== 'Object') { throw new $TypeError('iterator next must return an object'); } return result; }; es-abstract-1.20.4/2022/IteratorStep.js000066400000000000000000000005411431761430200173570ustar00rootroot00000000000000'use strict'; var IteratorComplete = require('./IteratorComplete'); var IteratorNext = require('./IteratorNext'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep module.exports = function IteratorStep(iterator) { var result = IteratorNext(iterator); var done = IteratorComplete(result); return done === true ? false : result; }; es-abstract-1.20.4/2022/IteratorValue.js000066400000000000000000000006731431761430200175260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue module.exports = function IteratorValue(iterResult) { if (Type(iterResult) !== 'Object') { throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); } return Get(iterResult, 'value'); }; es-abstract-1.20.4/2022/LengthOfArrayLike.js000066400000000000000000000007571431761430200202550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var ToLength = require('./ToLength'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-lengthofarraylike module.exports = function LengthOfArrayLike(obj) { if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: `obj` must be an Object'); } return ToLength(Get(obj, 'length')); }; // TODO: use this all over es-abstract-1.20.4/2022/MakeDate.js000066400000000000000000000005101431761430200164010ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.13 module.exports = function MakeDate(day, time) { if (!$isFinite(day) || !$isFinite(time)) { return NaN; } return (day * msPerDay) + time; }; es-abstract-1.20.4/2022/MakeDay.js000066400000000000000000000017641431761430200162550ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $DateUTC = GetIntrinsic('%Date.UTC%'); var $isFinite = require('../helpers/isFinite'); var DateFromTime = require('./DateFromTime'); var Day = require('./Day'); var floor = require('./floor'); var modulo = require('./modulo'); var MonthFromTime = require('./MonthFromTime'); var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); var YearFromTime = require('./YearFromTime'); // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.12 module.exports = function MakeDay(year, month, date) { if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { return NaN; } var y = ToIntegerOrInfinity(year); var m = ToIntegerOrInfinity(month); var dt = ToIntegerOrInfinity(date); var ym = y + floor(m / 12); if (!$isFinite(ym)) { return NaN; } var mn = modulo(m, 12); var t = $DateUTC(ym, mn, 1); if (YearFromTime(t) !== ym || MonthFromTime(t) !== mn || DateFromTime(t) !== 1) { return NaN; } return Day(t) + dt - 1; }; es-abstract-1.20.4/2022/MakeMatchIndicesIndexPairArray.js000066400000000000000000000053001431761430200226640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ArrayCreate = require('./ArrayCreate'); var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); var GetMatchIndexPair = require('./GetMatchIndexPair'); var IsArray = require('./IsArray'); var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); var ToString = require('./ToString'); var Type = require('./Type'); var every = require('../helpers/every'); var isMatchRecord = require('../helpers/isMatchRecord'); var isStringOrUndefined = function isStringOrUndefined(s) { return typeof s === 'undefined' || typeof s === 'string'; }; var isMatchRecordOrUndefined = function isMatchRecordOrUndefined(m) { return typeof m === 'undefined' || isMatchRecord(m); }; var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; // https://ecma-international.org/ecma-262/13.0/#sec-getmatchindexpair module.exports = function MakeMatchIndicesIndexPairArray(S, indices, groupNames, hasGroups) { if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } if (!IsArray(indices) || !every(indices, isMatchRecordOrUndefined)) { throw new $TypeError('Assertion failed: `indices` must be a List of either Match Records or `undefined`'); } if (!IsArray(groupNames) || !every(groupNames, isStringOrUndefined)) { throw new $TypeError('Assertion failed: `groupNames` must be a List of either Strings or `undefined`'); } if (Type(hasGroups) !== 'Boolean') { throw new $TypeError('Assertion failed: `hasGroups` must be a Boolean'); } var n = indices.length; // step 1 if (!(n < MAX_ARRAY_LENGTH)) { throw new $TypeError('Assertion failed: `indices` length must be less than the max array size, 2**32 - 1'); } if (groupNames.length !== n - 1) { throw new $TypeError('Assertion failed: `groupNames` must have exactly one fewer item than `indices`'); } var A = ArrayCreate(n); // step 5 var groups = hasGroups ? OrdinaryObjectCreate(null) : void undefined; // step 6-7 CreateDataPropertyOrThrow(A, 'groups', groups); // step 8 for (var i = 0; i < n; i += 1) { // step 9 var matchIndices = indices[i]; // step 9.a // eslint-disable-next-line no-negated-condition var matchIndexPair = typeof matchIndices !== 'undefined' ? GetMatchIndexPair(S, matchIndices) : void undefined; // step 9.b-9.c CreateDataPropertyOrThrow(A, ToString(i), matchIndexPair); // step 9.d if (i > 0 && typeof groupNames[i - 1] !== 'undefined') { // step 9.e if (!groups) { throw new $TypeError('if `hasGroups` is `false`, `groupNames` can only contain `undefined` values'); } CreateDataPropertyOrThrow(groups, groupNames[i - 1], matchIndexPair); // step 9.e.i } } return A; // step 10 }; es-abstract-1.20.4/2022/MakeTime.js000066400000000000000000000013731431761430200164320ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var msPerMinute = timeConstants.msPerMinute; var msPerHour = timeConstants.msPerHour; var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.11 module.exports = function MakeTime(hour, min, sec, ms) { if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { return NaN; } var h = ToIntegerOrInfinity(hour); var m = ToIntegerOrInfinity(min); var s = ToIntegerOrInfinity(sec); var milli = ToIntegerOrInfinity(ms); var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; return t; }; es-abstract-1.20.4/2022/MinFromTime.js000066400000000000000000000006141431761430200171210ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerMinute = timeConstants.msPerMinute; var MinutesPerHour = timeConstants.MinutesPerHour; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function MinFromTime(t) { return modulo(floor(t / msPerMinute), MinutesPerHour); }; es-abstract-1.20.4/2022/MonthFromTime.js000066400000000000000000000017661431761430200174740ustar00rootroot00000000000000'use strict'; var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function MonthFromTime(t) { var day = DayWithinYear(t); if (0 <= day && day < 31) { return 0; } var leap = InLeapYear(t); if (31 <= day && day < (59 + leap)) { return 1; } if ((59 + leap) <= day && day < (90 + leap)) { return 2; } if ((90 + leap) <= day && day < (120 + leap)) { return 3; } if ((120 + leap) <= day && day < (151 + leap)) { return 4; } if ((151 + leap) <= day && day < (181 + leap)) { return 5; } if ((181 + leap) <= day && day < (212 + leap)) { return 6; } if ((212 + leap) <= day && day < (243 + leap)) { return 7; } if ((243 + leap) <= day && day < (273 + leap)) { return 8; } if ((273 + leap) <= day && day < (304 + leap)) { return 9; } if ((304 + leap) <= day && day < (334 + leap)) { return 10; } if ((334 + leap) <= day && day < (365 + leap)) { return 11; } }; es-abstract-1.20.4/2022/Number/000077500000000000000000000000001431761430200156245ustar00rootroot00000000000000es-abstract-1.20.4/2022/Number/add.js000066400000000000000000000015531431761430200167160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isFinite = require('../../helpers/isFinite'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-add module.exports = function NumberAdd(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y) || (x === Infinity && y === -Infinity) || (x === -Infinity && y === Infinity)) { return NaN; } if (!isFinite(x)) { return x; } if (!isFinite(y)) { return y; } if (x === y && x === 0) { // both zeroes return Infinity / x === -Infinity && Infinity / y === -Infinity ? -0 : +0; } // shortcut for the actual spec mechanics return x + y; }; es-abstract-1.20.4/2022/Number/bitwiseAND.js000066400000000000000000000007671431761430200201650ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var NumberBitwiseOp = require('../NumberBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseAND module.exports = function NumberBitwiseAND(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberBitwiseOp('&', x, y); }; es-abstract-1.20.4/2022/Number/bitwiseNOT.js000066400000000000000000000011021431761430200202030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseNOT module.exports = function NumberBitwiseNOT(x) { if (Type(x) !== 'Number') { throw new $TypeError('Assertion failed: `x` argument must be a Number'); } var oldValue = ToInt32(x); // Return the result of applying the bitwise operator op to lnum and rnum. The result is a signed 32-bit integer. return ~oldValue; }; es-abstract-1.20.4/2022/Number/bitwiseOR.js000066400000000000000000000007651431761430200201010ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var NumberBitwiseOp = require('../NumberBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseOR module.exports = function NumberBitwiseOR(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberBitwiseOp('|', x, y); }; es-abstract-1.20.4/2022/Number/bitwiseXOR.js000066400000000000000000000007671431761430200202330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var NumberBitwiseOp = require('../NumberBitwiseOp'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseXOR module.exports = function NumberBitwiseXOR(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberBitwiseOp('^', x, y); }; es-abstract-1.20.4/2022/Number/divide.js000066400000000000000000000011761431761430200174330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isFinite = require('../../helpers/isFinite'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-divide module.exports = function NumberDivide(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y) || (!isFinite(x) && !isFinite(y))) { return NaN; } // shortcut for the actual spec mechanics return x / y; }; es-abstract-1.20.4/2022/Number/equal.js000066400000000000000000000010541431761430200172710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-equal module.exports = function NumberEqual(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y)) { return false; } // shortcut for the actual spec mechanics return x === y; }; es-abstract-1.20.4/2022/Number/exponentiate.js000066400000000000000000000033641431761430200206730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); // var isNegativeZero = require('is-negative-zero'); var $pow = GetIntrinsic('%Math.pow%'); var $TypeError = GetIntrinsic('%TypeError%'); /* var abs = require('../../helpers/abs'); var isFinite = require('../../helpers/isFinite'); var isNaN = require('../../helpers/isNaN'); var IsInteger = require('../IsInteger'); */ var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-exponentiate /* eslint max-lines-per-function: 0, max-statements: 0 */ module.exports = function NumberExponentiate(base, exponent) { if (Type(base) !== 'Number' || Type(exponent) !== 'Number') { throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be Numbers'); } return $pow(base, exponent); /* if (isNaN(exponent)) { return NaN; } if (exponent === 0) { return 1; } if (isNaN(base)) { return NaN; } var aB = abs(base); if (aB > 1 && exponent === Infinity) { return Infinity; } if (aB > 1 && exponent === -Infinity) { return 0; } if (aB === 1 && (exponent === Infinity || exponent === -Infinity)) { return NaN; } if (aB < 1 && exponent === Infinity) { return +0; } if (aB < 1 && exponent === -Infinity) { return Infinity; } if (base === Infinity) { return exponent > 0 ? Infinity : 0; } if (base === -Infinity) { var isOdd = true; if (exponent > 0) { return isOdd ? -Infinity : Infinity; } return isOdd ? -0 : 0; } if (exponent > 0) { return isNegativeZero(base) ? Infinity : 0; } if (isNegativeZero(base)) { if (exponent > 0) { return isOdd ? -0 : 0; } return isOdd ? -Infinity : Infinity; } if (base < 0 && isFinite(base) && isFinite(exponent) && !IsInteger(exponent)) { return NaN; } */ }; es-abstract-1.20.4/2022/Number/index.js000066400000000000000000000023721431761430200172750ustar00rootroot00000000000000'use strict'; var add = require('./add'); var bitwiseAND = require('./bitwiseAND'); var bitwiseNOT = require('./bitwiseNOT'); var bitwiseOR = require('./bitwiseOR'); var bitwiseXOR = require('./bitwiseXOR'); var divide = require('./divide'); var equal = require('./equal'); var exponentiate = require('./exponentiate'); var leftShift = require('./leftShift'); var lessThan = require('./lessThan'); var multiply = require('./multiply'); var remainder = require('./remainder'); var sameValue = require('./sameValue'); var sameValueZero = require('./sameValueZero'); var signedRightShift = require('./signedRightShift'); var subtract = require('./subtract'); var toString = require('./toString'); var unaryMinus = require('./unaryMinus'); var unsignedRightShift = require('./unsignedRightShift'); module.exports = { add: add, bitwiseAND: bitwiseAND, bitwiseNOT: bitwiseNOT, bitwiseOR: bitwiseOR, bitwiseXOR: bitwiseXOR, divide: divide, equal: equal, exponentiate: exponentiate, leftShift: leftShift, lessThan: lessThan, multiply: multiply, remainder: remainder, sameValue: sameValue, sameValueZero: sameValueZero, signedRightShift: signedRightShift, subtract: subtract, toString: toString, unaryMinus: unaryMinus, unsignedRightShift: unsignedRightShift }; es-abstract-1.20.4/2022/Number/leftShift.js000066400000000000000000000011771431761430200201200ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var ToUint32 = require('../ToUint32'); var modulo = require('../modulo'); var Type = require('../Type'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-leftShift module.exports = function NumberLeftShift(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); var shiftCount = modulo(rnum, 32); return lnum << shiftCount; }; es-abstract-1.20.4/2022/Number/lessThan.js000066400000000000000000000012021431761430200177360ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-lessThan module.exports = function NumberLessThan(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } // If x is NaN, return undefined. // If y is NaN, return undefined. if (isNaN(x) || isNaN(y)) { return void undefined; } // shortcut for the actual spec mechanics return x < y; }; es-abstract-1.20.4/2022/Number/multiply.js000066400000000000000000000015201431761430200200370ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-multiply module.exports = function NumberMultiply(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (isNaN(x) || isNaN(y) || (x === 0 && !isFinite(y)) || (!isFinite(x) && y === 0)) { return NaN; } if (!isFinite(x) && !isFinite(y)) { return x === y ? Infinity : -Infinity; } if (!isFinite(x) && y !== 0) { return x > 0 ? Infinity : -Infinity; } if (!isFinite(y) && x !== 0) { return y > 0 ? Infinity : -Infinity; } // shortcut for the actual spec mechanics return x * y; }; es-abstract-1.20.4/2022/Number/remainder.js000066400000000000000000000020031431761430200201230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-remainder module.exports = function NumberRemainder(n, d) { if (Type(n) !== 'Number' || Type(d) !== 'Number') { throw new $TypeError('Assertion failed: `n` and `d` arguments must be Numbers'); } // If either operand is NaN, the result is NaN. // If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN. if (isNaN(n) || isNaN(d) || !isFinite(n) || d === 0) { return NaN; } // If the dividend is finite and the divisor is an infinity, the result equals the dividend. // If the dividend is a zero and the divisor is nonzero and finite, the result is the same as the dividend. if (!isFinite(d) || n === 0) { return n; } // In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved… return n % d; }; es-abstract-1.20.4/2022/Number/sameValue.js000066400000000000000000000011701431761430200201030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var isNegativeZero = require('is-negative-zero'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var NumberSameValueZero = require('./sameValueZero'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValue module.exports = function NumberSameValue(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } if (x === 0 && y === 0) { return !(isNegativeZero(x) ^ isNegativeZero(y)); } return NumberSameValueZero(x, y); }; es-abstract-1.20.4/2022/Number/sameValueZero.js000066400000000000000000000010771431761430200207510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValueZero module.exports = function NumberSameValueZero(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var xNaN = isNaN(x); var yNaN = isNaN(y); if (xNaN || yNaN) { return xNaN === yNaN; } return x === y; }; es-abstract-1.20.4/2022/Number/signedRightShift.js000066400000000000000000000012151431761430200214260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var ToUint32 = require('../ToUint32'); var modulo = require('../modulo'); var Type = require('../Type'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-signedRightShift module.exports = function NumberSignedRightShift(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); var shiftCount = modulo(rnum, 32); return lnum >> shiftCount; }; es-abstract-1.20.4/2022/Number/subtract.js000066400000000000000000000010301431761430200200030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); var NumberAdd = require('./add'); var NumberUnaryMinus = require('./unaryMinus'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-subtract module.exports = function NumberSubtract(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } return NumberAdd(x, NumberUnaryMinus(y)); }; es-abstract-1.20.4/2022/Number/toString.js000066400000000000000000000006531431761430200177770ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-tostring module.exports = function NumberToString(x) { if (Type(x) !== 'Number') { throw new $TypeError('Assertion failed: `x` must be a Number'); } return $String(x); }; es-abstract-1.20.4/2022/Number/unaryMinus.js000066400000000000000000000007261431761430200203410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var isNaN = require('../../helpers/isNaN'); var Type = require('../Type'); // https://262.ecma-international.org/11.0/#sec-numeric-types-number-unaryMinus module.exports = function NumberUnaryMinus(x) { if (Type(x) !== 'Number') { throw new $TypeError('Assertion failed: `x` argument must be a Number'); } if (isNaN(x)) { return NaN; } return -x; }; es-abstract-1.20.4/2022/Number/unsignedRightShift.js000066400000000000000000000012221431761430200217670ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('../ToInt32'); var ToUint32 = require('../ToUint32'); var modulo = require('../modulo'); var Type = require('../Type'); // https://262.ecma-international.org/12.0/#sec-numeric-types-number-unsignedRightShift module.exports = function NumberUnsignedRightShift(x, y) { if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); var shiftCount = modulo(rnum, 32); return lnum >>> shiftCount; }; es-abstract-1.20.4/2022/NumberBitwiseOp.js000066400000000000000000000013651431761430200200150ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var ToInt32 = require('./ToInt32'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-numberbitwiseop module.exports = function NumberBitwiseOp(op, x, y) { if (op !== '&' && op !== '|' && op !== '^') { throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`'); } if (Type(x) !== 'Number' || Type(y) !== 'Number') { throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); } var lnum = ToInt32(x); var rnum = ToUint32(y); if (op === '&') { return lnum & rnum; } if (op === '|') { return lnum | rnum; } return lnum ^ rnum; }; es-abstract-1.20.4/2022/NumberToBigInt.js000066400000000000000000000012621431761430200175630ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-numbertobigint module.exports = function NumberToBigInt(number) { if (Type(number) !== 'Number') { throw new $TypeError('Assertion failed: `number` must be a String'); } if (!IsIntegralNumber(number)) { throw new $RangeError('The number ' + number + ' cannot be converted to a BigInt because it is not an integer'); } return $BigInt(number); }; es-abstract-1.20.4/2022/ObjectDefineProperties.js000066400000000000000000000027441431761430200213370ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var Get = require('./Get'); var ToObject = require('./ToObject'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var forEach = require('../helpers/forEach'); var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var $push = callBound('Array.prototype.push'); // https://262.ecma-international.org/6.0/#sec-objectdefineproperties module.exports = function ObjectDefineProperties(O, Properties) { var props = ToObject(Properties); // step 1 var keys = OwnPropertyKeys(props); // step 2 var descriptors = []; // step 3 forEach(keys, function (nextKey) { // step 4 var propDesc = ToPropertyDescriptor(getOwnPropertyDescriptor(props, nextKey)); // step 4.a if (typeof propDesc !== 'undefined' && propDesc['[[Enumerable]]']) { // step 4.b var descObj = Get(props, nextKey); // step 4.b.i var desc = ToPropertyDescriptor(descObj); // step 4.b.ii $push(descriptors, [nextKey, desc]); // step 4.b.iii } }); forEach(descriptors, function (pair) { // step 5 var P = pair[0]; // step 5.a var desc = pair[1]; // step 5.b desc = FromPropertyDescriptor(desc); // TODO: remove this once DefinePropertyOrThrow is fixed DefinePropertyOrThrow(O, P, desc); // step 5.c }); return O; // step 6 }; es-abstract-1.20.4/2022/OrdinaryCreateFromConstructor.js000066400000000000000000000014731431761430200227440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor'); var IsArray = require('./IsArray'); var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); // https://262.ecma-international.org/6.0/#sec-ordinarycreatefromconstructor module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto); var slots = arguments.length < 3 ? [] : arguments[2]; if (!IsArray(slots)) { throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List'); } return OrdinaryObjectCreate(proto, slots); }; es-abstract-1.20.4/2022/OrdinaryDefineOwnProperty.js000066400000000000000000000045261431761430200220740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var IsPropertyKey = require('./IsPropertyKey'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var SameValue = require('./SameValue'); var Type = require('./Type'); var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!$gOPD) { // ES3/IE 8 fallback if (IsAccessorDescriptor(Desc)) { throw new $SyntaxError('This environment does not support accessor property descriptors.'); } var creatingNormalDataProperty = !(P in O) && Desc['[[Writable]]'] && Desc['[[Enumerable]]'] && Desc['[[Configurable]]'] && '[[Value]]' in Desc; var settingExistingDataProperty = (P in O) && (!('[[Configurable]]' in Desc) || Desc['[[Configurable]]']) && (!('[[Enumerable]]' in Desc) || Desc['[[Enumerable]]']) && (!('[[Writable]]' in Desc) || Desc['[[Writable]]']) && '[[Value]]' in Desc; if (creatingNormalDataProperty || settingExistingDataProperty) { O[P] = Desc['[[Value]]']; // eslint-disable-line no-param-reassign return SameValue(O[P], Desc['[[Value]]']); } throw new $SyntaxError('This environment does not support defining non-writable, non-enumerable, or non-configurable properties'); } var desc = $gOPD(O, P); var current = desc && ToPropertyDescriptor(desc); var extensible = IsExtensible(O); return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current); }; es-abstract-1.20.4/2022/OrdinaryGetOwnProperty.js000066400000000000000000000023511431761430200214130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var has = require('has'); var IsArray = require('./IsArray'); var IsPropertyKey = require('./IsPropertyKey'); var IsRegExp = require('./IsRegExp'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty module.exports = function OrdinaryGetOwnProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (!has(O, P)) { return void 0; } if (!$gOPD) { // ES3 / IE 8 fallback var arrayLength = IsArray(O) && P === 'length'; var regexLastIndex = IsRegExp(O) && P === 'lastIndex'; return { '[[Configurable]]': !(arrayLength || regexLastIndex), '[[Enumerable]]': $isEnumerable(O, P), '[[Value]]': O[P], '[[Writable]]': true }; } return ToPropertyDescriptor($gOPD(O, P)); }; es-abstract-1.20.4/2022/OrdinaryGetPrototypeOf.js000066400000000000000000000010331431761430200213710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $getProto = require('../helpers/getProto'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarygetprototypeof module.exports = function OrdinaryGetPrototypeOf(O) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: O must be an Object'); } if (!$getProto) { throw new $TypeError('This environment does not support fetching prototypes.'); } return $getProto(O); }; es-abstract-1.20.4/2022/OrdinaryHasInstance.js000066400000000000000000000011631431761430200206430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance module.exports = function OrdinaryHasInstance(C, O) { if (IsCallable(C) === false) { return false; } if (Type(O) !== 'Object') { return false; } var P = Get(C, 'prototype'); if (Type(P) !== 'Object') { throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.'); } return O instanceof C; }; es-abstract-1.20.4/2022/OrdinaryHasProperty.js000066400000000000000000000010231431761430200207160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty module.exports = function OrdinaryHasProperty(O, P) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } return P in O; }; es-abstract-1.20.4/2022/OrdinaryObjectCreate.js000066400000000000000000000026451431761430200210030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ObjectCreate = GetIntrinsic('%Object.create%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var IsArray = require('./IsArray'); var Type = require('./Type'); var hasProto = !({ __proto__: null } instanceof Object); // https://262.ecma-international.org/6.0/#sec-objectcreate module.exports = function OrdinaryObjectCreate(proto) { if (proto !== null && Type(proto) !== 'Object') { throw new $TypeError('Assertion failed: `proto` must be null or an object'); } var additionalInternalSlotsList = arguments.length < 2 ? [] : arguments[1]; if (!IsArray(additionalInternalSlotsList)) { throw new $TypeError('Assertion failed: `additionalInternalSlotsList` must be an Array'); } // var internalSlotsList = ['[[Prototype]]', '[[Extensible]]']; if (additionalInternalSlotsList.length > 0) { throw new $SyntaxError('es-abstract does not yet support internal slots'); // internalSlotsList.push(...additionalInternalSlotsList); } // var O = MakeBasicObject(internalSlotsList); // setProto(O, proto); // return O; if ($ObjectCreate) { return $ObjectCreate(proto); } if (hasProto) { return { __proto__: proto }; } if (proto === null) { throw new $SyntaxError('native Object.create support is required to create null objects'); } var T = function T() {}; T.prototype = proto; return new T(); }; es-abstract-1.20.4/2022/OrdinarySetPrototypeOf.js000066400000000000000000000020321431761430200214050ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $setProto = require('../helpers/setProto'); var OrdinaryGetPrototypeOf = require('./OrdinaryGetPrototypeOf'); var Type = require('./Type'); // https://262.ecma-international.org/7.0/#sec-ordinarysetprototypeof module.exports = function OrdinarySetPrototypeOf(O, V) { if (Type(V) !== 'Object' && Type(V) !== 'Null') { throw new $TypeError('Assertion failed: V must be Object or Null'); } /* var extensible = IsExtensible(O); var current = OrdinaryGetPrototypeOf(O); if (SameValue(V, current)) { return true; } if (!extensible) { return false; } */ try { $setProto(O, V); } catch (e) { return false; } return OrdinaryGetPrototypeOf(O) === V; /* var p = V; var done = false; while (!done) { if (p === null) { done = true; } else if (SameValue(p, O)) { return false; } else { if (wat) { done = true; } else { p = p.[[Prototype]]; } } } O.[[Prototype]] = V; return true; */ }; es-abstract-1.20.4/2022/OrdinaryToPrimitive.js000066400000000000000000000020511431761430200207130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); var inspect = require('object-inspect'); // https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive module.exports = function OrdinaryToPrimitive(O, hint) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); } var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; for (var i = 0; i < methodNames.length; i += 1) { var name = methodNames[i]; var method = Get(O, name); if (IsCallable(method)) { var result = Call(method, O); if (Type(result) !== 'Object') { return result; } } } throw new $TypeError('No primitive value for ' + inspect(O)); }; es-abstract-1.20.4/2022/PromiseResolve.js000066400000000000000000000007111431761430200177070ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBind = require('call-bind'); var $resolve = GetIntrinsic('%Promise.resolve%', true); var $PromiseResolve = $resolve && callBind($resolve); // https://262.ecma-international.org/9.0/#sec-promise-resolve module.exports = function PromiseResolve(C, x) { if (!$PromiseResolve) { throw new SyntaxError('This environment does not support Promises.'); } return $PromiseResolve(C, x); }; es-abstract-1.20.4/2022/QuoteJSONString.js000066400000000000000000000026141431761430200177130ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var forEach = require('../helpers/forEach'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var StringToCodePoints = require('./StringToCodePoints'); var Type = require('./Type'); var UnicodeEscape = require('./UnicodeEscape'); var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint'); var has = require('has'); // https://ecma-international.org/ecma-262/12.0/#sec-quotejsonstring var escapes = { '\u0008': '\\b', '\u0009': '\\t', '\u000A': '\\n', '\u000C': '\\f', '\u000D': '\\r', '\u0022': '\\"', '\u005c': '\\\\' }; module.exports = function QuoteJSONString(value) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `value` must be a String'); } var product = '"'; if (value) { forEach(StringToCodePoints(value), function (C) { if (has(escapes, C)) { product += escapes[C]; } else { var cCharCode = $charCodeAt(C, 0); if (cCharCode < 0x20 || isLeadingSurrogate(C) || isTrailingSurrogate(C)) { product += UnicodeEscape(C); } else { product += UTF16EncodeCodePoint(cCharCode); } } }); } product += '"'; return product; }; es-abstract-1.20.4/2022/RegExpCreate.js000066400000000000000000000012031431761430200172440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RegExp = GetIntrinsic('%RegExp%'); // var RegExpAlloc = require('./RegExpAlloc'); // var RegExpInitialize = require('./RegExpInitialize'); var ToString = require('./ToString'); // https://262.ecma-international.org/6.0/#sec-regexpcreate module.exports = function RegExpCreate(P, F) { // var obj = RegExpAlloc($RegExp); // return RegExpInitialize(obj, P, F); // covers spec mechanics; bypass regex brand checking var pattern = typeof P === 'undefined' ? '' : ToString(P); var flags = typeof F === 'undefined' ? '' : ToString(F); return new $RegExp(pattern, flags); }; es-abstract-1.20.4/2022/RegExpExec.js000066400000000000000000000015671431761430200167420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var regexExec = require('call-bind/callBound')('RegExp.prototype.exec'); var Call = require('./Call'); var Get = require('./Get'); var IsCallable = require('./IsCallable'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-regexpexec module.exports = function RegExpExec(R, S) { if (Type(R) !== 'Object') { throw new $TypeError('Assertion failed: `R` must be an Object'); } if (Type(S) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var exec = Get(R, 'exec'); if (IsCallable(exec)) { var result = Call(exec, R, [S]); if (result === null || Type(result) === 'Object') { return result; } throw new $TypeError('"exec" method must return `null` or an Object'); } return regexExec(R, S); }; es-abstract-1.20.4/2022/RegExpHasFlag.js000066400000000000000000000021151431761430200173510ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $RegExpPrototype = GetIntrinsic('%RegExp.prototype%'); var SameValue = require('./SameValue'); var Type = require('./Type'); var $indexOf = callBound('String.prototype.indexOf'); var hasRegExpMatcher = require('is-regex'); var getFlags = require('regexp.prototype.flags'); // https://262.ecma-international.org/13.0/#sec-regexphasflag module.exports = function RegExpHasFlag(R, codeUnit) { if (Type(codeUnit) !== 'String' || codeUnit.length !== 1) { throw new $TypeError('Assertion failed: `string` must be a code unit - a String of length 1'); } if (Type(R) !== 'Object') { throw new $TypeError('Assertion failed: Type(R) is not Object'); } if (!hasRegExpMatcher(R)) { // step 2 if (SameValue(R, $RegExpPrototype)) { return void undefined; // step 2.a } throw new $TypeError('`R` must be a RegExp object'); // step 2.b } var flags = getFlags(R); // step 3 return $indexOf(flags, codeUnit) > -1; // steps 4-5 }; es-abstract-1.20.4/2022/RequireObjectCoercible.js000066400000000000000000000001061431761430200213020ustar00rootroot00000000000000'use strict'; module.exports = require('../5/CheckObjectCoercible'); es-abstract-1.20.4/2022/SameValue.js000066400000000000000000000004631431761430200166170ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // http://262.ecma-international.org/5.1/#sec-9.12 module.exports = function SameValue(x, y) { if (x === y) { // 0 === -0, but they are not identical. if (x === 0) { return 1 / x === 1 / y; } return true; } return $isNaN(x) && $isNaN(y); }; es-abstract-1.20.4/2022/SameValueNonNumeric.js000066400000000000000000000011731431761430200206140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-samevaluenonnumeric module.exports = function SameValueNonNumeric(x, y) { var xType = Type(x); if (xType === 'Number' || xType === 'BigInt') { throw new $TypeError('Assertion failed: SameValueNonNumeric does not accept Number or BigInt values'); } if (xType !== Type(y)) { throw new $TypeError('SameValueNonNumeric requires two non-numeric values of the same type.'); } return SameValue(x, y); }; es-abstract-1.20.4/2022/SameValueZero.js000066400000000000000000000003371431761430200174570ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero module.exports = function SameValueZero(x, y) { return (x === y) || ($isNaN(x) && $isNaN(y)); }; es-abstract-1.20.4/2022/SecFromTime.js000066400000000000000000000006221431761430200171070ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var SecondsPerMinute = timeConstants.SecondsPerMinute; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function SecFromTime(t) { return modulo(floor(t / msPerSecond), SecondsPerMinute); }; es-abstract-1.20.4/2022/Set.js000066400000000000000000000023471431761430200154730ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // IE 9 does not throw in strict mode when writability/configurability/extensibility is violated var noThrowOnStrictViolation = (function () { try { delete [].length; return true; } catch (e) { return false; } }()); // https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw module.exports = function Set(O, P, V, Throw) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: `O` must be an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: `P` must be a Property Key'); } if (Type(Throw) !== 'Boolean') { throw new $TypeError('Assertion failed: `Throw` must be a Boolean'); } if (Throw) { O[P] = V; // eslint-disable-line no-param-reassign if (noThrowOnStrictViolation && !SameValue(O[P], V)) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; } try { O[P] = V; // eslint-disable-line no-param-reassign return noThrowOnStrictViolation ? SameValue(O[P], V) : true; } catch (e) { return false; } }; es-abstract-1.20.4/2022/SetFunctionLength.js000066400000000000000000000021231431761430200203330ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var HasOwnProperty = require('./HasOwnProperty'); var IsExtensible = require('./IsExtensible'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/12.0/#sec-setfunctionlength module.exports = function SetFunctionLength(F, length) { if (typeof F !== 'function' || !IsExtensible(F) || HasOwnProperty(F, 'length')) { throw new $TypeError('Assertion failed: `F` must be an extensible function and lack an own `length` property'); } if (Type(length) !== 'Number') { throw new $TypeError('Assertion failed: `length` must be a Number'); } if (length !== Infinity && (!IsIntegralNumber(length) || length < 0)) { throw new $TypeError('Assertion failed: `length` must be ∞, or an integer >= 0'); } return DefinePropertyOrThrow(F, 'length', { '[[Configurable]]': true, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); }; es-abstract-1.20.4/2022/SetFunctionName.js000066400000000000000000000025451431761430200200020ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname module.exports = function SetFunctionName(F, name) { if (typeof F !== 'function') { throw new $TypeError('Assertion failed: `F` must be a function'); } if (!IsExtensible(F) || has(F, 'name')) { throw new $TypeError('Assertion failed: `F` must be extensible, and must not have a `name` own property'); } var nameType = Type(name); if (nameType !== 'Symbol' && nameType !== 'String') { throw new $TypeError('Assertion failed: `name` must be a Symbol or a String'); } if (nameType === 'Symbol') { var description = getSymbolDescription(name); // eslint-disable-next-line no-param-reassign name = typeof description === 'undefined' ? '' : '[' + description + ']'; } if (arguments.length > 2) { var prefix = arguments[2]; // eslint-disable-next-line no-param-reassign name = prefix + ' ' + name; } return DefinePropertyOrThrow(F, 'name', { '[[Value]]': name, '[[Writable]]': false, '[[Enumerable]]': false, '[[Configurable]]': true }); }; es-abstract-1.20.4/2022/SetIntegrityLevel.js000066400000000000000000000035061431761430200203600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var forEach = require('../helpers/forEach'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel module.exports = function SetIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } if (!$preventExtensions) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.preventExtensions` support'); } var status = $preventExtensions(O); if (!status) { return false; } if (!$gOPN) { throw new $SyntaxError('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support'); } var theKeys = $gOPN(O); if (level === 'sealed') { forEach(theKeys, function (k) { DefinePropertyOrThrow(O, k, { configurable: false }); }); } else if (level === 'frozen') { forEach(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { var desc; if (IsAccessorDescriptor(ToPropertyDescriptor(currentDesc))) { desc = { configurable: false }; } else { desc = { configurable: false, writable: false }; } DefinePropertyOrThrow(O, k, desc); } }); } return true; }; es-abstract-1.20.4/2022/SortIndexedProperties.js000066400000000000000000000032351431761430200212420ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var DeletePropertyOrThrow = require('./DeletePropertyOrThrow'); var Get = require('./Get'); var HasProperty = require('./HasProperty'); var IsIntegralNumber = require('./IsIntegralNumber'); var Set = require('./Set'); var ToString = require('./ToString'); var Type = require('./Type'); var isAbstractClosure = require('../helpers/isAbstractClosure'); var $push = callBound('Array.prototype.push'); var $sort = callBound('Array.prototype.sort'); // https://ecma-international.org/ecma-262/13.0/#sec-sortindexedproperties module.exports = function SortIndexedProperties(obj, len, SortCompare) { if (Type(obj) !== 'Object') { throw new $TypeError('Assertion failed: Type(obj) is not Object'); } if (!IsIntegralNumber(len) || len < 0) { throw new $TypeError('Assertion failed: `len` must be an integer >= 0'); } if (!isAbstractClosure(SortCompare) || SortCompare.length !== 2) { throw new $TypeError('Assertion failed: `SortCompare` must be an abstract closure taking 2 arguments'); } var items = []; // step 1 var k = 0; // step 2 while (k < len) { // step 3 var Pk = ToString(k); var kPresent = HasProperty(obj, Pk); if (kPresent) { var kValue = Get(obj, Pk); $push(items, kValue); } k += 1; } var itemCount = items.length; // step 4 $sort(items, SortCompare); // step 5 var j = 0; // step 6 while (j < itemCount) { // step 7 Set(obj, ToString(j), items[j], true); j += 1; } while (j < len) { // step 8 DeletePropertyOrThrow(obj, ToString(j)); j += 1; } return obj; // step 9 }; es-abstract-1.20.4/2022/SpeciesConstructor.js000066400000000000000000000015141431761430200205740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $species = GetIntrinsic('%Symbol.species%', true); var $TypeError = GetIntrinsic('%TypeError%'); var IsConstructor = require('./IsConstructor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor module.exports = function SpeciesConstructor(O, defaultConstructor) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } var C = O.constructor; if (typeof C === 'undefined') { return defaultConstructor; } if (Type(C) !== 'Object') { throw new $TypeError('O.constructor is not an Object'); } var S = $species ? C[$species] : void 0; if (S == null) { return defaultConstructor; } if (IsConstructor(S)) { return S; } throw new $TypeError('no constructor found'); }; es-abstract-1.20.4/2022/StringCreate.js000066400000000000000000000021351431761430200173250ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var $StringPrototype = GetIntrinsic('%String.prototype%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var Type = require('./Type'); var setProto = require('../helpers/setProto'); // https://262.ecma-international.org/6.0/#sec-stringcreate module.exports = function StringCreate(value, prototype) { if (Type(value) !== 'String') { throw new $TypeError('Assertion failed: `S` must be a String'); } var S = $Object(value); if (prototype !== $StringPrototype) { if (setProto) { setProto(S, prototype); } else { throw new $SyntaxError('StringCreate: a `proto` argument that is not `String.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } } var length = value.length; DefinePropertyOrThrow(S, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': false }); return S; }; es-abstract-1.20.4/2022/StringGetOwnProperty.js000066400000000000000000000026011431761430200210700ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charAt = callBound('String.prototype.charAt'); var $stringToString = callBound('String.prototype.toString'); var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); var IsIntegralNumber = require('./IsIntegralNumber'); var IsPropertyKey = require('./IsPropertyKey'); var Type = require('./Type'); var isNegativeZero = require('is-negative-zero'); // https://ecma-international.org/ecma-262/12.0/#sec-stringgetownproperty module.exports = function StringGetOwnProperty(S, P) { var str; if (Type(S) === 'Object') { try { str = $stringToString(S); } catch (e) { /**/ } } if (Type(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 (Type(P) !== 'String') { return void undefined; } var index = CanonicalNumericIndexString(P); var len = str.length; if (typeof index === 'undefined' || !IsIntegralNumber(index) || isNegativeZero(index) || index < 0 || len <= index) { return void undefined; } var resultStr = $charAt(S, index); return { '[[Configurable]]': false, '[[Enumerable]]': true, '[[Value]]': resultStr, '[[Writable]]': false }; }; es-abstract-1.20.4/2022/StringIndexOf.js000066400000000000000000000021411431761430200174530ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); var $slice = callBound('String.prototype.slice'); // https://ecma-international.org/ecma-262/12.0/#sec-stringindexof module.exports = function StringIndexOf(string, searchValue, fromIndex) { if (Type(string) !== 'String') { throw new $TypeError('Assertion failed: `string` must be a String'); } if (Type(searchValue) !== 'String') { throw new $TypeError('Assertion failed: `searchValue` must be a String'); } if (!IsIntegralNumber(fromIndex) || fromIndex < 0) { throw new $TypeError('Assertion failed: `fromIndex` must be a non-negative integer'); } var len = string.length; if (searchValue === '' && fromIndex <= len) { return fromIndex; } var searchLen = searchValue.length; for (var i = fromIndex; i <= (len - searchLen); i += 1) { var candidate = $slice(string, i, i + searchLen); if (candidate === searchValue) { return i; } } return -1; }; es-abstract-1.20.4/2022/StringPad.js000066400000000000000000000023571431761430200166340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var $strSlice = callBound('String.prototype.slice'); // https://262.ecma-international.org/11.0/#sec-stringpad module.exports = function StringPad(O, maxLength, fillString, placement) { if (placement !== 'start' && placement !== 'end') { throw new $TypeError('Assertion failed: `placement` must be "start" or "end"'); } var S = ToString(O); var intMaxLength = ToLength(maxLength); var stringLength = S.length; if (intMaxLength <= stringLength) { return S; } var filler = typeof fillString === 'undefined' ? ' ' : ToString(fillString); if (filler === '') { return S; } var fillLen = intMaxLength - stringLength; // the String value consisting of repeated concatenations of filler truncated to length fillLen. var truncatedStringFiller = ''; while (truncatedStringFiller.length < fillLen) { truncatedStringFiller += filler; } truncatedStringFiller = $strSlice(truncatedStringFiller, 0, fillLen); if (placement === 'start') { return truncatedStringFiller + S; } return S + truncatedStringFiller; }; es-abstract-1.20.4/2022/StringToBigInt.js000066400000000000000000000011051431761430200175750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); // https://262.ecma-international.org/11.0/#sec-stringtobigint module.exports = function StringToBigInt(argument) { if (typeof argument !== 'string') { throw new $TypeError('`argument` must be a string'); } if (!$BigInt) { throw new $SyntaxError('BigInts are not supported in this environment'); } try { return $BigInt(argument); } catch (e) { return NaN; } }; es-abstract-1.20.4/2022/StringToCodePoints.js000066400000000000000000000013701431761430200204740ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $push = callBound('Array.prototype.push'); var CodePointAt = require('./CodePointAt'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/12.0/#sec-stringtocodepoints module.exports = function StringToCodePoints(string) { if (Type(string) !== 'String') { throw new $TypeError('Assertion failed: `string` must be a String'); } var codePoints = []; var size = string.length; var position = 0; while (position < size) { var cp = CodePointAt(string, position); $push(codePoints, cp['[[CodePoint]]']); position += cp['[[CodeUnitCount]]']; } return codePoints; }; es-abstract-1.20.4/2022/StringToNumber.js000066400000000000000000000035111431761430200176540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var $RegExp = GetIntrinsic('%RegExp%'); var $TypeError = GetIntrinsic('%TypeError%'); var $parseInteger = GetIntrinsic('%parseInt%'); var callBound = require('call-bind/callBound'); var regexTester = require('safe-regex-test'); var $strSlice = callBound('String.prototype.slice'); var isBinary = regexTester(/^0b[01]+$/i); var isOctal = regexTester(/^0o[0-7]+$/i); var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i); var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); var hasNonWS = regexTester(nonWSregex); // whitespace from: https://es5.github.io/#x15.5.4.20 // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324 var ws = [ '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003', '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028', '\u2029\uFEFF' ].join(''); var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); var $replace = callBound('String.prototype.replace'); var $trim = function (value) { return $replace(value, trimRegex, ''); }; var Type = require('./Type'); // https://ecma-international.org/ecma-262/13.0/#sec-stringtonumber module.exports = function StringToNumber(argument) { if (Type(argument) !== 'String') { throw new $TypeError('Conversion from \'BigInt\' to \'number\' is not allowed.'); } if (isBinary(argument)) { return $Number($parseInteger($strSlice(argument, 2), 2)); } if (isOctal(argument)) { return $Number($parseInteger($strSlice(argument, 2), 8)); } if (hasNonWS(argument) || isInvalidHexLiteral(argument)) { return NaN; } var trimmed = $trim(argument); if (trimmed !== argument) { return StringToNumber(trimmed); } return $Number(argument); }; es-abstract-1.20.4/2022/SymbolDescriptiveString.js000066400000000000000000000010161431761430200215660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $SymbolToString = callBound('Symbol.prototype.toString', true); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring module.exports = function SymbolDescriptiveString(sym) { if (Type(sym) !== 'Symbol') { throw new $TypeError('Assertion failed: `sym` must be a Symbol'); } return $SymbolToString(sym); }; es-abstract-1.20.4/2022/TestIntegrityLevel.js000066400000000000000000000024051431761430200205410ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var $TypeError = GetIntrinsic('%TypeError%'); var every = require('../helpers/every'); var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsExtensible = require('./IsExtensible'); var ToPropertyDescriptor = require('./ToPropertyDescriptor'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel module.exports = function TestIntegrityLevel(O, level) { if (Type(O) !== 'Object') { throw new $TypeError('Assertion failed: Type(O) is not Object'); } if (level !== 'sealed' && level !== 'frozen') { throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); } var status = IsExtensible(O); if (status) { return false; } var theKeys = OwnPropertyKeys(O); return theKeys.length === 0 || every(theKeys, function (k) { var currentDesc = $gOPD(O, k); if (typeof currentDesc !== 'undefined') { if (currentDesc.configurable) { return false; } if (level === 'frozen' && IsDataDescriptor(ToPropertyDescriptor(currentDesc)) && currentDesc.writable) { return false; } } return true; }); }; es-abstract-1.20.4/2022/TimeClip.js000066400000000000000000000007241431761430200164430ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var $Number = GetIntrinsic('%Number%'); var $isFinite = require('../helpers/isFinite'); var abs = require('./abs'); var ToNumber = require('./ToNumber'); // https://262.ecma-international.org/5.1/#sec-15.9.1.14 module.exports = function TimeClip(time) { if (!$isFinite(time) || abs(time) > 8.64e15) { return NaN; } return $Number(new $Date(ToNumber(time))); }; es-abstract-1.20.4/2022/TimeFromYear.js000066400000000000000000000004051431761430200172740ustar00rootroot00000000000000'use strict'; var msPerDay = require('../helpers/timeConstants').msPerDay; var DayFromYear = require('./DayFromYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function TimeFromYear(y) { return msPerDay * DayFromYear(y); }; es-abstract-1.20.4/2022/TimeString.js000066400000000000000000000014501431761430200170170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var padTimeComponent = require('../helpers/padTimeComponent'); var HourFromTime = require('./HourFromTime'); var MinFromTime = require('./MinFromTime'); var SecFromTime = require('./SecFromTime'); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-timestring module.exports = function TimeString(tv) { if (Type(tv) !== 'Number' || $isNaN(tv)) { throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); } var hour = HourFromTime(tv); var minute = MinFromTime(tv); var second = SecFromTime(tv); return padTimeComponent(hour) + ':' + padTimeComponent(minute) + ':' + padTimeComponent(second) + '\x20GMT'; }; es-abstract-1.20.4/2022/TimeWithinDay.js000066400000000000000000000003671431761430200174570ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function TimeWithinDay(t) { return modulo(t, msPerDay); }; es-abstract-1.20.4/2022/ToBigInt.js000066400000000000000000000011671431761430200164160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $asIntN = GetIntrinsic('%BigInt.asIntN%', true); var $Number = GetIntrinsic('%Number%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var ToPrimitive = require('./ToPrimitive'); // https://262.ecma-international.org/11.0/#sec-tobigint module.exports = function ToBigInt(argument) { if (!$BigInt) { throw new $SyntaxError('BigInts are not supported in this environment'); } var prim = ToPrimitive(argument, $Number); if (typeof prim === 'number') { return $asIntN(0, prim); } return $BigInt(prim); }; es-abstract-1.20.4/2022/ToBigInt64.js000066400000000000000000000016641431761430200165720ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $pow = GetIntrinsic('%Math.pow%'); var ToBigInt = require('./ToBigInt'); var BigIntRemainder = require('./BigInt/remainder'); var modBigInt = require('../helpers/modBigInt'); // BigInt(2**63), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER var twoSixtyThree = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 31))); // BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32))); // https://262.ecma-international.org/11.0/#sec-tobigint64 module.exports = function ToBigInt64(argument) { var n = ToBigInt(argument); var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour); return int64bit >= twoSixtyThree ? int64bit - twoSixtyFour : int64bit; }; es-abstract-1.20.4/2022/ToBigUint64.js000066400000000000000000000012771431761430200167570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $pow = GetIntrinsic('%Math.pow%'); var ToBigInt = require('./ToBigInt'); var BigIntRemainder = require('./BigInt/remainder'); var modBigInt = require('../helpers/modBigInt'); // BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32))); // https://262.ecma-international.org/11.0/#sec-tobiguint64 module.exports = function ToBigUint64(argument) { var n = ToBigInt(argument); var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour); return int64bit; }; es-abstract-1.20.4/2022/ToBoolean.js000066400000000000000000000002021431761430200166060ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.2 module.exports = function ToBoolean(value) { return !!value; }; es-abstract-1.20.4/2022/ToDateString.js000066400000000000000000000007621431761430200173060ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Date = GetIntrinsic('%Date%'); var $isNaN = require('../helpers/isNaN'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-todatestring module.exports = function ToDateString(tv) { if (Type(tv) !== 'Number') { throw new $TypeError('Assertion failed: `tv` must be a Number'); } if ($isNaN(tv)) { return 'Invalid Date'; } return $Date(tv); }; es-abstract-1.20.4/2022/ToIndex.js000066400000000000000000000012671431761430200163120ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); var ToLength = require('./ToLength'); var SameValue = require('./SameValue'); // https://www.ecma-international.org/ecma-262/8.0/#sec-toindex module.exports = function ToIndex(value) { if (typeof value === 'undefined') { return 0; } var integerIndex = ToIntegerOrInfinity(value); if (integerIndex < 0) { throw new $RangeError('index must be >= 0'); } var index = ToLength(integerIndex); if (!SameValue(integerIndex, index)) { throw new $RangeError('index must be >= 0 and < 2 ** 53 - 1'); } return index; }; es-abstract-1.20.4/2022/ToInt16.js000066400000000000000000000004041431761430200161340ustar00rootroot00000000000000'use strict'; var ToUint16 = require('./ToUint16'); // https://ecma-international.org/ecma-262/6.0/#sec-toint16 module.exports = function ToInt16(argument) { var int16bit = ToUint16(argument); return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit; }; es-abstract-1.20.4/2022/ToInt32.js000066400000000000000000000002551431761430200161360ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.5 module.exports = function ToInt32(x) { return ToNumber(x) >> 0; }; es-abstract-1.20.4/2022/ToInt8.js000066400000000000000000000003671431761430200160650ustar00rootroot00000000000000'use strict'; var ToUint8 = require('./ToUint8'); // https://ecma-international.org/ecma-262/6.0/#sec-toint8 module.exports = function ToInt8(argument) { var int8bit = ToUint8(argument); return int8bit >= 0x80 ? int8bit - 0x100 : int8bit; }; es-abstract-1.20.4/2022/ToIntegerOrInfinity.js000066400000000000000000000011301431761430200206400ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // https://262.ecma-international.org/12.0/#sec-tointegerorinfinity module.exports = function ToIntegerOrInfinity(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0) { return 0; } if (!$isFinite(number)) { return number; } var integer = floor(abs(number)); if (integer === 0) { return 0; } return $sign(number) * integer; }; es-abstract-1.20.4/2022/ToLength.js000066400000000000000000000005521431761430200164600ustar00rootroot00000000000000'use strict'; var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); module.exports = function ToLength(argument) { var len = ToIntegerOrInfinity(argument); if (len <= 0) { return 0; } // includes converting -0 to +0 if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } return len; }; es-abstract-1.20.4/2022/ToNumber.js000066400000000000000000000014511431761430200164660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $Number = GetIntrinsic('%Number%'); var isPrimitive = require('../helpers/isPrimitive'); var ToPrimitive = require('./ToPrimitive'); var StringToNumber = require('./StringToNumber'); // https://ecma-international.org/ecma-262/13.0/#sec-tonumber module.exports = function ToNumber(argument) { var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (typeof value === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a number'); } if (typeof value === 'bigint') { throw new $TypeError('Conversion from \'BigInt\' to \'number\' is not allowed.'); } if (typeof value === 'string') { return StringToNumber(value); } return $Number(value); }; es-abstract-1.20.4/2022/ToNumeric.js000066400000000000000000000010461431761430200166400ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var isPrimitive = require('../helpers/isPrimitive'); var ToPrimitive = require('./ToPrimitive'); var ToNumber = require('./ToNumber'); var Type = require('./Type'); // https://262.ecma-international.org/6.0/#sec-tonumber module.exports = function ToNumeric(argument) { var primValue = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); if (Type(primValue) === 'BigInt') { return primValue; } return ToNumber(primValue); }; es-abstract-1.20.4/2022/ToObject.js000066400000000000000000000005161431761430200164450ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); // https://ecma-international.org/ecma-262/6.0/#sec-toobject module.exports = function ToObject(value) { RequireObjectCoercible(value); return $Object(value); }; es-abstract-1.20.4/2022/ToPrimitive.js000066400000000000000000000004371431761430200172110ustar00rootroot00000000000000'use strict'; var toPrimitive = require('es-to-primitive/es2015'); // https://ecma-international.org/ecma-262/6.0/#sec-toprimitive module.exports = function ToPrimitive(input) { if (arguments.length > 1) { return toPrimitive(input, arguments[1]); } return toPrimitive(input); }; es-abstract-1.20.4/2022/ToPropertyDescriptor.js000066400000000000000000000026541431761430200211270ustar00rootroot00000000000000'use strict'; var has = require('has'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var ToBoolean = require('./ToBoolean'); var IsCallable = require('./IsCallable'); // https://262.ecma-international.org/5.1/#sec-8.10.5 module.exports = function ToPropertyDescriptor(Obj) { if (Type(Obj) !== 'Object') { throw new $TypeError('ToPropertyDescriptor requires an object'); } var desc = {}; if (has(Obj, 'enumerable')) { desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable); } if (has(Obj, 'configurable')) { desc['[[Configurable]]'] = ToBoolean(Obj.configurable); } if (has(Obj, 'value')) { desc['[[Value]]'] = Obj.value; } if (has(Obj, 'writable')) { desc['[[Writable]]'] = ToBoolean(Obj.writable); } if (has(Obj, 'get')) { var getter = Obj.get; if (typeof getter !== 'undefined' && !IsCallable(getter)) { throw new $TypeError('getter must be a function'); } desc['[[Get]]'] = getter; } if (has(Obj, 'set')) { var setter = Obj.set; if (typeof setter !== 'undefined' && !IsCallable(setter)) { throw new $TypeError('setter must be a function'); } desc['[[Set]]'] = setter; } if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); } return desc; }; es-abstract-1.20.4/2022/ToPropertyKey.js000066400000000000000000000006251431761430200175350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var ToPrimitive = require('./ToPrimitive'); var ToString = require('./ToString'); // https://ecma-international.org/ecma-262/6.0/#sec-topropertykey module.exports = function ToPropertyKey(argument) { var key = ToPrimitive(argument, $String); return typeof key === 'symbol' ? key : ToString(key); }; es-abstract-1.20.4/2022/ToString.js000066400000000000000000000006141431761430200165040ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $TypeError = GetIntrinsic('%TypeError%'); // https://ecma-international.org/ecma-262/6.0/#sec-tostring module.exports = function ToString(argument) { if (typeof argument === 'symbol') { throw new $TypeError('Cannot convert a Symbol value to a string'); } return $String(argument); }; es-abstract-1.20.4/2022/ToUint16.js000066400000000000000000000010641431761430200163240ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // http://262.ecma-international.org/5.1/#sec-9.7 module.exports = function ToUint16(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x10000); }; es-abstract-1.20.4/2022/ToUint32.js000066400000000000000000000002571431761430200163250ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.6 module.exports = function ToUint32(x) { return ToNumber(x) >>> 0; }; es-abstract-1.20.4/2022/ToUint8.js000066400000000000000000000011021431761430200162360ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8 module.exports = function ToUint8(argument) { var number = ToNumber(argument); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x100); }; es-abstract-1.20.4/2022/ToUint8Clamp.js000066400000000000000000000010121431761430200172130ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var floor = require('./floor'); var $isNaN = require('../helpers/isNaN'); // https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp module.exports = function ToUint8Clamp(argument) { var number = ToNumber(argument); if ($isNaN(number) || number <= 0) { return 0; } if (number >= 0xFF) { return 0xFF; } var f = floor(argument); if (f + 0.5 < number) { return f + 1; } if (number < f + 0.5) { return f; } if (f % 2 !== 0) { return f + 1; } return f; }; es-abstract-1.20.4/2022/ToZeroPaddedDecimalString.js000066400000000000000000000011121431761430200217170ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); var $RangeError = GetIntrinsic('%RangeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var StringPad = require('./StringPad'); // https://ecma-international.org/ecma-262/13.0/#sec-tozeropaddeddecimalstring module.exports = function ToZeroPaddedDecimalString(n, minLength) { if (!IsIntegralNumber(n) || n < 0) { throw new $RangeError('Assertion failed: `q` must be a non-negative integer'); } var S = $String(n); return StringPad(S, minLength, '0', 'start'); }; es-abstract-1.20.4/2022/TrimString.js000066400000000000000000000014441431761430200170370ustar00rootroot00000000000000'use strict'; var trimStart = require('string.prototype.trimstart'); var trimEnd = require('string.prototype.trimend'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var RequireObjectCoercible = require('./RequireObjectCoercible'); var ToString = require('./ToString'); // https://262.ecma-international.org/10.0/#sec-trimstring module.exports = function TrimString(string, where) { var str = RequireObjectCoercible(string); var S = ToString(str); var T; if (where === 'start') { T = trimStart(S); } else if (where === 'end') { T = trimEnd(S); } else if (where === 'start+end') { T = trimStart(trimEnd(S)); } else { throw new $TypeError('Assertion failed: invalid `where` value; must be "start", "end", or "start+end"'); } return T; }; es-abstract-1.20.4/2022/Type.js000066400000000000000000000004511431761430200156530ustar00rootroot00000000000000'use strict'; var ES5Type = require('../5/Type'); // https://262.ecma-international.org/11.0/#sec-ecmascript-data-types-and-values module.exports = function Type(x) { if (typeof x === 'symbol') { return 'Symbol'; } if (typeof x === 'bigint') { return 'BigInt'; } return ES5Type(x); }; es-abstract-1.20.4/2022/UTF16EncodeCodePoint.js000066400000000000000000000013111431761430200204560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var floor = require('./floor'); var modulo = require('./modulo'); var isCodePoint = require('../helpers/isCodePoint'); // https://ecma-international.org/ecma-262/12.0/#sec-utf16encoding module.exports = function UTF16EncodeCodePoint(cp) { if (!isCodePoint(cp)) { throw new $TypeError('Assertion failed: `cp` must be >= 0 and <= 0x10FFFF'); } if (cp <= 65535) { return $fromCharCode(cp); } var cu1 = $fromCharCode(floor((cp - 65536) / 1024) + 0xD800); var cu2 = $fromCharCode(modulo(cp - 65536, 1024) + 0xDC00); return cu1 + cu2; }; es-abstract-1.20.4/2022/UTF16SurrogatePairToCodePoint.js000066400000000000000000000014021431761430200223540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); // https://tc39.es/ecma262/2020/#sec-utf16decodesurrogatepair module.exports = function UTF16SurrogatePairToCodePoint(lead, trail) { if (!isLeadingSurrogate(lead) || !isTrailingSurrogate(trail)) { throw new $TypeError('Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code'); } // var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; return $fromCharCode(lead) + $fromCharCode(trail); }; es-abstract-1.20.4/2022/UnicodeEscape.js000066400000000000000000000015071431761430200174440ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var callBound = require('call-bind/callBound'); var $charCodeAt = callBound('String.prototype.charCodeAt'); var $numberToString = callBound('Number.prototype.toString'); var $toLowerCase = callBound('String.prototype.toLowerCase'); var StringPad = require('./StringPad'); // https://262.ecma-international.org/11.0/#sec-unicodeescape module.exports = function UnicodeEscape(C) { if (typeof C !== 'string' || C.length !== 1) { throw new $TypeError('Assertion failed: `C` must be a single code unit'); } var n = $charCodeAt(C, 0); if (n > 0xFFFF) { throw new $TypeError('`Assertion failed: numeric value of `C` must be <= 0xFFFF'); } return '\\u' + StringPad($toLowerCase($numberToString(n, 16)), 4, '0', 'start'); }; es-abstract-1.20.4/2022/ValidateAndApplyPropertyDescriptor.js000066400000000000000000000135111431761430200237210ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var DefineOwnProperty = require('../helpers/DefineOwnProperty'); var isFullyPopulatedPropertyDescriptor = require('../helpers/isFullyPopulatedPropertyDescriptor'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var FromPropertyDescriptor = require('./FromPropertyDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsGenericDescriptor = require('./IsGenericDescriptor'); var IsPropertyKey = require('./IsPropertyKey'); var SameValue = require('./SameValue'); var Type = require('./Type'); // https://262.ecma-international.org/13.0/#sec-validateandapplypropertydescriptor // see https://github.com/tc39/ecma262/pull/2468 for ES2022 changes // eslint-disable-next-line max-lines-per-function, max-statements, max-params module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) { var oType = Type(O); if (oType !== 'Undefined' && oType !== 'Object') { throw new $TypeError('Assertion failed: O must be undefined or an Object'); } if (!IsPropertyKey(P)) { throw new $TypeError('Assertion failed: P must be a Property Key'); } if (Type(extensible) !== 'Boolean') { throw new $TypeError('Assertion failed: extensible must be a Boolean'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (Type(current) !== 'Undefined' && !isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, current)) { throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); } if (Type(current) === 'Undefined') { // step 2 if (!extensible) { return false; // step 2.a } if (oType === 'Undefined') { return true; // step 2.b } if (IsAccessorDescriptor(Desc)) { // step 2.c return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } // step 2.d return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': !!Desc['[[Configurable]]'], '[[Enumerable]]': !!Desc['[[Enumerable]]'], '[[Value]]': Desc['[[Value]]'], '[[Writable]]': !!Desc['[[Writable]]'] } ); } // 3. Assert: current is a fully populated Property Descriptor. if (!isFullyPopulatedPropertyDescriptor({ IsAccessorDescriptor: IsAccessorDescriptor, IsDataDescriptor: IsDataDescriptor }, current)) { throw new $TypeError('`current`, when present, must be a fully populated and valid Property Descriptor'); } // 4. If every field in Desc is absent, return true. // this can't really match the assertion that it's a Property Descriptor in our JS implementation // 5. If current.[[Configurable]] is false, then if (!current['[[Configurable]]']) { if ('[[Configurable]]' in Desc && Desc['[[Configurable]]']) { // step 5.a return false; } if ('[[Enumerable]]' in Desc && !SameValue(Desc['[[Enumerable]]'], current['[[Enumerable]]'])) { // step 5.b return false; } if (!IsGenericDescriptor(Desc) && !SameValue(IsAccessorDescriptor(Desc), IsAccessorDescriptor(current))) { // step 5.c return false; } if (IsAccessorDescriptor(current)) { // step 5.d if ('[[Get]]' in Desc && !SameValue(Desc['[[Get]]'], current['[[Get]]'])) { return false; } if ('[[Set]]' in Desc && !SameValue(Desc['[[Set]]'], current['[[Set]]'])) { return false; } } else if (!current['[[Writable]]']) { // step 5.e if ('[[Writable]]' in Desc && Desc['[[Writable]]']) { return false; } if ('[[Value]]' in Desc && !SameValue(Desc['[[Value]]'], current['[[Value]]'])) { return false; } } } // 6. If O is not undefined, then if (oType !== 'Undefined') { var configurable; var enumerable; if (IsDataDescriptor(current) && IsAccessorDescriptor(Desc)) { // step 6.a configurable = ('[[Configurable]]' in Desc ? Desc : current)['[[Configurable]]']; enumerable = ('[[Enumerable]]' in Desc ? Desc : current)['[[Enumerable]]']; // Replace the property named P of object O with an accessor property having [[Configurable]] and [[Enumerable]] attributes as described by current and each other attribute set to its default value. return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': !!configurable, '[[Enumerable]]': !!enumerable, '[[Get]]': ('[[Get]]' in Desc ? Desc : current)['[[Get]]'], '[[Set]]': ('[[Set]]' in Desc ? Desc : current)['[[Set]]'] } ); } else if (IsAccessorDescriptor(current) && IsDataDescriptor(Desc)) { configurable = ('[[Configurable]]' in Desc ? Desc : current)['[[Configurable]]']; enumerable = ('[[Enumerable]]' in Desc ? Desc : current)['[[Enumerable]]']; // i. Replace the property named P of object O with a data property having [[Configurable]] and [[Enumerable]] attributes as described by current and each other attribute set to its default value. return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, { '[[Configurable]]': !!configurable, '[[Enumerable]]': !!enumerable, '[[Value]]': ('[[Value]]' in Desc ? Desc : current)['[[Value]]'], '[[Writable]]': !!('[[Writable]]' in Desc ? Desc : current)['[[Writable]]'] } ); } // For each field of Desc that is present, set the corresponding attribute of the property named P of object O to the value of the field. return DefineOwnProperty( IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, Desc ); } return true; // step 7 }; es-abstract-1.20.4/2022/WeakRefDeref.js000066400000000000000000000011611431761430200172230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $deref = callBound('WeakRef.prototype.deref', true); var isWeakRef = require('is-weakref'); var AddToKeptObjects = require('./AddToKeptObjects'); // https://ecma-international.org/ecma-262/12.0/#sec-weakrefderef module.exports = function WeakRefDeref(weakRef) { if (!isWeakRef(weakRef)) { throw new $TypeError('Assertion failed: `weakRef` must be a WeakRef'); } var target = $deref(weakRef); if (target) { AddToKeptObjects(target); } return target; }; es-abstract-1.20.4/2022/WeekDay.js000066400000000000000000000003201431761430200162560ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.6 module.exports = function WeekDay(t) { return modulo(Day(t) + 4, 7); }; es-abstract-1.20.4/2022/YearFromTime.js000066400000000000000000000006271431761430200173020ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var callBound = require('call-bind/callBound'); var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function YearFromTime(t) { // largest y such that this.TimeFromYear(y) <= t return $getUTCFullYear(new $Date(t)); }; es-abstract-1.20.4/2022/abs.js000066400000000000000000000003171431761430200155000ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $abs = GetIntrinsic('%Math.abs%'); // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function abs(x) { return $abs(x); }; es-abstract-1.20.4/2022/clamp.js000066400000000000000000000011001431761430200160160ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var max = GetIntrinsic('%Math.max%'); var min = GetIntrinsic('%Math.min%'); var Type = require('./Type'); // https://262.ecma-international.org/12.0/#clamping module.exports = function clamp(x, lower, upper) { if (Type(x) !== 'Number' || Type(lower) !== 'Number' || Type(upper) !== 'Number' || !(lower <= upper)) { throw new $TypeError('Assertion failed: all three arguments must be MVs, and `lower` must be `<= upper`'); } return min(max(lower, x), upper); }; es-abstract-1.20.4/2022/floor.js000066400000000000000000000003311431761430200160500ustar00rootroot00000000000000'use strict'; // var modulo = require('./modulo'); var $floor = Math.floor; // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function floor(x) { // return x - modulo(x, 1); return $floor(x); }; es-abstract-1.20.4/2022/modulo.js000066400000000000000000000002501431761430200162260ustar00rootroot00000000000000'use strict'; var mod = require('../helpers/mod'); // https://262.ecma-international.org/5.1/#sec-5.2 module.exports = function modulo(x, y) { return mod(x, y); }; es-abstract-1.20.4/2022/msFromTime.js000066400000000000000000000003751431761430200170210ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerSecond = require('../helpers/timeConstants').msPerSecond; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function msFromTime(t) { return modulo(t, msPerSecond); }; es-abstract-1.20.4/2022/substring.js000066400000000000000000000013441431761430200167540ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var IsIntegralNumber = require('./IsIntegralNumber'); var Type = require('./Type'); var callBound = require('call-bind/callBound'); var $slice = callBound('String.prototype.slice'); // https://262.ecma-international.org/12.0/#substring module.exports = function substring(S, inclusiveStart, exclusiveEnd) { if (Type(S) !== 'String' || !IsIntegralNumber(inclusiveStart) || (arguments.length > 2 && !IsIntegralNumber(exclusiveEnd))) { throw new $TypeError('`S` must be a String, and `inclusiveStart` and `exclusiveEnd` must be integers'); } return $slice(S, inclusiveStart, arguments.length > 2 ? exclusiveEnd : S.length); }; es-abstract-1.20.4/2022/thisBigIntValue.js000066400000000000000000000010471431761430200177750ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var $TypeError = GetIntrinsic('%TypeError%'); var $bigIntValueOf = callBound('BigInt.prototype.valueOf', true); var Type = require('./Type'); // https://262.ecma-international.org/11.0/#sec-thisbigintvalue module.exports = function thisBigIntValue(value) { var type = Type(value); if (type === 'BigInt') { return value; } if (!$bigIntValueOf) { throw new $TypeError('BigInt is not supported'); } return $bigIntValueOf(value); }; es-abstract-1.20.4/2022/thisBooleanValue.js000066400000000000000000000005571431761430200202050ustar00rootroot00000000000000'use strict'; var $BooleanValueOf = require('call-bind/callBound')('Boolean.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-boolean-prototype-object module.exports = function thisBooleanValue(value) { if (Type(value) === 'Boolean') { return value; } return $BooleanValueOf(value); }; es-abstract-1.20.4/2022/thisNumberValue.js000066400000000000000000000006061431761430200200510ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var Type = require('./Type'); var $NumberValueOf = callBound('Number.prototype.valueOf'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object module.exports = function thisNumberValue(value) { if (Type(value) === 'Number') { return value; } return $NumberValueOf(value); }; es-abstract-1.20.4/2022/thisStringValue.js000066400000000000000000000005511431761430200200660ustar00rootroot00000000000000'use strict'; var $StringValueOf = require('call-bind/callBound')('String.prototype.valueOf'); var Type = require('./Type'); // https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object module.exports = function thisStringValue(value) { if (Type(value) === 'String') { return value; } return $StringValueOf(value); }; es-abstract-1.20.4/2022/thisSymbolValue.js000066400000000000000000000010021431761430200200550ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true); var Type = require('./Type'); // https://262.ecma-international.org/9.0/#sec-thissymbolvalue module.exports = function thisSymbolValue(value) { if (!$SymbolValueOf) { throw new SyntaxError('Symbols are not supported; thisSymbolValue requires that `value` be a Symbol or a Symbol object'); } if (Type(value) === 'Symbol') { return value; } return $SymbolValueOf(value); }; es-abstract-1.20.4/2022/thisTimeValue.js000066400000000000000000000001021431761430200175060ustar00rootroot00000000000000'use strict'; module.exports = require('../2018/thisTimeValue'); es-abstract-1.20.4/5/000077500000000000000000000000001431761430200141535ustar00rootroot00000000000000es-abstract-1.20.4/5/AbstractEqualityComparison.js000066400000000000000000000020731431761430200220270ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.9.3 module.exports = function AbstractEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType === yType) { return x === y; // ES6+ specified this shortcut anyways. } if (x == null && y == null) { return true; } if (xType === 'Number' && yType === 'String') { return AbstractEqualityComparison(x, ToNumber(y)); } if (xType === 'String' && yType === 'Number') { return AbstractEqualityComparison(ToNumber(x), y); } if (xType === 'Boolean') { return AbstractEqualityComparison(ToNumber(x), y); } if (yType === 'Boolean') { return AbstractEqualityComparison(x, ToNumber(y)); } if ((xType === 'String' || xType === 'Number') && yType === 'Object') { return AbstractEqualityComparison(x, ToPrimitive(y)); } if (xType === 'Object' && (yType === 'String' || yType === 'Number')) { return AbstractEqualityComparison(ToPrimitive(x), y); } return false; }; es-abstract-1.20.4/5/AbstractRelationalComparison.js000066400000000000000000000030661431761430200223270ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Number = GetIntrinsic('%Number%'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var isPrefixOf = require('../helpers/isPrefixOf'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.8.5 // eslint-disable-next-line max-statements module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); } var px; var py; if (LeftFirst) { px = ToPrimitive(x, $Number); py = ToPrimitive(y, $Number); } else { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } var bothStrings = Type(px) === 'String' && Type(py) === 'String'; if (!bothStrings) { var nx = ToNumber(px); var ny = ToNumber(py); if ($isNaN(nx) || $isNaN(ny)) { return undefined; } if ($isFinite(nx) && $isFinite(ny) && nx === ny) { return false; } if (nx === Infinity) { return false; } if (ny === Infinity) { return true; } if (ny === -Infinity) { return false; } if (nx === -Infinity) { return true; } return nx < ny; // by now, these are both nonzero, finite, and not equal } if (isPrefixOf(py, px)) { return false; } if (isPrefixOf(px, py)) { return true; } return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f }; es-abstract-1.20.4/5/CheckObjectCoercible.js000066400000000000000000000005311431761430200204640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); // http://262.ecma-international.org/5.1/#sec-9.10 module.exports = function CheckObjectCoercible(value, optMessage) { if (value == null) { throw new $TypeError(optMessage || ('Cannot call method on ' + value)); } return value; }; es-abstract-1.20.4/5/DateFromTime.js000066400000000000000000000020141431761430200170260ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); var MonthFromTime = require('./MonthFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.5 module.exports = function DateFromTime(t) { var m = MonthFromTime(t); var d = DayWithinYear(t); if (m === 0) { return d + 1; } if (m === 1) { return d - 30; } var leap = InLeapYear(t); if (m === 2) { return d - 58 - leap; } if (m === 3) { return d - 89 - leap; } if (m === 4) { return d - 119 - leap; } if (m === 5) { return d - 150 - leap; } if (m === 6) { return d - 180 - leap; } if (m === 7) { return d - 211 - leap; } if (m === 8) { return d - 242 - leap; } if (m === 9) { return d - 272 - leap; } if (m === 10) { return d - 303 - leap; } if (m === 11) { return d - 333 - leap; } throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m); }; es-abstract-1.20.4/5/Day.js000066400000000000000000000003521431761430200152260ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function Day(t) { return floor(t / msPerDay); }; es-abstract-1.20.4/5/DayFromYear.js000066400000000000000000000004001431761430200166650ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DayFromYear(y) { return (365 * (y - 1970)) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400); }; es-abstract-1.20.4/5/DayWithinYear.js000066400000000000000000000004361431761430200172350ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var DayFromYear = require('./DayFromYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function DayWithinYear(t) { return Day(t) - DayFromYear(YearFromTime(t)); }; es-abstract-1.20.4/5/DaysInYear.js000066400000000000000000000004551431761430200165250ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function DaysInYear(y) { if (modulo(y, 4) !== 0) { return 365; } if (modulo(y, 100) !== 0) { return 366; } if (modulo(y, 400) !== 0) { return 365; } return 366; }; es-abstract-1.20.4/5/FromPropertyDescriptor.js000066400000000000000000000020221431761430200212140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var assertRecord = require('../helpers/assertRecord'); // https://262.ecma-international.org/5.1/#sec-8.10.4 module.exports = function FromPropertyDescriptor(Desc) { if (typeof Desc === 'undefined') { return Desc; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (IsDataDescriptor(Desc)) { return { value: Desc['[[Value]]'], writable: !!Desc['[[Writable]]'], enumerable: !!Desc['[[Enumerable]]'], configurable: !!Desc['[[Configurable]]'] }; } else if (IsAccessorDescriptor(Desc)) { return { get: Desc['[[Get]]'], set: Desc['[[Set]]'], enumerable: !!Desc['[[Enumerable]]'], configurable: !!Desc['[[Configurable]]'] }; } throw new $TypeError('FromPropertyDescriptor must be called with a fully populated Property Descriptor'); }; es-abstract-1.20.4/5/HourFromTime.js000066400000000000000000000005761431761430200171010ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerHour = timeConstants.msPerHour; var HoursPerDay = timeConstants.HoursPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function HourFromTime(t) { return modulo(floor(t / msPerHour), HoursPerDay); }; es-abstract-1.20.4/5/InLeapYear.js000066400000000000000000000007761431761430200165140ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $EvalError = GetIntrinsic('%EvalError%'); var DaysInYear = require('./DaysInYear'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function InLeapYear(t) { var days = DaysInYear(YearFromTime(t)); if (days === 365) { return 0; } if (days === 366) { return 1; } throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days); }; es-abstract-1.20.4/5/IsAccessorDescriptor.js000066400000000000000000000006761431761430200206170ustar00rootroot00000000000000'use strict'; var has = require('has'); var Type = require('./Type'); var assertRecord = require('../helpers/assertRecord'); // https://262.ecma-international.org/5.1/#sec-8.10.1 module.exports = function IsAccessorDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { return false; } return true; }; es-abstract-1.20.4/5/IsCallable.js000066400000000000000000000001541431761430200165040ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.11 module.exports = require('is-callable'); es-abstract-1.20.4/5/IsDataDescriptor.js000066400000000000000000000007011431761430200177130ustar00rootroot00000000000000'use strict'; var has = require('has'); var Type = require('./Type'); var assertRecord = require('../helpers/assertRecord'); // https://262.ecma-international.org/5.1/#sec-8.10.2 module.exports = function IsDataDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { return false; } return true; }; es-abstract-1.20.4/5/IsGenericDescriptor.js000066400000000000000000000010361431761430200204200ustar00rootroot00000000000000'use strict'; var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var Type = require('./Type'); var assertRecord = require('../helpers/assertRecord'); // https://262.ecma-international.org/5.1/#sec-8.10.3 module.exports = function IsGenericDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(Type, 'Property Descriptor', 'Desc', Desc); if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) { return true; } return false; }; es-abstract-1.20.4/5/IsPropertyDescriptor.js000066400000000000000000000010521431761430200206660ustar00rootroot00000000000000'use strict'; // TODO, semver-major: delete this var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var Type = require('./Type'); var IsDataDescriptor = require('./IsDataDescriptor'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); // https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type module.exports = function IsPropertyDescriptor(Desc) { return isPropertyDescriptor({ IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor, Type: Type }, Desc); }; es-abstract-1.20.4/5/MakeDate.js000066400000000000000000000005101431761430200161600ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.13 module.exports = function MakeDate(day, time) { if (!$isFinite(day) || !$isFinite(time)) { return NaN; } return (day * msPerDay) + time; }; es-abstract-1.20.4/5/MakeDay.js000066400000000000000000000016251431761430200160300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $DateUTC = GetIntrinsic('%Date.UTC%'); var $isFinite = require('../helpers/isFinite'); var DateFromTime = require('./DateFromTime'); var Day = require('./Day'); var floor = require('./floor'); var modulo = require('./modulo'); var MonthFromTime = require('./MonthFromTime'); var ToInteger = require('./ToInteger'); var YearFromTime = require('./YearFromTime'); // https://262.ecma-international.org/5.1/#sec-15.9.1.12 module.exports = function MakeDay(year, month, date) { if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { return NaN; } var y = ToInteger(year); var m = ToInteger(month); var dt = ToInteger(date); var ym = y + floor(m / 12); var mn = modulo(m, 12); var t = $DateUTC(ym, mn, 1); if (YearFromTime(t) !== ym || MonthFromTime(t) !== mn || DateFromTime(t) !== 1) { return NaN; } return Day(t) + dt - 1; }; es-abstract-1.20.4/5/MakeTime.js000066400000000000000000000012721431761430200162070ustar00rootroot00000000000000'use strict'; var $isFinite = require('../helpers/isFinite'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var msPerMinute = timeConstants.msPerMinute; var msPerHour = timeConstants.msPerHour; var ToInteger = require('./ToInteger'); // https://262.ecma-international.org/5.1/#sec-15.9.1.11 module.exports = function MakeTime(hour, min, sec, ms) { if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { return NaN; } var h = ToInteger(hour); var m = ToInteger(min); var s = ToInteger(sec); var milli = ToInteger(ms); var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; return t; }; es-abstract-1.20.4/5/MinFromTime.js000066400000000000000000000006141431761430200167000ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerMinute = timeConstants.msPerMinute; var MinutesPerHour = timeConstants.MinutesPerHour; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function MinFromTime(t) { return modulo(floor(t / msPerMinute), MinutesPerHour); }; es-abstract-1.20.4/5/MonthFromTime.js000066400000000000000000000017661431761430200172530ustar00rootroot00000000000000'use strict'; var DayWithinYear = require('./DayWithinYear'); var InLeapYear = require('./InLeapYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.4 module.exports = function MonthFromTime(t) { var day = DayWithinYear(t); if (0 <= day && day < 31) { return 0; } var leap = InLeapYear(t); if (31 <= day && day < (59 + leap)) { return 1; } if ((59 + leap) <= day && day < (90 + leap)) { return 2; } if ((90 + leap) <= day && day < (120 + leap)) { return 3; } if ((120 + leap) <= day && day < (151 + leap)) { return 4; } if ((151 + leap) <= day && day < (181 + leap)) { return 5; } if ((181 + leap) <= day && day < (212 + leap)) { return 6; } if ((212 + leap) <= day && day < (243 + leap)) { return 7; } if ((243 + leap) <= day && day < (273 + leap)) { return 8; } if ((273 + leap) <= day && day < (304 + leap)) { return 9; } if ((304 + leap) <= day && day < (334 + leap)) { return 10; } if ((334 + leap) <= day && day < (365 + leap)) { return 11; } }; es-abstract-1.20.4/5/SameValue.js000066400000000000000000000004631431761430200163760ustar00rootroot00000000000000'use strict'; var $isNaN = require('../helpers/isNaN'); // http://262.ecma-international.org/5.1/#sec-9.12 module.exports = function SameValue(x, y) { if (x === y) { // 0 === -0, but they are not identical. if (x === 0) { return 1 / x === 1 / y; } return true; } return $isNaN(x) && $isNaN(y); }; es-abstract-1.20.4/5/SecFromTime.js000066400000000000000000000006221431761430200166660ustar00rootroot00000000000000'use strict'; var floor = require('./floor'); var modulo = require('./modulo'); var timeConstants = require('../helpers/timeConstants'); var msPerSecond = timeConstants.msPerSecond; var SecondsPerMinute = timeConstants.SecondsPerMinute; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function SecFromTime(t) { return modulo(floor(t / msPerSecond), SecondsPerMinute); }; es-abstract-1.20.4/5/StrictEqualityComparison.js000066400000000000000000000005511431761430200215330ustar00rootroot00000000000000'use strict'; var Type = require('./Type'); // https://262.ecma-international.org/5.1/#sec-11.9.6 module.exports = function StrictEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType !== yType) { return false; } if (xType === 'Undefined' || xType === 'Null') { return true; } return x === y; // shortcut for steps 4-7 }; es-abstract-1.20.4/5/TimeClip.js000066400000000000000000000007241431761430200162220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var $Number = GetIntrinsic('%Number%'); var $isFinite = require('../helpers/isFinite'); var abs = require('./abs'); var ToNumber = require('./ToNumber'); // https://262.ecma-international.org/5.1/#sec-15.9.1.14 module.exports = function TimeClip(time) { if (!$isFinite(time) || abs(time) > 8.64e15) { return NaN; } return $Number(new $Date(ToNumber(time))); }; es-abstract-1.20.4/5/TimeFromYear.js000066400000000000000000000004051431761430200170530ustar00rootroot00000000000000'use strict'; var msPerDay = require('../helpers/timeConstants').msPerDay; var DayFromYear = require('./DayFromYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function TimeFromYear(y) { return msPerDay * DayFromYear(y); }; es-abstract-1.20.4/5/TimeWithinDay.js000066400000000000000000000003671431761430200172360ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerDay = require('../helpers/timeConstants').msPerDay; // https://262.ecma-international.org/5.1/#sec-15.9.1.2 module.exports = function TimeWithinDay(t) { return modulo(t, msPerDay); }; es-abstract-1.20.4/5/ToBoolean.js000066400000000000000000000002021431761430200163650ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.2 module.exports = function ToBoolean(value) { return !!value; }; es-abstract-1.20.4/5/ToInt32.js000066400000000000000000000002551431761430200157150ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.5 module.exports = function ToInt32(x) { return ToNumber(x) >> 0; }; es-abstract-1.20.4/5/ToInteger.js000066400000000000000000000010021431761430200164020ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // http://262.ecma-international.org/5.1/#sec-9.4 module.exports = function ToInteger(value) { var number = ToNumber(value); if ($isNaN(number)) { return 0; } if (number === 0 || !$isFinite(number)) { return number; } return $sign(number) * floor(abs(number)); }; es-abstract-1.20.4/5/ToNumber.js000066400000000000000000000014171431761430200162470ustar00rootroot00000000000000'use strict'; var ToPrimitive = require('./ToPrimitive'); // http://262.ecma-international.org/5.1/#sec-9.3 module.exports = function ToNumber(value) { var prim = ToPrimitive(value, Number); if (typeof prim !== 'string') { return +prim; // eslint-disable-line no-implicit-coercion } // eslint-disable-next-line no-control-regex var trimmed = prim.replace(/^[ \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u0085]+|[ \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u0085]+$/g, ''); if ((/^0[ob]|^[+-]0x/).test(trimmed)) { return NaN; } return +trimmed; // eslint-disable-line no-implicit-coercion }; es-abstract-1.20.4/5/ToObject.js000066400000000000000000000004751431761430200162300ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Object = GetIntrinsic('%Object%'); var CheckObjectCoercible = require('./CheckObjectCoercible'); // http://262.ecma-international.org/5.1/#sec-9.9 module.exports = function ToObject(value) { CheckObjectCoercible(value); return $Object(value); }; es-abstract-1.20.4/5/ToPrimitive.js000066400000000000000000000001631431761430200167640ustar00rootroot00000000000000'use strict'; // http://262.ecma-international.org/5.1/#sec-9.1 module.exports = require('es-to-primitive/es5'); es-abstract-1.20.4/5/ToPropertyDescriptor.js000066400000000000000000000026541431761430200207060ustar00rootroot00000000000000'use strict'; var has = require('has'); var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Type = require('./Type'); var ToBoolean = require('./ToBoolean'); var IsCallable = require('./IsCallable'); // https://262.ecma-international.org/5.1/#sec-8.10.5 module.exports = function ToPropertyDescriptor(Obj) { if (Type(Obj) !== 'Object') { throw new $TypeError('ToPropertyDescriptor requires an object'); } var desc = {}; if (has(Obj, 'enumerable')) { desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable); } if (has(Obj, 'configurable')) { desc['[[Configurable]]'] = ToBoolean(Obj.configurable); } if (has(Obj, 'value')) { desc['[[Value]]'] = Obj.value; } if (has(Obj, 'writable')) { desc['[[Writable]]'] = ToBoolean(Obj.writable); } if (has(Obj, 'get')) { var getter = Obj.get; if (typeof getter !== 'undefined' && !IsCallable(getter)) { throw new $TypeError('getter must be a function'); } desc['[[Get]]'] = getter; } if (has(Obj, 'set')) { var setter = Obj.set; if (typeof setter !== 'undefined' && !IsCallable(setter)) { throw new $TypeError('setter must be a function'); } desc['[[Set]]'] = setter; } if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); } return desc; }; es-abstract-1.20.4/5/ToString.js000066400000000000000000000003411431761430200162600ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $String = GetIntrinsic('%String%'); // http://262.ecma-international.org/5.1/#sec-9.8 module.exports = function ToString(value) { return $String(value); }; es-abstract-1.20.4/5/ToUint16.js000066400000000000000000000010641431761430200161030ustar00rootroot00000000000000'use strict'; var abs = require('./abs'); var floor = require('./floor'); var modulo = require('./modulo'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // http://262.ecma-international.org/5.1/#sec-9.7 module.exports = function ToUint16(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * floor(abs(number)); return modulo(posInt, 0x10000); }; es-abstract-1.20.4/5/ToUint32.js000066400000000000000000000002571431761430200161040ustar00rootroot00000000000000'use strict'; var ToNumber = require('./ToNumber'); // http://262.ecma-international.org/5.1/#sec-9.6 module.exports = function ToUint32(x) { return ToNumber(x) >>> 0; }; es-abstract-1.20.4/5/Type.js000066400000000000000000000006661431761430200154420ustar00rootroot00000000000000'use strict'; // https://262.ecma-international.org/5.1/#sec-8 module.exports = function Type(x) { if (x === null) { return 'Null'; } if (typeof x === 'undefined') { return 'Undefined'; } if (typeof x === 'function' || typeof x === 'object') { return 'Object'; } if (typeof x === 'number') { return 'Number'; } if (typeof x === 'boolean') { return 'Boolean'; } if (typeof x === 'string') { return 'String'; } }; es-abstract-1.20.4/5/WeekDay.js000066400000000000000000000003201431761430200160350ustar00rootroot00000000000000'use strict'; var Day = require('./Day'); var modulo = require('./modulo'); // https://262.ecma-international.org/5.1/#sec-15.9.1.6 module.exports = function WeekDay(t) { return modulo(Day(t) + 4, 7); }; es-abstract-1.20.4/5/YearFromTime.js000066400000000000000000000006271431761430200170610ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Date = GetIntrinsic('%Date%'); var callBound = require('call-bind/callBound'); var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); // https://262.ecma-international.org/5.1/#sec-15.9.1.3 module.exports = function YearFromTime(t) { // largest y such that this.TimeFromYear(y) <= t return $getUTCFullYear(new $Date(t)); }; es-abstract-1.20.4/5/abs.js000066400000000000000000000003171431761430200152570ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $abs = GetIntrinsic('%Math.abs%'); // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function abs(x) { return $abs(x); }; es-abstract-1.20.4/5/floor.js000066400000000000000000000003311431761430200156270ustar00rootroot00000000000000'use strict'; // var modulo = require('./modulo'); var $floor = Math.floor; // http://262.ecma-international.org/5.1/#sec-5.2 module.exports = function floor(x) { // return x - modulo(x, 1); return $floor(x); }; es-abstract-1.20.4/5/modulo.js000066400000000000000000000002501431761430200160050ustar00rootroot00000000000000'use strict'; var mod = require('../helpers/mod'); // https://262.ecma-international.org/5.1/#sec-5.2 module.exports = function modulo(x, y) { return mod(x, y); }; es-abstract-1.20.4/5/msFromTime.js000066400000000000000000000003751431761430200166000ustar00rootroot00000000000000'use strict'; var modulo = require('./modulo'); var msPerSecond = require('../helpers/timeConstants').msPerSecond; // https://262.ecma-international.org/5.1/#sec-15.9.1.10 module.exports = function msFromTime(t) { return modulo(t, msPerSecond); }; es-abstract-1.20.4/CHANGELOG.md000066400000000000000000000671051431761430200156310ustar00rootroot000000000000001.20.4 / 2022-10-06 ================= * [Fix] `ES2021+`: values that truncate to -0 in `ToIntegerOrInfinity` (#146) * [Deps] update `is-callable` 1.20.3 / 2022-09-22 ================= * [Refactor] extract regex tester to `safe-regex-test` package * [Deps] update `get-intrinsic`, `is-callable` * [Dev Deps] update `aud`, `tape` 1.20.2 / 2022-09-01 ================= * [Fix] `ES2020+`: `SameValueNonNumeric`: properly throw on BigInt values * [Deps] update `object.assign`, `get-intrinsic`, `object-inspect` * [Dev Deps] update `array.prototype.indexof`, `diff`, `es-value-fixtures`, `tape` * [meta] `spackle`: always mkdirp new files to be written * [Tests] fix vscode auto-const from 8fc256d 1.20.1 / 2022-05-16 ================= * [Fix] `thisTimeValue`: use `getTime`, not `valueOf`, to get the time value * [Refactor] create `IsArray` helper * [Deps] update `regexp.prototype.flags` * [Dev Deps] use `for-each` instead of `foreach` 1.20.0 / 2022-05-05 ================= * [New] add ES2022 * [New] `ES2015+`: add `ObjectDefineProperties` * [Refactor] create `fromPropertyDescriptor` helper * [Refactor] use `has-property-descriptors` * [Deps] update `string.prototype.trimend`, `string.prototype.trimstart`, `unbox-primitive` * [meta] use `npmignore` to autogenerate an npmignore file * [Dev Deps] update `es-value-fixtures`, `has-bigints`, `functions-have-names` * [Tests] copy GetIntrinsic tests over from `get-intrinsic` 1.19.5 / 2022-04-13 ================= * [Fix] `DefineOwnProperty`: FF 4-22 throws an exception when defining length of an array * [Dev Deps] update `@ljharb/eslint-config` 1.19.4 / 2022-04-12 ================= * [Fix] `ES2015+`: `CreateDataProperty`: a nonwritable but configurable property is still converted to a data property 1.19.3 / 2022-04-11 ================= * [Fix] `ES2015+`: `GetIterator`, `IterableToArrayLike`: in Symbol-less envs, handle boxed string objects * [Robustness] use `exec` instead of `test`, since the latter observably looks up `exec` * [Deps] update `is-shared-array-buffer` * [actions] restrict permissions * [Dev Deps] update `tape` * [Tests] add test coverage * [Tests] avoid a bug in node v4.0 with bound function names 1.19.2 / 2022-03-28 ================= * [Fix] `ES2018+`: `EnumerableOwnPropertyNames`, `ToIntegerOrInfinity`, `UTF16SurrogatePairToCodePoint`: proper function names * [Fix] `ES2015+`: `GetOwnPropertyKeys`/`IsExtensible`/`{Set,Test}IntegrityLevel`: avoid a crash in IE 8 on missing ES5 intrinsics * [Fix] `helpers/DefineOwnProperty`: avoid a crash in IE 8 * [Fix] `ES2015+`: `StringCreate`: properly check for `prototype` being `String.prototype` * [Docs] `ES2015+`: `GetV`: Fix spec URL * [meta] operations: use a URL object instead of a URL string * [meta] remove defunct greenkeeper config * [meta] better `eccheck` command; fix indentation * [Tests] node v0.6 lacks `RegExp.prototype.source` * [Tests] remove a stray `console.log` * [Tests] properly set the lastIndex in IE 8 * [Tests] skip test due to IE 6-8 sparse/undefined bug * [Tests] in IE 8, an empty regex is `` and not `(?:)` * [Tests] ES3 engines don’t have `.bind` * [Tests] avoid needless failures in ES3 engines that don't support descriptors * [Tests] add test to cover https://github.com/tc39/ecma262/issues/2611 * [Deps] update `has-symbols`, `is-negative-zero`, `is-weakref`, `object-inspect` * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object.fromentries`, `safe-publish-latest`, `tape` * [actions] reuse common workflows * [actions] update codecov uploader 1.19.1 / 2021-10-02 ================= * [Fix] `ES2020+`: `CreateRegExpStringIterator`: should not have enumerable methods * [Dev Deps] update `array.prototype.filter`, `array.prototype.indexof` 1.19.0 / 2021-09-30 ================= * [New] `ES2021+`: `IterableToList`: make `method` parameter optional (#61) * [New] add ES2021 * [New] `ES2020+`: add `StringToBigInt`, `ToBigInt`, `ToBigInt64`, `ToBigUint64` * [New] `ES2017`+: add `IsSharedArrayBuffer`, `OrdinaryToPrimitive` * [New] `ES2015+`: add `CharacterRange`, `IsCompatiblePropertyDescriptor` * [New] `ES2020+`: add `CreateRegExpStringIterator` * [Fix] `ES2020+`: `ToBigInt64`/`ToBigUint64`: avoid node v10.4-v10.8 bug with limited BigInt range * [Fix] `ES2020+`: `AbstractRelationalComparison`, `AbstractEqualityComparison`: support BigInt * [Fix] `ES2020+`: `ToBigInt64`/`ToBigUint64`: Improve the definitions of twoSixtyThree and twoSixtyFour (#140) * [meta] do not publish .gitattributes * [Tests] Correct the behavior of `safeBigInt` * [Tests] Exclude dotfiles from the testing sweep (#141) 1.18.7 / 2021-09-28 ================= * [Fix] `getOwnPropertyDescriptor` helper: avoid crashing in IE < 9 * [Fix] `ArraySetLength`: `node` `v0.6` has a bug where array lengths can be Set but not Defined * [eslint] remove unused directive * [Tests] fix spelling 1.18.6 / 2021-09-07 ================= * [Fix] `ES2020+`: `NumberToBigInt`: throw a SyntaxError when BigInts are not supported * [Refactor] extract getSymbolDescription logic to `get-symbol-description` * [Refactor] `ES2018+`: `AbstractRelationalComparison`: use `IsStringPrefix` * [Deps] update `is-callable`, `is-regex`, `is-string` * [Dev Deps] update `@ljharb/eslint-config`, `tape` * [Tests] `GetSubstitution`: add cases 1.18.5 / 2021-08-01 ================= * [meta] remove "exports" (#133) * [Dev Deps] update `eslint` 1.18.4 / 2021-07-29 ================= * [meta] partial revert of b54cfe8525faff482450e843a49d43be3a086225 * [Deps] update `internal-slot`, `object-inspect` * [Dev Deps] update `eslint`, `tape` * [Tests] `ArraySetLength`: increase coverage 1.18.3 / 2021-05-27 ================= * [Fix] `ES2020+`: `ToNumber`: ensure it throws on a BigInt (#130) 1.18.2 / 2021-05-25 ================= * [meta] add `helpers` to "exports" field, for back compat 1.18.1 / 2021-05-25 ================= * [readme] update and clarify entry points * [meta] add "exports" field, with escape hatch * [meta] add `sideEffects` field * [meta] use `prepublishOnly`, for npm 7+ * [eslint] clean up eslint rules * [Deps] update `is-regex`, `is-string`, `object-inspect`, `unbox-primitive` * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` * [actions] disable fail-fast on matrix jobs * [actions] use `node/install` action instead of `node/run` * [actions] update codeql-analysis to new best practices 1.18.0 / 2021-03-03 ================= * [New] add `ES2020`, and a number of additional AOs: See the changelog entries for the prereleases for more information: - [next.3](./CHANGELOG.md#1180-next3--2021-03-01) - [next.2](./CHANGELOG.md#1180-next2--2021-01-17) - [next.1](./CHANGELOG.md#1180-next1--2020-09-30) - [next.0](./CHANGELOG.md#1180-next0--2020-08-14) * [Refactor] `ES5+`: `Abstract Relational Comparison`: increase coverage * [Tests] increase coverage * [Tests] do not run coverage on node 0.6 1.18.0-next.3 / 2021-03-01 ================= * [New] `ES2015`: add `StringGetIndexProperty` * [New] `ES2015+`: add `RegExpCreate`, `SplitMatch`, `StringCreate` * [New] `ES2016-ES2019`: add `UTF16Decode` * [New] `ES2020+`: add `NumberToBigInt` * [New] `ES2020+: add `BigInt::`/`Number::` methods: * [Fix] `ES5`: `ToNumber`: properly refuse to parse ES6+ forms * [Fix] `ES2015+`: `Invoke`: optional argumentsList must be a List of arguments, not a list of arguments * [Fix] `ES2016+`: `UTF16Encoding`: properly return a string code point instead of a numeric code point * [Fix] `ES2020`: `NumberBitwiseOp`: assert that x and y are Numbers * [readme] remove travis/testling badge, fix repo URLs * [meta] `ES2015`: add missing `CreateArrayIterator` AO * [meta] `ES2015-ES2017`: add missing `DaylightSavingTA` AO * [meta] rerun `npm run spackle` to update URLs left after 11d8c8df11c0d15d094a6035afed662e22b440ef * [meta] update ecma URLs * [meta] unignore 2020 operations list * [meta] update operations scripts linting * [meta] refactor getOps script to fetch all years at once * [meta] refactor operations script to keep years in one place * [meta] fix ES2015 spec URL * [Deps] update `has-symbols`, `string.prototype.trimend`, `string.prototype.trimstart`, `get-intrinsic`, `is-callable`, `is-regex` * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `array.prototype.indexof`, `aud`, `es-value-fixtures`, `object.fromentries`, `tape`, `diff` * [operations] detect ES2020+ style `T::` numeric operations * [Tests] increase coverage * [Tests] `BigInt(1e17)` throws on node v10.4-v10.6 * [Tests] improve coverage on `Number::` methods * [Tests] `tape` v5 `.equal` now uses strict equality, so no more need for `is()` * [Tests] improve BigInt:: and Number:: coverage * [Tests] actually run all the helpers tests * [Tests] ensure "expected missing" ops list is accurate * [Tests] abstract away per-operation skips * [Tests] skip BigInt:: tests on envs without BigInts * [Tests] use `es-value-fixtures` * [actions] update workflows 1.18.0-next.2 / 2021-01-17 ================= * [New] `helpers`: add `isByteValue`, `isCodePoint`, `some` * [Fix] `ES2018+`: fix `GetSubstitution` with named captures * [Fix] `ES2020`: `GetIterator`: add omitted `hint` parameter * [Fix] `ES2018`/`ES2019`: `SetFunctionLength`: Infinities should throw * [Fix] `ES2020`: `ToIndex` uses `SameValue` instead of `SameValueZero` * [Fix] `ES2020`: `CopyDataProperties` uses `CreateDataPropertyOrThrow` instead of `CreateDataProperty` * [Refactor] use extracted `call-bind` instead of local helpers * [Refactor] use extracted `get-intrinsic` package * [Deps] update `call-bind`, `get-intrinsic`, `is-callable`, `is-negative-zero`, `is-regex`, `object-inspect`, `object.assign`, `string.prototype.trimend`, `string.prototype.trimstart` * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `array.prototype.indexof`, `aud`, `diff`, `functions-have-names`, `has-bigints`, `has-strict-mode`, `object-is`, `object.fromentries`, `tape` * [actions] switch Automatic Rebase workflow to `pull_request_target` event * [actions] add "Allow Edits" workflow * [meta] pin cheerio to v1.0.0-rc.3, to fix getOps * [meta] make all URLs consistent, and point to spec artifacts * [meta] refactor `deltas` script; update eslint on operations scripts * [meta] do not publish .github dir (#123) * [Tests] add `v.notNonNegativeIntegers`, `v.nonConstructorFunctions` * [Tests] migrate tests to Github Actions * [Tests] run coverage on all tests * [Tests] add `npm run test:ses` 1.18.0-next.1 / 2020-09-30 ================= * [Fix] `ES2020`: `ToInteger`: `-0` should always be normalized to `+0` (#116) * [patch] `GetIntrinsic`: Adapt to override-mistake-fix pattern (#115) * [Fix] `callBind`: ensure compatibility with SES * [Deps] update `is-callable`, `object.assign` * [Dev Deps] update `eslint`, `@ljharb/eslint-config` * [eslint] fix warning * [Tests] temporarily allow SES tests to fail (#115) * [Tests] ses-compat - initialize module after ses lockdown (#113) * [Tests] [Refactor] use defineProperty helper rather than assignment * [Tests] [Refactor] clean up defineProperty test helper 1.18.0-next.0 / 2020-08-14 ================= * [New] add `ES2020` * [New] `GetIntrinsic`: add `%AggregateError%`, `%FinalizationRegistry%`, and `%WeakRef%` * [New] `ES5`+: add `abs`, `floor`; use `modulo` consistently * [New] `GetIntrinsic`: Cache accessed intrinsics (#98) * [New] `GetIntrinsic`: Add ES201x function intrinsics (#97) * [New] `ES2015`+: add `QuoteJSONString`, `OrdinaryCreateFromConstructor` * [New] `ES2017`+: add `StringGetOwnProperty` * [New] `ES2016`+: add `UTF16Encoding` * [New] `ES2018`+: add `SetFunctionLength`, `UnicodeEscape` * [New] add `isLeadingSurrogate`/`isTrailingSurrogate` helpers * [Fix] `ES5`+: `ToPropertyDescriptor`: use intrinsic TypeError * [Fix] `ES2018+`: `CopyDataProperties`/`NumberToString`: use intrinsic TypeError * [Deps] update `is-regex`, `object-inspect` * [Dev Deps] update `eslint` 1.17.7 / 2020-09-30 ================= * [Fix] `ES2020`: `ToInteger`: `-0` should always be normalized to `+0` (#116) * [patch] `GetIntrinsic`: Adapt to override-mistake-fix pattern (#115) * [Fix] `callBind`: ensure compatibility with SES * [Deps] update `is-callable`, `is-regex`, `object-inspect`, `object.assign` * [Dev Deps] update `eslint`, `@ljharb/eslint-config` 1.17.6 / 2020-06-13 ================= * [Fix] `helpers/getSymbolDescription`: use the global Symbol registry when available (#92) * [Fix] `ES2015+`: `IsConstructor`: when `Reflect.construct` is available, be spec-accurate (#93) * [Fix] `ES2015+`: `Set`: Always return boolean value (#101) * [Fix] `ES2015+`: `Set`: ensure exceptions are thrown in IE 9 when requested * [Fix] Use `Reflect.apply(…)` if available (#99) * [Fix] `helpers/floor`: module-cache `Math.floor` * [Fix] `helpers/getSymbolDescription`: Prefer bound `description` getter when present * [Fix] `2016`: Use `getIteratorMethod` in `IterableToArrayLike` (#94) * [Fix] `helpers/OwnPropertyKeys`: Use `Reflect.ownKeys(…)` if available (#91) * [Fix] `2018+`: Fix `CopyDataProperties` depending on `this` (#95) * [meta] mark spackled files as autogenerated * [meta] `Type`: fix spec URL * [meta] `ES2015`: complete ops list * [Deps] update `is‑callable`, `is‑regex` * [Deps] switch from `string.prototype.trimleft`/`string.prototype.trimright` to `string.prototype.trimstart`/`string.prototype.trimend` * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `in-publish`, `object-is`, `tape`; add `aud` * [eslint] `helpers/isPropertyDescriptor`: fix indentation * [Tests] `helpers/getSymbolDescription`: add test cases; some envs have `Symbol.for` but can not infer a name (#92) * [Tests] try out CodeQL analysis * [Tests] reformat expected missing ops * [Tests] Run tests with `undefined` this (#96) 1.17.5 / 2020-03-22 ================= * [Fix] `CreateDataProperty`: update an existing property * [Fix] run missing spackle from cd7504701879ddea0f5981e99cbcf93bfea9171d * [Dev Deps] update `make-arrow-function`, `tape`, `@ljharb/eslint-config` 1.17.4 / 2020-01-21 ================= * [Fix] `2015+`: add code to handle IE 8’s problems * [Tests] fix tests for IE 8 1.17.3 / 2020-01-19 ================= * [Fix] `ObjectCreate` `2015+`: Fall back to `__proto__` and normal `new` in older browsers * [Fix] `GetIntrinsic`: ensure the `allowMissing` property actually works on dotted intrinsics 1.17.2 / 2020-01-14 ================= * [Fix] `helpers/OwnPropertyKeys`: include non-enumerables too 1.17.1 / 2020-01-14 ================= * [Refactor] add `OwnPropertyKeys` helper, use it in `CopyDataProperties` * [Refactor] `IteratorClose`: remove useless assignment * [Dev Deps] update `eslint`, `tape`, `diff` 1.17.0 / 2019-12-20 ================= * [New] Split up each operation into its own file (prereleased) * [Fix] `GetIntrinsic`: IE 8 has a broken `Object.getOwnPropertyDescriptor` * [Fix] `object.assign` is a runtime dep (prereleased) * [Refactor] `GetIntrinsic`: remove the internal property salts, since % already handles that * [Refactor] `GetIntrinsic`: further simplification * [Deps] update `is-callable`, `string.prototype.trimleft`, `string.prototype.trimright`, `is-regex` * [Dev Deps] update `@ljharb/eslint-config`, `object-is`, `object.fromentries`, `tape` * [Tests] add `.eslintignore` * [meta] remove unused Makefile and associated utils * [meta] only run spackle script in publish (#78) (prereleased) 1.17.0-next.1 / 2019-12-11 ================= * [Fix] `object.assign` is a runtime dep * [meta] only run spackle script in publish (#78) 1.17.0-next.0 / 2019-12-11 ================= * [New] Split up each operation into its own file 1.16.3 / 2019-12-04 ================= * [Fix] `GetIntrinsic`: when given a path to a getter, return the actual getter * [Dev Deps] update `eslint` 1.16.2 / 2019-11-24 ================= * [Fix] IE 6-7 lack JSON * [Fix] IE 6-8 strings can’t use array slice, they need string slice * [Dev Deps] update `eslint` 1.16.1 / 2019-11-24 ================= * [Fix] `GetIntrinsics`: turns out IE 8 throws when `Object.getOwnPropertyDescriptor(arguments);`, and does not throw on `callee` anyways * [Deps] update `es-to-primitive`, `has-symbols`, `object-inspect` * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest` * [meta] re-include year files inside `operations` * [meta] add `funding` field * [actions] add Automatic Rebase github action * [Tests] use shared travis-ci config * [Tests] disable `check-coverage`, and let codecov do it 1.16.0 / 2019-10-18 ================= * [New] `ES2015+`: add `SetFunctionName` * [New] `ES2015+`: add `GetPrototypeFromConstructor`, with caveats * [New] `ES2015+`: add `CreateListFromArrayLike` * [New] `ES2016+`: add `OrdinarySetPrototypeOf` * [New] `ES2016+`: add `OrdinaryGetPrototypeOf` * [New] add `getSymbolDescription` and `getInferredName` helpers * [Fix] `GetIterator`: add fallback for pre-Symbol environments, tests * [Dev Deps] update `object.fromentries` * [Tests] add `node` `v12.2` 1.15.0 / 2019-10-02 ================= * [New] `ES2018`+: add `DateString`, `TimeString` * [New] `ES2015`+: add `ToDateString` * [New] `ES5`+: add `msFromTime`, `SecFromTime`, `MinFromTime`, `HourFromTime`, `TimeWithinDay`, `Day`, `DayFromYear`, `TimeFromYear`, `YearFromTime`, `WeekDay`, `DaysInYear`, `InLeapYear`, `DayWithinYear`, `MonthFromTime`, `DateFromTime`, `MakeDay`, `MakeDate`, `MakeTime`, `TimeClip`, `modulo` * [New] add `regexTester` helper * [New] add `callBound` helper * [New] add ES2020’s intrinsic dot notation * [New] add `isPrefixOf` helper * [New] add `maxSafeInteger` helper * [Deps] update `string.prototype.trimleft`, `string.prototype.trimright` * [Dev Deps] update `eslint` * [Tests] on `node` `v12.11` * [meta] npmignore operations scripts; add "deltas" 1.14.2 / 2019-09-08 ================= * [Fix] `ES2016`: `IterableToArrayLike`: add proper fallback for strings, pre-Symbols * [Tests] on `node` `v12.10` 1.14.1 / 2019-09-03 ================= * [meta] republish with some extra files removed 1.14.0 / 2019-09-02 ================= * [New] add ES2019 * [New] `ES2017+`: add `IterableToList` * [New] `ES2016`: add `IterableToArrayLike` * [New] `ES2015+`: add `ArrayCreate`, `ArraySetLength`, `OrdinaryDefineOwnProperty`, `OrdinaryGetOwnProperty`, `OrdinaryHasProperty`, `CreateHTML`, `GetOwnPropertyKeys`, `InstanceofOperator`, `SymbolDescriptiveString`, `GetSubstitution`, `ValidateAndApplyPropertyDescriptor`, `IsPromise`, `OrdinaryHasInstance`, `TestIntegrityLevel`, `SetIntegrityLevel` * [New] add `callBind` helper, and use it * [New] add helpers: `isPropertyDescriptor`, `every` * [New] ES5+: add `Abstract Relational Comparison` * [New] ES5+: add `Abstract Equality Comparison`, `Strict Equality Comparison` * [Fix] `ES2015+`: `GetIterator`: only require native Symbols when `method` is omitted * [Fix] `ES2015`: `Call`: error message now properly displays Symbols using `object-inspect` * [Fix] `ES2015+`: `ValidateAndApplyPropertyDescriptor`: use ES2017 logic to bypass spec bugs * [Fix] `ES2015+`: `CreateDataProperty`, `DefinePropertyOrThrow`, `ValidateAndApplyPropertyDescriptor`: add fallbacks for ES3 * [Fix] `ES2015+`: `FromPropertyDescriptor`: no longer requires a fully complete Property Descriptor * [Fix] `ES5`: `IsPropertyDescriptor`: call into `IsDataDescriptor` and `IsAccessorDescriptor` * [Refactor] use `has-symbols` for Symbol detection * [Fix] `helpers/assertRecord`: remove `console.log` * [Deps] update `object-keys` * [readme] add security note * [meta] change http URLs to https * [meta] linter cleanup * [meta] fix getOps script * [meta] add FUNDING.yml * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `semver`, `replace`, `cheerio`, `tape` * [Tests] up to `node` `v12.9`, `v11.15`, `v10.16`, `v8.16`, `v6.17` * [Tests] temporarily allow node 0.6 to fail; segfaulting in travis * [Tests] use the values helper more in es5 tests * [Tests] fix linting to apply to all files * [Tests] run `npx aud` only on prod deps * [Tests] add v.descriptors helpers * [Tests] use `npx aud` instead of `npm audit` with hoops * [Tests] use `eclint` instead of `editorconfig-tools` * [Tests] some intrinsic cleanup * [Tests] migrate es5 tests to use values helper * [Tests] add some missing ES2015 ops 1.13.0 / 2019-01-02 ================= * [New] add ES2018 * [New] add ES2015/ES2016: EnumerableOwnNames; ES2017: EnumerableOwnProperties * [New] `ES2015+`: add `thisBooleanValue`, `thisNumberValue`, `thisStringValue`, `thisTimeValue` * [New] `ES2015+`: add `DefinePropertyOrThrow`, `DeletePropertyOrThrow`, `CreateMethodProperty` * [New] add `assertRecord` helper * [Deps] update `is-callable`, `has`, `object-keys`, `es-to-primitive` * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `semver`, `safe-publish-latest`, `replace` * [Tests] use `npm audit` instead of `nsp` * [Tests] remove `jscs` * [Tests] up to `node` `v11.6`, `v10.15`, `v8.15`, `v6.16` * [Tests] move descriptor factories to `values` helper * [Tests] add `getOps` to programmatically fetch abstract operation names 1.12.0 / 2018-05-31 ================= * [New] add `GetIntrinsic` entry point * [New] `ES2015`+: add `ObjectCreate` * [Robustness]: `ES2015+`: ensure `Math.{abs,floor}` and `Function.call` are cached 1.11.0 / 2018-03-21 ================= * [New] `ES2015+`: add iterator abstract ops * [Dev Deps] update `eslint`, `nsp`, `object.assign`, `semver`, `tape` * [Tests] up to `node` `v9.8`, `v8.10`, `v6.13` 1.10.0 / 2017-11-24 ================= * [New] ES2015+: `AdvanceStringIndex` * [Dev Deps] update `eslint`, `nsp` * [Tests] require node 0.6 to pass again * [Tests] up to `node` `v9.2`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS 1.9.0 / 2017-09-30 ================= * [New] `es2015+`: add `ArraySpeciesCreate` * [New] ES2015+: add `CreateDataProperty` and `CreateDataPropertyOrThrow` * [Tests] consolidate duplicated tests * [Tests] increase coverage * [Dev Deps] update `nsp`, `eslint` 1.8.2 / 2017-09-03 ================= * [Fix] `es2015`+: `ToNumber`: provide the proper hint for Date objects (#27) * [Dev Deps] update `eslint` 1.8.1 / 2017-08-30 ================= * [Fix] ES2015+: `ToPropertyKey`: should return a symbol for Symbols (#26) * [Deps] update `function-bind` * [Dev Deps] update `eslint`, `@ljharb/eslint-config` * [Docs] github broke markdown parsing 1.8.0 / 2017-08-04 ================= * [New] add ES2017 * [New] move es6+ to es2015+; leave es6/es7 as aliases * [New] ES5+: add `IsPropertyDescriptor`, `IsAccessorDescriptor`, `IsDataDescriptor`, `IsGenericDescriptor`, `FromPropertyDescriptor`, `ToPropertyDescriptor` * [New] ES2015+: add `CompletePropertyDescriptor`, `Set`, `HasOwnProperty`, `HasProperty`, `IsConcatSpreadable`, `Invoke`, `CreateIterResultObject`, `RegExpExec` * [Fix] es7/es2016: do not mutate ES6 * [Fix] assign helper only supports one source * [Deps] update `is-regex` * [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config` * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `semver`, `tape` * [Tests] add tests for missing and excess operations * [Tests] add codecov for coverage * [Tests] up to `node` `v8.2`, `v7.10`, `v6.11`, `v4.8`; newer npm breaks on older node * [Tests] use same lists of value types across tests; ensure tests are the same when ops are the same * [Tests] ES2015: add ToNumber symbol tests * [Tests] switch to `nyc` for code coverage * [Tests] make IsRegExp tests consistent across editions 1.7.0 / 2017-01-22 ================= * [New] ES6: Add `GetMethod` (#16) * [New] ES6: Add `GetV` (#16) * [New] ES6: Add `Get` (#17) * [Tests] up to `node` `v7.4`, `v6.9`, `v4.6`; improve test matrix * [Dev Deps] update `tape`, `nsp`, `eslint`, `@ljharb/eslint-config`, `safe-publish-latest` 1.6.1 / 2016-08-21 ================= * [Fix] ES6: IsConstructor should return true for `class` constructors. 1.6.0 / 2016-08-20 ================= * [New] ES5 / ES6: add `Type` * [New] ES6: `SpeciesConstructor` * [Dev Deps] update `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`; add `safe-publish-latest` * [Tests] up to `node` `v6.4`, `v5.12`, `v4.5` 1.5.1 / 2016-05-30 ================= * [Fix] `ES.IsRegExp`: actually look up `Symbol.match` on the argument * [Refactor] create `isNaN` helper * [Deps] update `is-callable`, `function-bind` * [Deps] update `es-to-primitive`, fix ES5 tests * [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `tape`, `nsp` * [Tests] up to `node` `v6.2`, `v5.11`, `v4.4` * [Tests] use pretest/posttest for linting/security 1.5.0 / 2015-12-27 ================= * [New] adds `Symbol.toPrimitive` support via `es-to-primitive` * [Deps] update `is-callable`, `es-to-primitive` * [Dev Deps] update `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`, `tape` * [Tests] up to `node` `v5.3` 1.4.3 / 2015-11-04 ================= * [Fix] `ES6.ToNumber`: should give `NaN` for explicitly signed hex strings (#4) * [Refactor] `ES6.ToNumber`: No need to double-trim * [Refactor] group tests better * [Tests] should still pass on `node` `v0.8` 1.4.2 / 2015-11-02 ================= * [Fix] ensure `ES.ToNumber` trims whitespace, and does not trim non-whitespace (#3) 1.4.1 / 2015-10-31 ================= * [Fix] ensure only 0-1 are valid binary and 0-7 are valid octal digits (#2) * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` * [Tests] on `node` `v5.0` * [Tests] fix npm upgrades for older node versions * package.json: use object form of "authors", add "contributors" 1.4.0 / 2015-09-26 ================= * [Deps] update `is-callable` * [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` * [Tests] on `node` `v4.2` * [New] Add `SameValueNonNumber` to ES7 1.3.2 / 2015-09-26 ================= * [Fix] Fix `ES6.IsRegExp` to properly handle `Symbol.match`, per spec. * [Tests] up to `io.js` `v3.3`, `node` `v4.1` * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` 1.3.1 / 2015-08-15 ================= * [Fix] Ensure that objects that `toString` to a binary or octal literal also convert properly 1.3.0 / 2015-08-15 ================= * [New] ES6’s ToNumber now supports binary and octal literals. * [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `tape` * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG * [Tests] up to `io.js` `v3.0` 1.2.2 / 2015-07-28 ================= * [Fix] Both `ES5.CheckObjectCoercible` and `ES6.RequireObjectCoercible` return the value if they don't throw. * [Tests] Test on latest `io.js` versions. * [Dev Deps] Update `eslint`, `jscs`, `tape`, `semver`, `covert`, `nsp` 1.2.1 / 2015-03-20 ================= * Fix `isFinite` helper. 1.2.0 / 2015-03-19 ================= * Use `es-to-primitive` for ToPrimitive methods. * Test on latest `io.js` versions; allow failures on all but 2 latest `node`/`io.js` versions. 1.1.2 / 2015-03-20 ================= * Fix isFinite helper. 1.1.1 / 2015-03-19 ================= * Fix isPrimitive check for functions * Update `eslint`, `editorconfig-tools`, `semver`, `nsp` 1.1.0 / 2015-02-17 ================= * Add ES7 export (non-default). * All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. * Test on `iojs-v1.2`. 1.0.1 / 2015-01-30 ================= * Use `is-callable` instead of an internal function. * Update `tape`, `jscs`, `nsp`, `eslint` 1.0.0 / 2015-01-10 ================= * v1.0.0 es-abstract-1.20.4/GetIntrinsic.js000066400000000000000000000001311431761430200167420ustar00rootroot00000000000000'use strict'; // TODO: remove, semver-major module.exports = require('get-intrinsic'); es-abstract-1.20.4/LICENSE000066400000000000000000000020711431761430200150140ustar00rootroot00000000000000The MIT License (MIT) Copyright (C) 2015 Jordan Harband Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. es-abstract-1.20.4/README.md000066400000000000000000000036211431761430200152700ustar00rootroot00000000000000# es-abstract [![Version Badge][npm-version-svg]][package-url] [![dependency status][deps-svg]][deps-url] [![dev dependency status][dev-deps-svg]][dev-deps-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][npm-badge-png]][package-url] ECMAScript spec abstract operations. Every operation is available by edition/year and by name - for example, `es-abstract/2020/Call` gives you the `Call` operation from ES2020, `es-abstract/5/Type` gives you the `Type` operation from ES5. All abstract operations are also available under an `es5`/`es2015`/`es2016`/`es2017`/`es2018`/`es2019`/`es2020`/`es2021` entry point, and as a property on the `main` export, but using deep imports is highly encouraged for bundle size and performance reasons. Non-deep entry points will be removed in the next semver-major release. ## Example ```js var ES = require('es-abstract'); var assert = require('assert'); assert(ES.isCallable(function () {})); assert(!ES.isCallable(/a/g)); ``` ## Tests Simply clone the repo, `npm install`, and run `npm test` ## Security Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. [package-url]: https://npmjs.org/package/es-abstract [npm-version-svg]: https://versionbadg.es/ljharb/es-abstract.svg [deps-svg]: https://david-dm.org/ljharb/es-abstract.svg [deps-url]: https://david-dm.org/ljharb/es-abstract [dev-deps-svg]: https://david-dm.org/ljharb/es-abstract/dev-status.svg [dev-deps-url]: https://david-dm.org/ljharb/es-abstract#info=devDependencies [npm-badge-png]: https://nodei.co/npm/es-abstract.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/es-abstract.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/es-abstract.svg [downloads-url]: https://npm-stat.com/charts.html?package=es-abstract es-abstract-1.20.4/es2015.js000066400000000000000000000140351431761430200152670ustar00rootroot00000000000000'use strict'; /* eslint global-require: 0 */ // https://ecma-international.org/ecma-262/6.0/#sec-abstract-operations var ES6 = { 'Abstract Equality Comparison': require('./2015/AbstractEqualityComparison'), 'Abstract Relational Comparison': require('./2015/AbstractRelationalComparison'), 'Strict Equality Comparison': require('./2015/StrictEqualityComparison'), abs: require('./2015/abs'), AdvanceStringIndex: require('./2015/AdvanceStringIndex'), ArrayCreate: require('./2015/ArrayCreate'), ArraySetLength: require('./2015/ArraySetLength'), ArraySpeciesCreate: require('./2015/ArraySpeciesCreate'), Call: require('./2015/Call'), CanonicalNumericIndexString: require('./2015/CanonicalNumericIndexString'), CharacterRange: require('./2015/CharacterRange'), CompletePropertyDescriptor: require('./2015/CompletePropertyDescriptor'), CreateDataProperty: require('./2015/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2015/CreateDataPropertyOrThrow'), CreateHTML: require('./2015/CreateHTML'), CreateIterResultObject: require('./2015/CreateIterResultObject'), CreateListFromArrayLike: require('./2015/CreateListFromArrayLike'), CreateMethodProperty: require('./2015/CreateMethodProperty'), DateFromTime: require('./2015/DateFromTime'), Day: require('./2015/Day'), DayFromYear: require('./2015/DayFromYear'), DaysInYear: require('./2015/DaysInYear'), DayWithinYear: require('./2015/DayWithinYear'), DefinePropertyOrThrow: require('./2015/DefinePropertyOrThrow'), DeletePropertyOrThrow: require('./2015/DeletePropertyOrThrow'), EnumerableOwnNames: require('./2015/EnumerableOwnNames'), floor: require('./2015/floor'), FromPropertyDescriptor: require('./2015/FromPropertyDescriptor'), Get: require('./2015/Get'), GetIterator: require('./2015/GetIterator'), GetMethod: require('./2015/GetMethod'), GetOwnPropertyKeys: require('./2015/GetOwnPropertyKeys'), GetPrototypeFromConstructor: require('./2015/GetPrototypeFromConstructor'), GetSubstitution: require('./2015/GetSubstitution'), GetV: require('./2015/GetV'), HasOwnProperty: require('./2015/HasOwnProperty'), HasProperty: require('./2015/HasProperty'), HourFromTime: require('./2015/HourFromTime'), InLeapYear: require('./2015/InLeapYear'), InstanceofOperator: require('./2015/InstanceofOperator'), Invoke: require('./2015/Invoke'), IsAccessorDescriptor: require('./2015/IsAccessorDescriptor'), IsArray: require('./2015/IsArray'), IsCallable: require('./2015/IsCallable'), IsCompatiblePropertyDescriptor: require('./2015/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2015/IsConcatSpreadable'), IsConstructor: require('./2015/IsConstructor'), IsDataDescriptor: require('./2015/IsDataDescriptor'), IsExtensible: require('./2015/IsExtensible'), IsGenericDescriptor: require('./2015/IsGenericDescriptor'), IsInteger: require('./2015/IsInteger'), IsPromise: require('./2015/IsPromise'), IsPropertyDescriptor: require('./2015/IsPropertyDescriptor'), IsPropertyKey: require('./2015/IsPropertyKey'), IsRegExp: require('./2015/IsRegExp'), IteratorClose: require('./2015/IteratorClose'), IteratorComplete: require('./2015/IteratorComplete'), IteratorNext: require('./2015/IteratorNext'), IteratorStep: require('./2015/IteratorStep'), IteratorValue: require('./2015/IteratorValue'), MakeDate: require('./2015/MakeDate'), MakeDay: require('./2015/MakeDay'), MakeTime: require('./2015/MakeTime'), MinFromTime: require('./2015/MinFromTime'), modulo: require('./2015/modulo'), MonthFromTime: require('./2015/MonthFromTime'), msFromTime: require('./2015/msFromTime'), ObjectCreate: require('./2015/ObjectCreate'), ObjectDefineProperties: require('./2015/ObjectDefineProperties'), OrdinaryCreateFromConstructor: require('./2015/OrdinaryCreateFromConstructor'), OrdinaryDefineOwnProperty: require('./2015/OrdinaryDefineOwnProperty'), OrdinaryGetOwnProperty: require('./2015/OrdinaryGetOwnProperty'), OrdinaryHasInstance: require('./2015/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2015/OrdinaryHasProperty'), QuoteJSONString: require('./2015/QuoteJSONString'), RegExpCreate: require('./2015/RegExpCreate'), RegExpExec: require('./2015/RegExpExec'), RequireObjectCoercible: require('./2015/RequireObjectCoercible'), SameValue: require('./2015/SameValue'), SameValueZero: require('./2015/SameValueZero'), SecFromTime: require('./2015/SecFromTime'), Set: require('./2015/Set'), SetFunctionName: require('./2015/SetFunctionName'), SetIntegrityLevel: require('./2015/SetIntegrityLevel'), SpeciesConstructor: require('./2015/SpeciesConstructor'), SplitMatch: require('./2015/SplitMatch'), StringCreate: require('./2015/StringCreate'), StringGetIndexProperty: require('./2015/StringGetIndexProperty'), SymbolDescriptiveString: require('./2015/SymbolDescriptiveString'), TestIntegrityLevel: require('./2015/TestIntegrityLevel'), thisBooleanValue: require('./2015/thisBooleanValue'), thisNumberValue: require('./2015/thisNumberValue'), thisStringValue: require('./2015/thisStringValue'), thisTimeValue: require('./2015/thisTimeValue'), TimeClip: require('./2015/TimeClip'), TimeFromYear: require('./2015/TimeFromYear'), TimeWithinDay: require('./2015/TimeWithinDay'), ToBoolean: require('./2015/ToBoolean'), ToDateString: require('./2015/ToDateString'), ToInt16: require('./2015/ToInt16'), ToInt32: require('./2015/ToInt32'), ToInt8: require('./2015/ToInt8'), ToInteger: require('./2015/ToInteger'), ToLength: require('./2015/ToLength'), ToNumber: require('./2015/ToNumber'), ToObject: require('./2015/ToObject'), ToPrimitive: require('./2015/ToPrimitive'), ToPropertyDescriptor: require('./2015/ToPropertyDescriptor'), ToPropertyKey: require('./2015/ToPropertyKey'), ToString: require('./2015/ToString'), ToUint16: require('./2015/ToUint16'), ToUint32: require('./2015/ToUint32'), ToUint8: require('./2015/ToUint8'), ToUint8Clamp: require('./2015/ToUint8Clamp'), Type: require('./2015/Type'), ValidateAndApplyPropertyDescriptor: require('./2015/ValidateAndApplyPropertyDescriptor'), WeekDay: require('./2015/WeekDay'), YearFromTime: require('./2015/YearFromTime') }; module.exports = ES6; es-abstract-1.20.4/es2016.js000066400000000000000000000144671431761430200153010ustar00rootroot00000000000000'use strict'; /* eslint global-require: 0 */ // https://262.ecma-international.org/7.0/#sec-abstract-operations var ES2016 = { 'Abstract Equality Comparison': require('./2016/AbstractEqualityComparison'), 'Abstract Relational Comparison': require('./2016/AbstractRelationalComparison'), 'Strict Equality Comparison': require('./2016/StrictEqualityComparison'), abs: require('./2016/abs'), AdvanceStringIndex: require('./2016/AdvanceStringIndex'), ArrayCreate: require('./2016/ArrayCreate'), ArraySetLength: require('./2016/ArraySetLength'), ArraySpeciesCreate: require('./2016/ArraySpeciesCreate'), Call: require('./2016/Call'), CanonicalNumericIndexString: require('./2016/CanonicalNumericIndexString'), CharacterRange: require('./2016/CharacterRange'), CompletePropertyDescriptor: require('./2016/CompletePropertyDescriptor'), CreateDataProperty: require('./2016/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2016/CreateDataPropertyOrThrow'), CreateHTML: require('./2016/CreateHTML'), CreateIterResultObject: require('./2016/CreateIterResultObject'), CreateListFromArrayLike: require('./2016/CreateListFromArrayLike'), CreateMethodProperty: require('./2016/CreateMethodProperty'), DateFromTime: require('./2016/DateFromTime'), Day: require('./2016/Day'), DayFromYear: require('./2016/DayFromYear'), DaysInYear: require('./2016/DaysInYear'), DayWithinYear: require('./2016/DayWithinYear'), DefinePropertyOrThrow: require('./2016/DefinePropertyOrThrow'), DeletePropertyOrThrow: require('./2016/DeletePropertyOrThrow'), EnumerableOwnNames: require('./2016/EnumerableOwnNames'), floor: require('./2016/floor'), FromPropertyDescriptor: require('./2016/FromPropertyDescriptor'), Get: require('./2016/Get'), GetIterator: require('./2016/GetIterator'), GetMethod: require('./2016/GetMethod'), GetOwnPropertyKeys: require('./2016/GetOwnPropertyKeys'), GetPrototypeFromConstructor: require('./2016/GetPrototypeFromConstructor'), GetSubstitution: require('./2016/GetSubstitution'), GetV: require('./2016/GetV'), HasOwnProperty: require('./2016/HasOwnProperty'), HasProperty: require('./2016/HasProperty'), HourFromTime: require('./2016/HourFromTime'), InLeapYear: require('./2016/InLeapYear'), InstanceofOperator: require('./2016/InstanceofOperator'), Invoke: require('./2016/Invoke'), IsAccessorDescriptor: require('./2016/IsAccessorDescriptor'), IsArray: require('./2016/IsArray'), IsCallable: require('./2016/IsCallable'), IsCompatiblePropertyDescriptor: require('./2016/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2016/IsConcatSpreadable'), IsConstructor: require('./2016/IsConstructor'), IsDataDescriptor: require('./2016/IsDataDescriptor'), IsExtensible: require('./2016/IsExtensible'), IsGenericDescriptor: require('./2016/IsGenericDescriptor'), IsInteger: require('./2016/IsInteger'), IsPromise: require('./2016/IsPromise'), IsPropertyDescriptor: require('./2016/IsPropertyDescriptor'), IsPropertyKey: require('./2016/IsPropertyKey'), IsRegExp: require('./2016/IsRegExp'), IterableToArrayLike: require('./2016/IterableToArrayLike'), IteratorClose: require('./2016/IteratorClose'), IteratorComplete: require('./2016/IteratorComplete'), IteratorNext: require('./2016/IteratorNext'), IteratorStep: require('./2016/IteratorStep'), IteratorValue: require('./2016/IteratorValue'), MakeDate: require('./2016/MakeDate'), MakeDay: require('./2016/MakeDay'), MakeTime: require('./2016/MakeTime'), MinFromTime: require('./2016/MinFromTime'), modulo: require('./2016/modulo'), MonthFromTime: require('./2016/MonthFromTime'), msFromTime: require('./2016/msFromTime'), ObjectCreate: require('./2016/ObjectCreate'), ObjectDefineProperties: require('./2016/ObjectDefineProperties'), OrdinaryCreateFromConstructor: require('./2016/OrdinaryCreateFromConstructor'), OrdinaryDefineOwnProperty: require('./2016/OrdinaryDefineOwnProperty'), OrdinaryGetOwnProperty: require('./2016/OrdinaryGetOwnProperty'), OrdinaryGetPrototypeOf: require('./2016/OrdinaryGetPrototypeOf'), OrdinaryHasInstance: require('./2016/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2016/OrdinaryHasProperty'), OrdinarySetPrototypeOf: require('./2016/OrdinarySetPrototypeOf'), QuoteJSONString: require('./2016/QuoteJSONString'), RegExpCreate: require('./2016/RegExpCreate'), RegExpExec: require('./2016/RegExpExec'), RequireObjectCoercible: require('./2016/RequireObjectCoercible'), SameValue: require('./2016/SameValue'), SameValueNonNumber: require('./2016/SameValueNonNumber'), SameValueZero: require('./2016/SameValueZero'), SecFromTime: require('./2016/SecFromTime'), Set: require('./2016/Set'), SetFunctionName: require('./2016/SetFunctionName'), SetIntegrityLevel: require('./2016/SetIntegrityLevel'), SpeciesConstructor: require('./2016/SpeciesConstructor'), SplitMatch: require('./2016/SplitMatch'), StringCreate: require('./2016/StringCreate'), SymbolDescriptiveString: require('./2016/SymbolDescriptiveString'), TestIntegrityLevel: require('./2016/TestIntegrityLevel'), thisBooleanValue: require('./2016/thisBooleanValue'), thisNumberValue: require('./2016/thisNumberValue'), thisStringValue: require('./2016/thisStringValue'), thisTimeValue: require('./2016/thisTimeValue'), TimeClip: require('./2016/TimeClip'), TimeFromYear: require('./2016/TimeFromYear'), TimeWithinDay: require('./2016/TimeWithinDay'), ToBoolean: require('./2016/ToBoolean'), ToDateString: require('./2016/ToDateString'), ToInt16: require('./2016/ToInt16'), ToInt32: require('./2016/ToInt32'), ToInt8: require('./2016/ToInt8'), ToInteger: require('./2016/ToInteger'), ToLength: require('./2016/ToLength'), ToNumber: require('./2016/ToNumber'), ToObject: require('./2016/ToObject'), ToPrimitive: require('./2016/ToPrimitive'), ToPropertyDescriptor: require('./2016/ToPropertyDescriptor'), ToPropertyKey: require('./2016/ToPropertyKey'), ToString: require('./2016/ToString'), ToUint16: require('./2016/ToUint16'), ToUint32: require('./2016/ToUint32'), ToUint8: require('./2016/ToUint8'), ToUint8Clamp: require('./2016/ToUint8Clamp'), Type: require('./2016/Type'), UTF16Decode: require('./2016/UTF16Decode'), UTF16Encoding: require('./2016/UTF16Encoding'), ValidateAndApplyPropertyDescriptor: require('./2016/ValidateAndApplyPropertyDescriptor'), WeekDay: require('./2016/WeekDay'), YearFromTime: require('./2016/YearFromTime') }; module.exports = ES2016; es-abstract-1.20.4/es2017.js000066400000000000000000000150251431761430200152710ustar00rootroot00000000000000'use strict'; /* eslint global-require: 0 */ // https://262.ecma-international.org/8.0/#sec-abstract-operations var ES2017 = { 'Abstract Equality Comparison': require('./2017/AbstractEqualityComparison'), 'Abstract Relational Comparison': require('./2017/AbstractRelationalComparison'), 'Strict Equality Comparison': require('./2017/StrictEqualityComparison'), abs: require('./2017/abs'), AdvanceStringIndex: require('./2017/AdvanceStringIndex'), ArrayCreate: require('./2017/ArrayCreate'), ArraySetLength: require('./2017/ArraySetLength'), ArraySpeciesCreate: require('./2017/ArraySpeciesCreate'), Call: require('./2017/Call'), CanonicalNumericIndexString: require('./2017/CanonicalNumericIndexString'), CharacterRange: require('./2017/CharacterRange'), CompletePropertyDescriptor: require('./2017/CompletePropertyDescriptor'), CreateDataProperty: require('./2017/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2017/CreateDataPropertyOrThrow'), CreateHTML: require('./2017/CreateHTML'), CreateIterResultObject: require('./2017/CreateIterResultObject'), CreateListFromArrayLike: require('./2017/CreateListFromArrayLike'), CreateMethodProperty: require('./2017/CreateMethodProperty'), DateFromTime: require('./2017/DateFromTime'), Day: require('./2017/Day'), DayFromYear: require('./2017/DayFromYear'), DaysInYear: require('./2017/DaysInYear'), DayWithinYear: require('./2017/DayWithinYear'), DefinePropertyOrThrow: require('./2017/DefinePropertyOrThrow'), DeletePropertyOrThrow: require('./2017/DeletePropertyOrThrow'), EnumerableOwnProperties: require('./2017/EnumerableOwnProperties'), floor: require('./2017/floor'), FromPropertyDescriptor: require('./2017/FromPropertyDescriptor'), Get: require('./2017/Get'), GetIterator: require('./2017/GetIterator'), GetMethod: require('./2017/GetMethod'), GetOwnPropertyKeys: require('./2017/GetOwnPropertyKeys'), GetPrototypeFromConstructor: require('./2017/GetPrototypeFromConstructor'), GetSubstitution: require('./2017/GetSubstitution'), GetV: require('./2017/GetV'), HasOwnProperty: require('./2017/HasOwnProperty'), HasProperty: require('./2017/HasProperty'), HourFromTime: require('./2017/HourFromTime'), InLeapYear: require('./2017/InLeapYear'), InstanceofOperator: require('./2017/InstanceofOperator'), Invoke: require('./2017/Invoke'), IsAccessorDescriptor: require('./2017/IsAccessorDescriptor'), IsArray: require('./2017/IsArray'), IsCallable: require('./2017/IsCallable'), IsCompatiblePropertyDescriptor: require('./2017/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2017/IsConcatSpreadable'), IsConstructor: require('./2017/IsConstructor'), IsDataDescriptor: require('./2017/IsDataDescriptor'), IsExtensible: require('./2017/IsExtensible'), IsGenericDescriptor: require('./2017/IsGenericDescriptor'), IsInteger: require('./2017/IsInteger'), IsPromise: require('./2017/IsPromise'), IsPropertyDescriptor: require('./2017/IsPropertyDescriptor'), IsPropertyKey: require('./2017/IsPropertyKey'), IsRegExp: require('./2017/IsRegExp'), IsSharedArrayBuffer: require('./2017/IsSharedArrayBuffer'), IterableToList: require('./2017/IterableToList'), IteratorClose: require('./2017/IteratorClose'), IteratorComplete: require('./2017/IteratorComplete'), IteratorNext: require('./2017/IteratorNext'), IteratorStep: require('./2017/IteratorStep'), IteratorValue: require('./2017/IteratorValue'), MakeDate: require('./2017/MakeDate'), MakeDay: require('./2017/MakeDay'), MakeTime: require('./2017/MakeTime'), MinFromTime: require('./2017/MinFromTime'), modulo: require('./2017/modulo'), MonthFromTime: require('./2017/MonthFromTime'), msFromTime: require('./2017/msFromTime'), ObjectCreate: require('./2017/ObjectCreate'), ObjectDefineProperties: require('./2017/ObjectDefineProperties'), OrdinaryCreateFromConstructor: require('./2017/OrdinaryCreateFromConstructor'), OrdinaryDefineOwnProperty: require('./2017/OrdinaryDefineOwnProperty'), OrdinaryGetOwnProperty: require('./2017/OrdinaryGetOwnProperty'), OrdinaryGetPrototypeOf: require('./2017/OrdinaryGetPrototypeOf'), OrdinaryHasInstance: require('./2017/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2017/OrdinaryHasProperty'), OrdinarySetPrototypeOf: require('./2017/OrdinarySetPrototypeOf'), OrdinaryToPrimitive: require('./2017/OrdinaryToPrimitive'), QuoteJSONString: require('./2017/QuoteJSONString'), RegExpCreate: require('./2017/RegExpCreate'), RegExpExec: require('./2017/RegExpExec'), RequireObjectCoercible: require('./2017/RequireObjectCoercible'), SameValue: require('./2017/SameValue'), SameValueNonNumber: require('./2017/SameValueNonNumber'), SameValueZero: require('./2017/SameValueZero'), SecFromTime: require('./2017/SecFromTime'), Set: require('./2017/Set'), SetFunctionName: require('./2017/SetFunctionName'), SetIntegrityLevel: require('./2017/SetIntegrityLevel'), SpeciesConstructor: require('./2017/SpeciesConstructor'), SplitMatch: require('./2017/SplitMatch'), StringCreate: require('./2017/StringCreate'), StringGetOwnProperty: require('./2017/StringGetOwnProperty'), SymbolDescriptiveString: require('./2017/SymbolDescriptiveString'), TestIntegrityLevel: require('./2017/TestIntegrityLevel'), thisBooleanValue: require('./2017/thisBooleanValue'), thisNumberValue: require('./2017/thisNumberValue'), thisStringValue: require('./2017/thisStringValue'), thisTimeValue: require('./2017/thisTimeValue'), TimeClip: require('./2017/TimeClip'), TimeFromYear: require('./2017/TimeFromYear'), TimeWithinDay: require('./2017/TimeWithinDay'), ToBoolean: require('./2017/ToBoolean'), ToDateString: require('./2017/ToDateString'), ToIndex: require('./2017/ToIndex'), ToInt16: require('./2017/ToInt16'), ToInt32: require('./2017/ToInt32'), ToInt8: require('./2017/ToInt8'), ToInteger: require('./2017/ToInteger'), ToLength: require('./2017/ToLength'), ToNumber: require('./2017/ToNumber'), ToObject: require('./2017/ToObject'), ToPrimitive: require('./2017/ToPrimitive'), ToPropertyDescriptor: require('./2017/ToPropertyDescriptor'), ToPropertyKey: require('./2017/ToPropertyKey'), ToString: require('./2017/ToString'), ToUint16: require('./2017/ToUint16'), ToUint32: require('./2017/ToUint32'), ToUint8: require('./2017/ToUint8'), ToUint8Clamp: require('./2017/ToUint8Clamp'), Type: require('./2017/Type'), UTF16Decode: require('./2017/UTF16Decode'), UTF16Encoding: require('./2017/UTF16Encoding'), ValidateAndApplyPropertyDescriptor: require('./2017/ValidateAndApplyPropertyDescriptor'), WeekDay: require('./2017/WeekDay'), YearFromTime: require('./2017/YearFromTime') }; module.exports = ES2017; es-abstract-1.20.4/es2018.js000066400000000000000000000156451431761430200153020ustar00rootroot00000000000000'use strict'; /* eslint global-require: 0 */ // https://262.ecma-international.org/9.0/#sec-abstract-operations var ES2018 = { 'Abstract Equality Comparison': require('./2018/AbstractEqualityComparison'), 'Abstract Relational Comparison': require('./2018/AbstractRelationalComparison'), 'Strict Equality Comparison': require('./2018/StrictEqualityComparison'), abs: require('./2018/abs'), AdvanceStringIndex: require('./2018/AdvanceStringIndex'), ArrayCreate: require('./2018/ArrayCreate'), ArraySetLength: require('./2018/ArraySetLength'), ArraySpeciesCreate: require('./2018/ArraySpeciesCreate'), Call: require('./2018/Call'), CanonicalNumericIndexString: require('./2018/CanonicalNumericIndexString'), CharacterRange: require('./2018/CharacterRange'), CompletePropertyDescriptor: require('./2018/CompletePropertyDescriptor'), CopyDataProperties: require('./2018/CopyDataProperties'), CreateDataProperty: require('./2018/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2018/CreateDataPropertyOrThrow'), CreateHTML: require('./2018/CreateHTML'), CreateIterResultObject: require('./2018/CreateIterResultObject'), CreateListFromArrayLike: require('./2018/CreateListFromArrayLike'), CreateMethodProperty: require('./2018/CreateMethodProperty'), DateFromTime: require('./2018/DateFromTime'), DateString: require('./2018/DateString'), Day: require('./2018/Day'), DayFromYear: require('./2018/DayFromYear'), DaysInYear: require('./2018/DaysInYear'), DayWithinYear: require('./2018/DayWithinYear'), DefinePropertyOrThrow: require('./2018/DefinePropertyOrThrow'), DeletePropertyOrThrow: require('./2018/DeletePropertyOrThrow'), EnumerableOwnPropertyNames: require('./2018/EnumerableOwnPropertyNames'), floor: require('./2018/floor'), FromPropertyDescriptor: require('./2018/FromPropertyDescriptor'), Get: require('./2018/Get'), GetIterator: require('./2018/GetIterator'), GetMethod: require('./2018/GetMethod'), GetOwnPropertyKeys: require('./2018/GetOwnPropertyKeys'), GetPrototypeFromConstructor: require('./2018/GetPrototypeFromConstructor'), GetSubstitution: require('./2018/GetSubstitution'), GetV: require('./2018/GetV'), HasOwnProperty: require('./2018/HasOwnProperty'), HasProperty: require('./2018/HasProperty'), HourFromTime: require('./2018/HourFromTime'), InLeapYear: require('./2018/InLeapYear'), InstanceofOperator: require('./2018/InstanceofOperator'), Invoke: require('./2018/Invoke'), IsAccessorDescriptor: require('./2018/IsAccessorDescriptor'), IsArray: require('./2018/IsArray'), IsCallable: require('./2018/IsCallable'), IsCompatiblePropertyDescriptor: require('./2018/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2018/IsConcatSpreadable'), IsConstructor: require('./2018/IsConstructor'), IsDataDescriptor: require('./2018/IsDataDescriptor'), IsExtensible: require('./2018/IsExtensible'), IsGenericDescriptor: require('./2018/IsGenericDescriptor'), IsInteger: require('./2018/IsInteger'), IsPromise: require('./2018/IsPromise'), IsPropertyKey: require('./2018/IsPropertyKey'), IsRegExp: require('./2018/IsRegExp'), IsSharedArrayBuffer: require('./2018/IsSharedArrayBuffer'), IsStringPrefix: require('./2018/IsStringPrefix'), IterableToList: require('./2018/IterableToList'), IteratorClose: require('./2018/IteratorClose'), IteratorComplete: require('./2018/IteratorComplete'), IteratorNext: require('./2018/IteratorNext'), IteratorStep: require('./2018/IteratorStep'), IteratorValue: require('./2018/IteratorValue'), MakeDate: require('./2018/MakeDate'), MakeDay: require('./2018/MakeDay'), MakeTime: require('./2018/MakeTime'), MinFromTime: require('./2018/MinFromTime'), modulo: require('./2018/modulo'), MonthFromTime: require('./2018/MonthFromTime'), msFromTime: require('./2018/msFromTime'), NumberToString: require('./2018/NumberToString'), ObjectCreate: require('./2018/ObjectCreate'), ObjectDefineProperties: require('./2018/ObjectDefineProperties'), OrdinaryCreateFromConstructor: require('./2018/OrdinaryCreateFromConstructor'), OrdinaryDefineOwnProperty: require('./2018/OrdinaryDefineOwnProperty'), OrdinaryGetOwnProperty: require('./2018/OrdinaryGetOwnProperty'), OrdinaryGetPrototypeOf: require('./2018/OrdinaryGetPrototypeOf'), OrdinaryHasInstance: require('./2018/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2018/OrdinaryHasProperty'), OrdinarySetPrototypeOf: require('./2018/OrdinarySetPrototypeOf'), OrdinaryToPrimitive: require('./2018/OrdinaryToPrimitive'), PromiseResolve: require('./2018/PromiseResolve'), QuoteJSONString: require('./2018/QuoteJSONString'), RegExpCreate: require('./2018/RegExpCreate'), RegExpExec: require('./2018/RegExpExec'), RequireObjectCoercible: require('./2018/RequireObjectCoercible'), SameValue: require('./2018/SameValue'), SameValueNonNumber: require('./2018/SameValueNonNumber'), SameValueZero: require('./2018/SameValueZero'), SecFromTime: require('./2018/SecFromTime'), Set: require('./2018/Set'), SetFunctionLength: require('./2018/SetFunctionLength'), SetFunctionName: require('./2018/SetFunctionName'), SetIntegrityLevel: require('./2018/SetIntegrityLevel'), SpeciesConstructor: require('./2018/SpeciesConstructor'), SplitMatch: require('./2018/SplitMatch'), StringCreate: require('./2018/StringCreate'), StringGetOwnProperty: require('./2018/StringGetOwnProperty'), SymbolDescriptiveString: require('./2018/SymbolDescriptiveString'), TestIntegrityLevel: require('./2018/TestIntegrityLevel'), thisBooleanValue: require('./2018/thisBooleanValue'), thisNumberValue: require('./2018/thisNumberValue'), thisStringValue: require('./2018/thisStringValue'), thisSymbolValue: require('./2018/thisSymbolValue'), thisTimeValue: require('./2018/thisTimeValue'), TimeClip: require('./2018/TimeClip'), TimeFromYear: require('./2018/TimeFromYear'), TimeString: require('./2018/TimeString'), TimeWithinDay: require('./2018/TimeWithinDay'), ToBoolean: require('./2018/ToBoolean'), ToDateString: require('./2018/ToDateString'), ToIndex: require('./2018/ToIndex'), ToInt16: require('./2018/ToInt16'), ToInt32: require('./2018/ToInt32'), ToInt8: require('./2018/ToInt8'), ToInteger: require('./2018/ToInteger'), ToLength: require('./2018/ToLength'), ToNumber: require('./2018/ToNumber'), ToObject: require('./2018/ToObject'), ToPrimitive: require('./2018/ToPrimitive'), ToPropertyDescriptor: require('./2018/ToPropertyDescriptor'), ToPropertyKey: require('./2018/ToPropertyKey'), ToString: require('./2018/ToString'), ToUint16: require('./2018/ToUint16'), ToUint32: require('./2018/ToUint32'), ToUint8: require('./2018/ToUint8'), ToUint8Clamp: require('./2018/ToUint8Clamp'), Type: require('./2018/Type'), UnicodeEscape: require('./2018/UnicodeEscape'), UTF16Decode: require('./2018/UTF16Decode'), UTF16Encoding: require('./2018/UTF16Encoding'), ValidateAndApplyPropertyDescriptor: require('./2018/ValidateAndApplyPropertyDescriptor'), WeekDay: require('./2018/WeekDay'), YearFromTime: require('./2018/YearFromTime') }; module.exports = ES2018; es-abstract-1.20.4/es2019.js000066400000000000000000000161131431761430200152720ustar00rootroot00000000000000'use strict'; /* eslint global-require: 0 */ // https://262.ecma-international.org/10.0/#sec-abstract-operations var ES2019 = { 'Abstract Equality Comparison': require('./2019/AbstractEqualityComparison'), 'Abstract Relational Comparison': require('./2019/AbstractRelationalComparison'), 'Strict Equality Comparison': require('./2019/StrictEqualityComparison'), abs: require('./2019/abs'), AddEntriesFromIterable: require('./2019/AddEntriesFromIterable'), AdvanceStringIndex: require('./2019/AdvanceStringIndex'), ArrayCreate: require('./2019/ArrayCreate'), ArraySetLength: require('./2019/ArraySetLength'), ArraySpeciesCreate: require('./2019/ArraySpeciesCreate'), Call: require('./2019/Call'), CanonicalNumericIndexString: require('./2019/CanonicalNumericIndexString'), CharacterRange: require('./2019/CharacterRange'), CompletePropertyDescriptor: require('./2019/CompletePropertyDescriptor'), CopyDataProperties: require('./2019/CopyDataProperties'), CreateDataProperty: require('./2019/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2019/CreateDataPropertyOrThrow'), CreateHTML: require('./2019/CreateHTML'), CreateIterResultObject: require('./2019/CreateIterResultObject'), CreateListFromArrayLike: require('./2019/CreateListFromArrayLike'), CreateMethodProperty: require('./2019/CreateMethodProperty'), DateFromTime: require('./2019/DateFromTime'), DateString: require('./2019/DateString'), Day: require('./2019/Day'), DayFromYear: require('./2019/DayFromYear'), DaysInYear: require('./2019/DaysInYear'), DayWithinYear: require('./2019/DayWithinYear'), DefinePropertyOrThrow: require('./2019/DefinePropertyOrThrow'), DeletePropertyOrThrow: require('./2019/DeletePropertyOrThrow'), EnumerableOwnPropertyNames: require('./2019/EnumerableOwnPropertyNames'), FlattenIntoArray: require('./2019/FlattenIntoArray'), floor: require('./2019/floor'), FromPropertyDescriptor: require('./2019/FromPropertyDescriptor'), Get: require('./2019/Get'), GetIterator: require('./2019/GetIterator'), GetMethod: require('./2019/GetMethod'), GetOwnPropertyKeys: require('./2019/GetOwnPropertyKeys'), GetPrototypeFromConstructor: require('./2019/GetPrototypeFromConstructor'), GetSubstitution: require('./2019/GetSubstitution'), GetV: require('./2019/GetV'), HasOwnProperty: require('./2019/HasOwnProperty'), HasProperty: require('./2019/HasProperty'), HourFromTime: require('./2019/HourFromTime'), InLeapYear: require('./2019/InLeapYear'), InstanceofOperator: require('./2019/InstanceofOperator'), Invoke: require('./2019/Invoke'), IsAccessorDescriptor: require('./2019/IsAccessorDescriptor'), IsArray: require('./2019/IsArray'), IsCallable: require('./2019/IsCallable'), IsCompatiblePropertyDescriptor: require('./2019/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2019/IsConcatSpreadable'), IsConstructor: require('./2019/IsConstructor'), IsDataDescriptor: require('./2019/IsDataDescriptor'), IsExtensible: require('./2019/IsExtensible'), IsGenericDescriptor: require('./2019/IsGenericDescriptor'), IsInteger: require('./2019/IsInteger'), IsPromise: require('./2019/IsPromise'), IsPropertyKey: require('./2019/IsPropertyKey'), IsRegExp: require('./2019/IsRegExp'), IsSharedArrayBuffer: require('./2019/IsSharedArrayBuffer'), IsStringPrefix: require('./2019/IsStringPrefix'), IterableToList: require('./2019/IterableToList'), IteratorClose: require('./2019/IteratorClose'), IteratorComplete: require('./2019/IteratorComplete'), IteratorNext: require('./2019/IteratorNext'), IteratorStep: require('./2019/IteratorStep'), IteratorValue: require('./2019/IteratorValue'), MakeDate: require('./2019/MakeDate'), MakeDay: require('./2019/MakeDay'), MakeTime: require('./2019/MakeTime'), MinFromTime: require('./2019/MinFromTime'), modulo: require('./2019/modulo'), MonthFromTime: require('./2019/MonthFromTime'), msFromTime: require('./2019/msFromTime'), NumberToString: require('./2019/NumberToString'), ObjectCreate: require('./2019/ObjectCreate'), ObjectDefineProperties: require('./2019/ObjectDefineProperties'), OrdinaryCreateFromConstructor: require('./2019/OrdinaryCreateFromConstructor'), OrdinaryDefineOwnProperty: require('./2019/OrdinaryDefineOwnProperty'), OrdinaryGetOwnProperty: require('./2019/OrdinaryGetOwnProperty'), OrdinaryGetPrototypeOf: require('./2019/OrdinaryGetPrototypeOf'), OrdinaryHasInstance: require('./2019/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2019/OrdinaryHasProperty'), OrdinarySetPrototypeOf: require('./2019/OrdinarySetPrototypeOf'), OrdinaryToPrimitive: require('./2019/OrdinaryToPrimitive'), PromiseResolve: require('./2019/PromiseResolve'), QuoteJSONString: require('./2019/QuoteJSONString'), RegExpCreate: require('./2019/RegExpCreate'), RegExpExec: require('./2019/RegExpExec'), RequireObjectCoercible: require('./2019/RequireObjectCoercible'), SameValue: require('./2019/SameValue'), SameValueNonNumber: require('./2019/SameValueNonNumber'), SameValueZero: require('./2019/SameValueZero'), SecFromTime: require('./2019/SecFromTime'), Set: require('./2019/Set'), SetFunctionLength: require('./2019/SetFunctionLength'), SetFunctionName: require('./2019/SetFunctionName'), SetIntegrityLevel: require('./2019/SetIntegrityLevel'), SpeciesConstructor: require('./2019/SpeciesConstructor'), SplitMatch: require('./2019/SplitMatch'), StringCreate: require('./2019/StringCreate'), StringGetOwnProperty: require('./2019/StringGetOwnProperty'), SymbolDescriptiveString: require('./2019/SymbolDescriptiveString'), TestIntegrityLevel: require('./2019/TestIntegrityLevel'), thisBooleanValue: require('./2019/thisBooleanValue'), thisNumberValue: require('./2019/thisNumberValue'), thisStringValue: require('./2019/thisStringValue'), thisSymbolValue: require('./2019/thisSymbolValue'), thisTimeValue: require('./2019/thisTimeValue'), TimeClip: require('./2019/TimeClip'), TimeFromYear: require('./2019/TimeFromYear'), TimeString: require('./2019/TimeString'), TimeWithinDay: require('./2019/TimeWithinDay'), ToBoolean: require('./2019/ToBoolean'), ToDateString: require('./2019/ToDateString'), ToIndex: require('./2019/ToIndex'), ToInt16: require('./2019/ToInt16'), ToInt32: require('./2019/ToInt32'), ToInt8: require('./2019/ToInt8'), ToInteger: require('./2019/ToInteger'), ToLength: require('./2019/ToLength'), ToNumber: require('./2019/ToNumber'), ToObject: require('./2019/ToObject'), ToPrimitive: require('./2019/ToPrimitive'), ToPropertyDescriptor: require('./2019/ToPropertyDescriptor'), ToPropertyKey: require('./2019/ToPropertyKey'), ToString: require('./2019/ToString'), ToUint16: require('./2019/ToUint16'), ToUint32: require('./2019/ToUint32'), ToUint8: require('./2019/ToUint8'), ToUint8Clamp: require('./2019/ToUint8Clamp'), TrimString: require('./2019/TrimString'), Type: require('./2019/Type'), UnicodeEscape: require('./2019/UnicodeEscape'), UTF16Decode: require('./2019/UTF16Decode'), UTF16Encoding: require('./2019/UTF16Encoding'), ValidateAndApplyPropertyDescriptor: require('./2019/ValidateAndApplyPropertyDescriptor'), WeekDay: require('./2019/WeekDay'), YearFromTime: require('./2019/YearFromTime') }; module.exports = ES2019; es-abstract-1.20.4/es2020.js000066400000000000000000000204271431761430200152650ustar00rootroot00000000000000'use strict'; /* eslint global-require: 0 */ // https://ecma-international.org/ecma-262/11.0/#sec-abstract-operations var ES2020 = { 'Abstract Equality Comparison': require('./2020/AbstractEqualityComparison'), 'Abstract Relational Comparison': require('./2020/AbstractRelationalComparison'), 'Strict Equality Comparison': require('./2020/StrictEqualityComparison'), abs: require('./2020/abs'), AddEntriesFromIterable: require('./2020/AddEntriesFromIterable'), AdvanceStringIndex: require('./2020/AdvanceStringIndex'), ArrayCreate: require('./2020/ArrayCreate'), ArraySetLength: require('./2020/ArraySetLength'), ArraySpeciesCreate: require('./2020/ArraySpeciesCreate'), BigInt: require('./2020/BigInt'), BigIntBitwiseOp: require('./2020/BigIntBitwiseOp'), BinaryAnd: require('./2020/BinaryAnd'), BinaryOr: require('./2020/BinaryOr'), BinaryXor: require('./2020/BinaryXor'), Call: require('./2020/Call'), CanonicalNumericIndexString: require('./2020/CanonicalNumericIndexString'), CharacterRange: require('./2020/CharacterRange'), CodePointAt: require('./2020/CodePointAt'), CompletePropertyDescriptor: require('./2020/CompletePropertyDescriptor'), CopyDataProperties: require('./2020/CopyDataProperties'), CreateDataProperty: require('./2020/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2020/CreateDataPropertyOrThrow'), CreateHTML: require('./2020/CreateHTML'), CreateIterResultObject: require('./2020/CreateIterResultObject'), CreateListFromArrayLike: require('./2020/CreateListFromArrayLike'), CreateMethodProperty: require('./2020/CreateMethodProperty'), CreateRegExpStringIterator: require('./2020/CreateRegExpStringIterator'), DateFromTime: require('./2020/DateFromTime'), DateString: require('./2020/DateString'), Day: require('./2020/Day'), DayFromYear: require('./2020/DayFromYear'), DaysInYear: require('./2020/DaysInYear'), DayWithinYear: require('./2020/DayWithinYear'), DefinePropertyOrThrow: require('./2020/DefinePropertyOrThrow'), DeletePropertyOrThrow: require('./2020/DeletePropertyOrThrow'), EnumerableOwnPropertyNames: require('./2020/EnumerableOwnPropertyNames'), FlattenIntoArray: require('./2020/FlattenIntoArray'), floor: require('./2020/floor'), FromPropertyDescriptor: require('./2020/FromPropertyDescriptor'), Get: require('./2020/Get'), GetIterator: require('./2020/GetIterator'), GetMethod: require('./2020/GetMethod'), GetOwnPropertyKeys: require('./2020/GetOwnPropertyKeys'), GetPrototypeFromConstructor: require('./2020/GetPrototypeFromConstructor'), GetSubstitution: require('./2020/GetSubstitution'), GetV: require('./2020/GetV'), HasOwnProperty: require('./2020/HasOwnProperty'), HasProperty: require('./2020/HasProperty'), HourFromTime: require('./2020/HourFromTime'), InLeapYear: require('./2020/InLeapYear'), InstanceofOperator: require('./2020/InstanceofOperator'), Invoke: require('./2020/Invoke'), IsAccessorDescriptor: require('./2020/IsAccessorDescriptor'), IsArray: require('./2020/IsArray'), IsBigIntElementType: require('./2020/IsBigIntElementType'), IsCallable: require('./2020/IsCallable'), IsCompatiblePropertyDescriptor: require('./2020/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2020/IsConcatSpreadable'), IsConstructor: require('./2020/IsConstructor'), IsDataDescriptor: require('./2020/IsDataDescriptor'), IsExtensible: require('./2020/IsExtensible'), IsGenericDescriptor: require('./2020/IsGenericDescriptor'), IsInteger: require('./2020/IsInteger'), IsNonNegativeInteger: require('./2020/IsNonNegativeInteger'), IsNoTearConfiguration: require('./2020/IsNoTearConfiguration'), IsPromise: require('./2020/IsPromise'), IsPropertyKey: require('./2020/IsPropertyKey'), IsRegExp: require('./2020/IsRegExp'), IsSharedArrayBuffer: require('./2020/IsSharedArrayBuffer'), IsStringPrefix: require('./2020/IsStringPrefix'), IsUnclampedIntegerElementType: require('./2020/IsUnclampedIntegerElementType'), IsUnsignedElementType: require('./2020/IsUnsignedElementType'), IterableToList: require('./2020/IterableToList'), IteratorClose: require('./2020/IteratorClose'), IteratorComplete: require('./2020/IteratorComplete'), IteratorNext: require('./2020/IteratorNext'), IteratorStep: require('./2020/IteratorStep'), IteratorValue: require('./2020/IteratorValue'), LengthOfArrayLike: require('./2020/LengthOfArrayLike'), MakeDate: require('./2020/MakeDate'), MakeDay: require('./2020/MakeDay'), MakeTime: require('./2020/MakeTime'), MinFromTime: require('./2020/MinFromTime'), modulo: require('./2020/modulo'), MonthFromTime: require('./2020/MonthFromTime'), msFromTime: require('./2020/msFromTime'), Number: require('./2020/Number'), NumberBitwiseOp: require('./2020/NumberBitwiseOp'), NumberToBigInt: require('./2020/NumberToBigInt'), ObjectDefineProperties: require('./2020/ObjectDefineProperties'), OrdinaryCreateFromConstructor: require('./2020/OrdinaryCreateFromConstructor'), OrdinaryDefineOwnProperty: require('./2020/OrdinaryDefineOwnProperty'), OrdinaryGetOwnProperty: require('./2020/OrdinaryGetOwnProperty'), OrdinaryGetPrototypeOf: require('./2020/OrdinaryGetPrototypeOf'), OrdinaryHasInstance: require('./2020/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2020/OrdinaryHasProperty'), OrdinaryObjectCreate: require('./2020/OrdinaryObjectCreate'), OrdinarySetPrototypeOf: require('./2020/OrdinarySetPrototypeOf'), OrdinaryToPrimitive: require('./2020/OrdinaryToPrimitive'), PromiseResolve: require('./2020/PromiseResolve'), QuoteJSONString: require('./2020/QuoteJSONString'), RegExpCreate: require('./2020/RegExpCreate'), RegExpExec: require('./2020/RegExpExec'), RequireObjectCoercible: require('./2020/RequireObjectCoercible'), SameValue: require('./2020/SameValue'), SameValueNonNumeric: require('./2020/SameValueNonNumeric'), SameValueZero: require('./2020/SameValueZero'), SecFromTime: require('./2020/SecFromTime'), Set: require('./2020/Set'), SetFunctionLength: require('./2020/SetFunctionLength'), SetFunctionName: require('./2020/SetFunctionName'), SetIntegrityLevel: require('./2020/SetIntegrityLevel'), SpeciesConstructor: require('./2020/SpeciesConstructor'), SplitMatch: require('./2020/SplitMatch'), StringCreate: require('./2020/StringCreate'), StringGetOwnProperty: require('./2020/StringGetOwnProperty'), StringPad: require('./2020/StringPad'), StringToBigInt: require('./2020/StringToBigInt'), SymbolDescriptiveString: require('./2020/SymbolDescriptiveString'), TestIntegrityLevel: require('./2020/TestIntegrityLevel'), thisBigIntValue: require('./2020/thisBigIntValue'), thisBooleanValue: require('./2020/thisBooleanValue'), thisNumberValue: require('./2020/thisNumberValue'), thisStringValue: require('./2020/thisStringValue'), thisSymbolValue: require('./2020/thisSymbolValue'), thisTimeValue: require('./2020/thisTimeValue'), TimeClip: require('./2020/TimeClip'), TimeFromYear: require('./2020/TimeFromYear'), TimeString: require('./2020/TimeString'), TimeWithinDay: require('./2020/TimeWithinDay'), ToBigInt: require('./2020/ToBigInt'), ToBigInt64: require('./2020/ToBigInt64'), ToBigUint64: require('./2020/ToBigUint64'), ToBoolean: require('./2020/ToBoolean'), ToDateString: require('./2020/ToDateString'), ToIndex: require('./2020/ToIndex'), ToInt16: require('./2020/ToInt16'), ToInt32: require('./2020/ToInt32'), ToInt8: require('./2020/ToInt8'), ToInteger: require('./2020/ToInteger'), ToLength: require('./2020/ToLength'), ToNumber: require('./2020/ToNumber'), ToNumeric: require('./2020/ToNumeric'), ToObject: require('./2020/ToObject'), ToPrimitive: require('./2020/ToPrimitive'), ToPropertyDescriptor: require('./2020/ToPropertyDescriptor'), ToPropertyKey: require('./2020/ToPropertyKey'), ToString: require('./2020/ToString'), ToUint16: require('./2020/ToUint16'), ToUint32: require('./2020/ToUint32'), ToUint8: require('./2020/ToUint8'), ToUint8Clamp: require('./2020/ToUint8Clamp'), TrimString: require('./2020/TrimString'), Type: require('./2020/Type'), UnicodeEscape: require('./2020/UnicodeEscape'), UTF16DecodeString: require('./2020/UTF16DecodeString'), UTF16DecodeSurrogatePair: require('./2020/UTF16DecodeSurrogatePair'), UTF16Encoding: require('./2020/UTF16Encoding'), ValidateAndApplyPropertyDescriptor: require('./2020/ValidateAndApplyPropertyDescriptor'), WeekDay: require('./2020/WeekDay'), YearFromTime: require('./2020/YearFromTime') }; module.exports = ES2020; es-abstract-1.20.4/es2021.js000066400000000000000000000215511431761430200152650ustar00rootroot00000000000000'use strict'; /* eslint global-require: 0 */ // https://www.ecma-international.org/ecma-262/12.0/#sec-abstract-operations var ES2021 = { 'Abstract Equality Comparison': require('./2021/AbstractEqualityComparison'), 'Abstract Relational Comparison': require('./2021/AbstractRelationalComparison'), 'Strict Equality Comparison': require('./2021/StrictEqualityComparison'), abs: require('./2021/abs'), AddEntriesFromIterable: require('./2021/AddEntriesFromIterable'), AddToKeptObjects: require('./2021/AddToKeptObjects'), AdvanceStringIndex: require('./2021/AdvanceStringIndex'), ApplyStringOrNumericBinaryOperator: require('./2021/ApplyStringOrNumericBinaryOperator'), ArrayCreate: require('./2021/ArrayCreate'), ArraySetLength: require('./2021/ArraySetLength'), ArraySpeciesCreate: require('./2021/ArraySpeciesCreate'), BigInt: require('./2021/BigInt'), BigIntBitwiseOp: require('./2021/BigIntBitwiseOp'), BinaryAnd: require('./2021/BinaryAnd'), BinaryOr: require('./2021/BinaryOr'), BinaryXor: require('./2021/BinaryXor'), ByteListBitwiseOp: require('./2021/ByteListBitwiseOp'), ByteListEqual: require('./2021/ByteListEqual'), Call: require('./2021/Call'), CanonicalNumericIndexString: require('./2021/CanonicalNumericIndexString'), CharacterRange: require('./2021/CharacterRange'), clamp: require('./2021/clamp'), substring: require('./2021/substring'), ClearKeptObjects: require('./2021/ClearKeptObjects'), CodePointAt: require('./2021/CodePointAt'), CodePointsToString: require('./2021/CodePointsToString'), CompletePropertyDescriptor: require('./2021/CompletePropertyDescriptor'), CopyDataProperties: require('./2021/CopyDataProperties'), CreateDataProperty: require('./2021/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2021/CreateDataPropertyOrThrow'), CreateHTML: require('./2021/CreateHTML'), CreateIterResultObject: require('./2021/CreateIterResultObject'), CreateListFromArrayLike: require('./2021/CreateListFromArrayLike'), CreateMethodProperty: require('./2021/CreateMethodProperty'), CreateRegExpStringIterator: require('./2021/CreateRegExpStringIterator'), DateFromTime: require('./2021/DateFromTime'), DateString: require('./2021/DateString'), Day: require('./2021/Day'), DayFromYear: require('./2021/DayFromYear'), DaysInYear: require('./2021/DaysInYear'), DayWithinYear: require('./2021/DayWithinYear'), DefinePropertyOrThrow: require('./2021/DefinePropertyOrThrow'), DeletePropertyOrThrow: require('./2021/DeletePropertyOrThrow'), EnumerableOwnPropertyNames: require('./2021/EnumerableOwnPropertyNames'), FlattenIntoArray: require('./2021/FlattenIntoArray'), floor: require('./2021/floor'), FromPropertyDescriptor: require('./2021/FromPropertyDescriptor'), Get: require('./2021/Get'), GetIterator: require('./2021/GetIterator'), GetMethod: require('./2021/GetMethod'), GetOwnPropertyKeys: require('./2021/GetOwnPropertyKeys'), GetPromiseResolve: require('./2021/GetPromiseResolve'), GetPrototypeFromConstructor: require('./2021/GetPrototypeFromConstructor'), GetSubstitution: require('./2021/GetSubstitution'), GetV: require('./2021/GetV'), HasOwnProperty: require('./2021/HasOwnProperty'), HasProperty: require('./2021/HasProperty'), HourFromTime: require('./2021/HourFromTime'), InLeapYear: require('./2021/InLeapYear'), InstanceofOperator: require('./2021/InstanceofOperator'), Invoke: require('./2021/Invoke'), IsAccessorDescriptor: require('./2021/IsAccessorDescriptor'), IsArray: require('./2021/IsArray'), IsBigIntElementType: require('./2021/IsBigIntElementType'), IsCallable: require('./2021/IsCallable'), IsCompatiblePropertyDescriptor: require('./2021/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2021/IsConcatSpreadable'), IsConstructor: require('./2021/IsConstructor'), IsDataDescriptor: require('./2021/IsDataDescriptor'), IsExtensible: require('./2021/IsExtensible'), IsGenericDescriptor: require('./2021/IsGenericDescriptor'), IsIntegralNumber: require('./2021/IsIntegralNumber'), IsNoTearConfiguration: require('./2021/IsNoTearConfiguration'), IsPromise: require('./2021/IsPromise'), IsPropertyKey: require('./2021/IsPropertyKey'), IsRegExp: require('./2021/IsRegExp'), IsSharedArrayBuffer: require('./2021/IsSharedArrayBuffer'), IsStringPrefix: require('./2021/IsStringPrefix'), IsUnclampedIntegerElementType: require('./2021/IsUnclampedIntegerElementType'), IsUnsignedElementType: require('./2021/IsUnsignedElementType'), IterableToList: require('./2021/IterableToList'), IteratorClose: require('./2021/IteratorClose'), IteratorComplete: require('./2021/IteratorComplete'), IteratorNext: require('./2021/IteratorNext'), IteratorStep: require('./2021/IteratorStep'), IteratorValue: require('./2021/IteratorValue'), LengthOfArrayLike: require('./2021/LengthOfArrayLike'), MakeDate: require('./2021/MakeDate'), MakeDay: require('./2021/MakeDay'), MakeTime: require('./2021/MakeTime'), MinFromTime: require('./2021/MinFromTime'), modulo: require('./2021/modulo'), MonthFromTime: require('./2021/MonthFromTime'), msFromTime: require('./2021/msFromTime'), Number: require('./2021/Number'), NumberBitwiseOp: require('./2021/NumberBitwiseOp'), NumberToBigInt: require('./2021/NumberToBigInt'), ObjectDefineProperties: require('./2021/ObjectDefineProperties'), OrdinaryCreateFromConstructor: require('./2021/OrdinaryCreateFromConstructor'), OrdinaryDefineOwnProperty: require('./2021/OrdinaryDefineOwnProperty'), OrdinaryGetOwnProperty: require('./2021/OrdinaryGetOwnProperty'), OrdinaryGetPrototypeOf: require('./2021/OrdinaryGetPrototypeOf'), OrdinaryHasInstance: require('./2021/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2021/OrdinaryHasProperty'), OrdinaryObjectCreate: require('./2021/OrdinaryObjectCreate'), OrdinarySetPrototypeOf: require('./2021/OrdinarySetPrototypeOf'), OrdinaryToPrimitive: require('./2021/OrdinaryToPrimitive'), PromiseResolve: require('./2021/PromiseResolve'), QuoteJSONString: require('./2021/QuoteJSONString'), RegExpCreate: require('./2021/RegExpCreate'), RegExpExec: require('./2021/RegExpExec'), RequireObjectCoercible: require('./2021/RequireObjectCoercible'), SameValue: require('./2021/SameValue'), SameValueNonNumeric: require('./2021/SameValueNonNumeric'), SameValueZero: require('./2021/SameValueZero'), SecFromTime: require('./2021/SecFromTime'), Set: require('./2021/Set'), SetFunctionLength: require('./2021/SetFunctionLength'), SetFunctionName: require('./2021/SetFunctionName'), SetIntegrityLevel: require('./2021/SetIntegrityLevel'), SpeciesConstructor: require('./2021/SpeciesConstructor'), SplitMatch: require('./2021/SplitMatch'), StringCreate: require('./2021/StringCreate'), StringGetOwnProperty: require('./2021/StringGetOwnProperty'), StringIndexOf: require('./2021/StringIndexOf'), StringPad: require('./2021/StringPad'), StringToBigInt: require('./2021/StringToBigInt'), StringToCodePoints: require('./2021/StringToCodePoints'), SymbolDescriptiveString: require('./2021/SymbolDescriptiveString'), TestIntegrityLevel: require('./2021/TestIntegrityLevel'), thisBigIntValue: require('./2021/thisBigIntValue'), thisBooleanValue: require('./2021/thisBooleanValue'), thisNumberValue: require('./2021/thisNumberValue'), thisStringValue: require('./2021/thisStringValue'), thisSymbolValue: require('./2021/thisSymbolValue'), thisTimeValue: require('./2021/thisTimeValue'), TimeClip: require('./2021/TimeClip'), TimeFromYear: require('./2021/TimeFromYear'), TimeString: require('./2021/TimeString'), TimeWithinDay: require('./2021/TimeWithinDay'), ToBigInt: require('./2021/ToBigInt'), ToBigInt64: require('./2021/ToBigInt64'), ToBigUint64: require('./2021/ToBigUint64'), ToBoolean: require('./2021/ToBoolean'), ToDateString: require('./2021/ToDateString'), ToIndex: require('./2021/ToIndex'), ToInt16: require('./2021/ToInt16'), ToInt32: require('./2021/ToInt32'), ToInt8: require('./2021/ToInt8'), ToIntegerOrInfinity: require('./2021/ToIntegerOrInfinity'), ToLength: require('./2021/ToLength'), ToNumber: require('./2021/ToNumber'), ToNumeric: require('./2021/ToNumeric'), ToObject: require('./2021/ToObject'), ToPrimitive: require('./2021/ToPrimitive'), ToPropertyDescriptor: require('./2021/ToPropertyDescriptor'), ToPropertyKey: require('./2021/ToPropertyKey'), ToString: require('./2021/ToString'), ToUint16: require('./2021/ToUint16'), ToUint32: require('./2021/ToUint32'), ToUint8: require('./2021/ToUint8'), ToUint8Clamp: require('./2021/ToUint8Clamp'), TrimString: require('./2021/TrimString'), Type: require('./2021/Type'), UnicodeEscape: require('./2021/UnicodeEscape'), UTF16EncodeCodePoint: require('./2021/UTF16EncodeCodePoint'), UTF16SurrogatePairToCodePoint: require('./2021/UTF16SurrogatePairToCodePoint'), ValidateAndApplyPropertyDescriptor: require('./2021/ValidateAndApplyPropertyDescriptor'), WeakRefDeref: require('./2021/WeakRefDeref'), WeekDay: require('./2021/WeekDay'), YearFromTime: require('./2021/YearFromTime') }; module.exports = ES2021; es-abstract-1.20.4/es2022.js000066400000000000000000000226511431761430200152700ustar00rootroot00000000000000'use strict'; /* eslint global-require: 0 */ // https://www.ecma-international.org/ecma-262/13.0/#sec-abstract-operations var ES2022 = { abs: require('./2022/abs'), AddEntriesFromIterable: require('./2022/AddEntriesFromIterable'), AddToKeptObjects: require('./2022/AddToKeptObjects'), AdvanceStringIndex: require('./2022/AdvanceStringIndex'), ApplyStringOrNumericBinaryOperator: require('./2022/ApplyStringOrNumericBinaryOperator'), ArrayCreate: require('./2022/ArrayCreate'), ArraySetLength: require('./2022/ArraySetLength'), ArraySpeciesCreate: require('./2022/ArraySpeciesCreate'), BigInt: require('./2022/BigInt'), BigIntBitwiseOp: require('./2022/BigIntBitwiseOp'), BinaryAnd: require('./2022/BinaryAnd'), BinaryOr: require('./2022/BinaryOr'), BinaryXor: require('./2022/BinaryXor'), ByteListBitwiseOp: require('./2022/ByteListBitwiseOp'), ByteListEqual: require('./2022/ByteListEqual'), Call: require('./2022/Call'), CanonicalNumericIndexString: require('./2022/CanonicalNumericIndexString'), CharacterRange: require('./2022/CharacterRange'), clamp: require('./2022/clamp'), ClearKeptObjects: require('./2022/ClearKeptObjects'), CodePointAt: require('./2022/CodePointAt'), CodePointsToString: require('./2022/CodePointsToString'), CompletePropertyDescriptor: require('./2022/CompletePropertyDescriptor'), CopyDataProperties: require('./2022/CopyDataProperties'), CreateDataProperty: require('./2022/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2022/CreateDataPropertyOrThrow'), CreateHTML: require('./2022/CreateHTML'), CreateIterResultObject: require('./2022/CreateIterResultObject'), CreateListFromArrayLike: require('./2022/CreateListFromArrayLike'), CreateMethodProperty: require('./2022/CreateMethodProperty'), CreateNonEnumerableDataPropertyOrThrow: require('./2022/CreateNonEnumerableDataPropertyOrThrow'), CreateRegExpStringIterator: require('./2022/CreateRegExpStringIterator'), DateFromTime: require('./2022/DateFromTime'), DateString: require('./2022/DateString'), Day: require('./2022/Day'), DayFromYear: require('./2022/DayFromYear'), DaysInYear: require('./2022/DaysInYear'), DayWithinYear: require('./2022/DayWithinYear'), DefinePropertyOrThrow: require('./2022/DefinePropertyOrThrow'), DeletePropertyOrThrow: require('./2022/DeletePropertyOrThrow'), EnumerableOwnPropertyNames: require('./2022/EnumerableOwnPropertyNames'), FlattenIntoArray: require('./2022/FlattenIntoArray'), floor: require('./2022/floor'), FromPropertyDescriptor: require('./2022/FromPropertyDescriptor'), Get: require('./2022/Get'), GetIterator: require('./2022/GetIterator'), GetMatchIndexPair: require('./2022/GetMatchIndexPair'), GetMatchString: require('./2022/GetMatchString'), GetMethod: require('./2022/GetMethod'), GetOwnPropertyKeys: require('./2022/GetOwnPropertyKeys'), GetPromiseResolve: require('./2022/GetPromiseResolve'), GetPrototypeFromConstructor: require('./2022/GetPrototypeFromConstructor'), GetStringIndex: require('./2022/GetStringIndex'), GetSubstitution: require('./2022/GetSubstitution'), GetV: require('./2022/GetV'), HasOwnProperty: require('./2022/HasOwnProperty'), HasProperty: require('./2022/HasProperty'), HourFromTime: require('./2022/HourFromTime'), InLeapYear: require('./2022/InLeapYear'), InstallErrorCause: require('./2022/InstallErrorCause'), InstanceofOperator: require('./2022/InstanceofOperator'), Invoke: require('./2022/Invoke'), IsAccessorDescriptor: require('./2022/IsAccessorDescriptor'), IsArray: require('./2022/IsArray'), IsBigIntElementType: require('./2022/IsBigIntElementType'), IsCallable: require('./2022/IsCallable'), IsCompatiblePropertyDescriptor: require('./2022/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2022/IsConcatSpreadable'), IsConstructor: require('./2022/IsConstructor'), IsDataDescriptor: require('./2022/IsDataDescriptor'), IsExtensible: require('./2022/IsExtensible'), IsGenericDescriptor: require('./2022/IsGenericDescriptor'), IsIntegralNumber: require('./2022/IsIntegralNumber'), IsLessThan: require('./2022/IsLessThan'), IsLooselyEqual: require('./2022/IsLooselyEqual'), IsNoTearConfiguration: require('./2022/IsNoTearConfiguration'), IsPromise: require('./2022/IsPromise'), IsPropertyKey: require('./2022/IsPropertyKey'), IsRegExp: require('./2022/IsRegExp'), IsSharedArrayBuffer: require('./2022/IsSharedArrayBuffer'), IsStrictlyEqual: require('./2022/IsStrictlyEqual'), IsStringPrefix: require('./2022/IsStringPrefix'), IsStringWellFormedUnicode: require('./2022/IsStringWellFormedUnicode'), IsUnclampedIntegerElementType: require('./2022/IsUnclampedIntegerElementType'), IsUnsignedElementType: require('./2022/IsUnsignedElementType'), IterableToList: require('./2022/IterableToList'), IteratorClose: require('./2022/IteratorClose'), IteratorComplete: require('./2022/IteratorComplete'), IteratorNext: require('./2022/IteratorNext'), IteratorStep: require('./2022/IteratorStep'), IteratorValue: require('./2022/IteratorValue'), LengthOfArrayLike: require('./2022/LengthOfArrayLike'), MakeDate: require('./2022/MakeDate'), MakeDay: require('./2022/MakeDay'), MakeMatchIndicesIndexPairArray: require('./2022/MakeMatchIndicesIndexPairArray'), MakeTime: require('./2022/MakeTime'), MinFromTime: require('./2022/MinFromTime'), modulo: require('./2022/modulo'), MonthFromTime: require('./2022/MonthFromTime'), msFromTime: require('./2022/msFromTime'), Number: require('./2022/Number'), NumberBitwiseOp: require('./2022/NumberBitwiseOp'), NumberToBigInt: require('./2022/NumberToBigInt'), ObjectDefineProperties: require('./2022/ObjectDefineProperties'), OrdinaryCreateFromConstructor: require('./2022/OrdinaryCreateFromConstructor'), OrdinaryDefineOwnProperty: require('./2022/OrdinaryDefineOwnProperty'), OrdinaryGetOwnProperty: require('./2022/OrdinaryGetOwnProperty'), OrdinaryGetPrototypeOf: require('./2022/OrdinaryGetPrototypeOf'), OrdinaryHasInstance: require('./2022/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2022/OrdinaryHasProperty'), OrdinaryObjectCreate: require('./2022/OrdinaryObjectCreate'), OrdinarySetPrototypeOf: require('./2022/OrdinarySetPrototypeOf'), OrdinaryToPrimitive: require('./2022/OrdinaryToPrimitive'), PromiseResolve: require('./2022/PromiseResolve'), QuoteJSONString: require('./2022/QuoteJSONString'), RegExpCreate: require('./2022/RegExpCreate'), RegExpExec: require('./2022/RegExpExec'), RegExpHasFlag: require('./2022/RegExpHasFlag'), RequireObjectCoercible: require('./2022/RequireObjectCoercible'), SameValue: require('./2022/SameValue'), SameValueNonNumeric: require('./2022/SameValueNonNumeric'), SameValueZero: require('./2022/SameValueZero'), SecFromTime: require('./2022/SecFromTime'), Set: require('./2022/Set'), SetFunctionLength: require('./2022/SetFunctionLength'), SetFunctionName: require('./2022/SetFunctionName'), SetIntegrityLevel: require('./2022/SetIntegrityLevel'), SortIndexedProperties: require('./2022/SortIndexedProperties'), SpeciesConstructor: require('./2022/SpeciesConstructor'), StringCreate: require('./2022/StringCreate'), StringGetOwnProperty: require('./2022/StringGetOwnProperty'), StringIndexOf: require('./2022/StringIndexOf'), StringPad: require('./2022/StringPad'), StringToBigInt: require('./2022/StringToBigInt'), StringToCodePoints: require('./2022/StringToCodePoints'), StringToNumber: require('./2022/StringToNumber'), substring: require('./2022/substring'), SymbolDescriptiveString: require('./2022/SymbolDescriptiveString'), TestIntegrityLevel: require('./2022/TestIntegrityLevel'), thisBigIntValue: require('./2022/thisBigIntValue'), thisBooleanValue: require('./2022/thisBooleanValue'), thisNumberValue: require('./2022/thisNumberValue'), thisStringValue: require('./2022/thisStringValue'), thisSymbolValue: require('./2022/thisSymbolValue'), thisTimeValue: require('./2022/thisTimeValue'), TimeClip: require('./2022/TimeClip'), TimeFromYear: require('./2022/TimeFromYear'), TimeString: require('./2022/TimeString'), TimeWithinDay: require('./2022/TimeWithinDay'), ToBigInt: require('./2022/ToBigInt'), ToBigInt64: require('./2022/ToBigInt64'), ToBigUint64: require('./2022/ToBigUint64'), ToBoolean: require('./2022/ToBoolean'), ToDateString: require('./2022/ToDateString'), ToIndex: require('./2022/ToIndex'), ToInt16: require('./2022/ToInt16'), ToInt32: require('./2022/ToInt32'), ToInt8: require('./2022/ToInt8'), ToIntegerOrInfinity: require('./2022/ToIntegerOrInfinity'), ToLength: require('./2022/ToLength'), ToNumber: require('./2022/ToNumber'), ToNumeric: require('./2022/ToNumeric'), ToObject: require('./2022/ToObject'), ToPrimitive: require('./2022/ToPrimitive'), ToPropertyDescriptor: require('./2022/ToPropertyDescriptor'), ToPropertyKey: require('./2022/ToPropertyKey'), ToString: require('./2022/ToString'), ToUint16: require('./2022/ToUint16'), ToUint32: require('./2022/ToUint32'), ToUint8: require('./2022/ToUint8'), ToUint8Clamp: require('./2022/ToUint8Clamp'), ToZeroPaddedDecimalString: require('./2022/ToZeroPaddedDecimalString'), TrimString: require('./2022/TrimString'), Type: require('./2022/Type'), UnicodeEscape: require('./2022/UnicodeEscape'), UTF16EncodeCodePoint: require('./2022/UTF16EncodeCodePoint'), UTF16SurrogatePairToCodePoint: require('./2022/UTF16SurrogatePairToCodePoint'), ValidateAndApplyPropertyDescriptor: require('./2022/ValidateAndApplyPropertyDescriptor'), WeakRefDeref: require('./2022/WeakRefDeref'), WeekDay: require('./2022/WeekDay'), YearFromTime: require('./2022/YearFromTime') }; module.exports = ES2022; es-abstract-1.20.4/es5.js000066400000000000000000000037531431761430200150510ustar00rootroot00000000000000'use strict'; /* eslint global-require: 0 */ // https://es5.github.io/#x9 module.exports = { 'Abstract Equality Comparison': require('./5/AbstractEqualityComparison'), 'Abstract Relational Comparison': require('./5/AbstractRelationalComparison'), 'Strict Equality Comparison': require('./5/StrictEqualityComparison'), abs: require('./5/abs'), CheckObjectCoercible: require('./5/CheckObjectCoercible'), DateFromTime: require('./5/DateFromTime'), Day: require('./5/Day'), DayFromYear: require('./5/DayFromYear'), DaysInYear: require('./5/DaysInYear'), DayWithinYear: require('./5/DayWithinYear'), floor: require('./5/floor'), FromPropertyDescriptor: require('./5/FromPropertyDescriptor'), HourFromTime: require('./5/HourFromTime'), InLeapYear: require('./5/InLeapYear'), IsAccessorDescriptor: require('./5/IsAccessorDescriptor'), IsCallable: require('./5/IsCallable'), IsDataDescriptor: require('./5/IsDataDescriptor'), IsGenericDescriptor: require('./5/IsGenericDescriptor'), IsPropertyDescriptor: require('./5/IsPropertyDescriptor'), MakeDate: require('./5/MakeDate'), MakeDay: require('./5/MakeDay'), MakeTime: require('./5/MakeTime'), MinFromTime: require('./5/MinFromTime'), modulo: require('./5/modulo'), MonthFromTime: require('./5/MonthFromTime'), msFromTime: require('./5/msFromTime'), SameValue: require('./5/SameValue'), SecFromTime: require('./5/SecFromTime'), TimeClip: require('./5/TimeClip'), TimeFromYear: require('./5/TimeFromYear'), TimeWithinDay: require('./5/TimeWithinDay'), ToBoolean: require('./5/ToBoolean'), ToInt32: require('./5/ToInt32'), ToInteger: require('./5/ToInteger'), ToNumber: require('./5/ToNumber'), ToObject: require('./5/ToObject'), ToPrimitive: require('./5/ToPrimitive'), ToPropertyDescriptor: require('./5/ToPropertyDescriptor'), ToString: require('./5/ToString'), ToUint16: require('./5/ToUint16'), ToUint32: require('./5/ToUint32'), Type: require('./5/Type'), WeekDay: require('./5/WeekDay'), YearFromTime: require('./5/YearFromTime') }; es-abstract-1.20.4/es6.js000066400000000000000000000000651431761430200150430ustar00rootroot00000000000000'use strict'; module.exports = require('./es2015'); es-abstract-1.20.4/es7.js000066400000000000000000000000651431761430200150440ustar00rootroot00000000000000'use strict'; module.exports = require('./es2016'); es-abstract-1.20.4/helpers/000077500000000000000000000000001431761430200154515ustar00rootroot00000000000000es-abstract-1.20.4/helpers/DefineOwnProperty.js000066400000000000000000000030671431761430200214400ustar00rootroot00000000000000'use strict'; var hasPropertyDescriptors = require('has-property-descriptors'); var GetIntrinsic = require('get-intrinsic'); var $defineProperty = hasPropertyDescriptors() && GetIntrinsic('%Object.defineProperty%', true); var hasArrayLengthDefineBug = hasPropertyDescriptors.hasArrayLengthDefineBug(); // eslint-disable-next-line global-require var isArray = hasArrayLengthDefineBug && require('../helpers/IsArray'); var callBound = require('call-bind/callBound'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); // eslint-disable-next-line max-params module.exports = function DefineOwnProperty(IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, desc) { if (!$defineProperty) { if (!IsDataDescriptor(desc)) { // ES3 does not support getters/setters return false; } if (!desc['[[Configurable]]'] || !desc['[[Writable]]']) { return false; } // fallback for ES3 if (P in O && $isEnumerable(O, P) !== !!desc['[[Enumerable]]']) { // a non-enumerable existing property return false; } // property does not exist at all, or exists but is enumerable var V = desc['[[Value]]']; // eslint-disable-next-line no-param-reassign O[P] = V; // will use [[Define]] return SameValue(O[P], V); } if ( hasArrayLengthDefineBug && P === 'length' && '[[Value]]' in desc && isArray(O) && O.length !== desc['[[Value]]'] ) { // eslint-disable-next-line no-param-reassign O.length = desc['[[Value]]']; return O.length === desc['[[Value]]']; } $defineProperty(O, P, FromPropertyDescriptor(desc)); return true; }; es-abstract-1.20.4/helpers/IsArray.js000066400000000000000000000005351431761430200173640ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Array = GetIntrinsic('%Array%'); // eslint-disable-next-line global-require var toStr = !$Array.isArray && require('call-bind/callBound')('Object.prototype.toString'); module.exports = $Array.isArray || function IsArray(argument) { return toStr(argument) === '[object Array]'; }; es-abstract-1.20.4/helpers/OwnPropertyKeys.js000066400000000000000000000013021431761430200211470ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var callBind = require('call-bind'); var callBound = require('call-bind/callBound'); var $ownKeys = GetIntrinsic('%Reflect.ownKeys%', true); var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%')); var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true); var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); var $gOPS = $SymbolValueOf ? GetIntrinsic('%Object.getOwnPropertySymbols%') : null; var keys = require('object-keys'); module.exports = $ownKeys || function OwnPropertyKeys(source) { var ownKeys = ($gOPN || keys)(source); if ($gOPS) { $pushApply(ownKeys, $gOPS(source)); } return ownKeys; }; es-abstract-1.20.4/helpers/assertRecord.js000066400000000000000000000025601431761430200204520ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var has = require('has'); var isMatchRecord = require('./isMatchRecord'); var predicates = { // https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type 'Property Descriptor': function isPropertyDescriptor(Desc) { var allowed = { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Get]]': true, '[[Set]]': true, '[[Value]]': true, '[[Writable]]': true }; for (var key in Desc) { // eslint-disable-line if (has(Desc, key) && !allowed[key]) { return false; } } var isData = has(Desc, '[[Value]]'); var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]'); if (isData && IsAccessor) { throw new $TypeError('Property Descriptors may not be both accessor and data descriptors'); } return true; }, // https://262.ecma-international.org/13.0/#sec-match-records 'Match Record': isMatchRecord }; module.exports = function assertRecord(Type, recordType, argumentName, value) { var predicate = predicates[recordType]; if (typeof predicate !== 'function') { throw new $SyntaxError('unknown record type: ' + recordType); } if (Type(value) !== 'Object' || !predicate(value)) { throw new $TypeError(argumentName + ' must be a ' + recordType); } }; es-abstract-1.20.4/helpers/assign.js000066400000000000000000000007011431761430200172710ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var has = require('has'); var $assign = GetIntrinsic('%Object%').assign; module.exports = function assign(target, source) { if ($assign) { return $assign(target, source); } // eslint-disable-next-line no-restricted-syntax for (var key in source) { if (has(source, key)) { // eslint-disable-next-line no-param-reassign target[key] = source[key]; } } return target; }; es-abstract-1.20.4/helpers/callBind.js000066400000000000000000000001251431761430200175150ustar00rootroot00000000000000'use strict'; // TODO; semver-major: remove module.exports = require('call-bind'); es-abstract-1.20.4/helpers/callBound.js000066400000000000000000000001371431761430200177130ustar00rootroot00000000000000'use strict'; // TODO; semver-major: remove module.exports = require('call-bind/callBound'); es-abstract-1.20.4/helpers/every.js000066400000000000000000000003011431761430200171330ustar00rootroot00000000000000'use strict'; module.exports = function every(array, predicate) { for (var i = 0; i < array.length; i += 1) { if (!predicate(array[i], i, array)) { return false; } } return true; }; es-abstract-1.20.4/helpers/forEach.js000066400000000000000000000002761431761430200173630ustar00rootroot00000000000000'use strict'; module.exports = function forEach(array, callback) { for (var i = 0; i < array.length; i += 1) { callback(array[i], i, array); // eslint-disable-line callback-return } }; es-abstract-1.20.4/helpers/fromPropertyDescriptor.js000066400000000000000000000011041431761430200225520ustar00rootroot00000000000000'use strict'; module.exports = function fromPropertyDescriptor(Desc) { if (typeof Desc === 'undefined') { return Desc; } var obj = {}; if ('[[Value]]' in Desc) { obj.value = Desc['[[Value]]']; } if ('[[Writable]]' in Desc) { obj.writable = !!Desc['[[Writable]]']; } if ('[[Get]]' in Desc) { obj.get = Desc['[[Get]]']; } if ('[[Set]]' in Desc) { obj.set = Desc['[[Set]]']; } if ('[[Enumerable]]' in Desc) { obj.enumerable = !!Desc['[[Enumerable]]']; } if ('[[Configurable]]' in Desc) { obj.configurable = !!Desc['[[Configurable]]']; } return obj; }; es-abstract-1.20.4/helpers/getInferredName.js000066400000000000000000000001611431761430200210440ustar00rootroot00000000000000'use strict'; // TODO: remove, semver-major module.exports = require('get-symbol-description/getInferredName'); es-abstract-1.20.4/helpers/getIteratorMethod.js000066400000000000000000000022221431761430200214370ustar00rootroot00000000000000'use strict'; var hasSymbols = require('has-symbols')(); var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var isString = require('is-string'); var $iterator = GetIntrinsic('%Symbol.iterator%', true); var $stringSlice = callBound('String.prototype.slice'); var $String = GetIntrinsic('%String%', true); module.exports = function getIteratorMethod(ES, iterable) { var usingIterator; if (hasSymbols) { usingIterator = ES.GetMethod(iterable, $iterator); } else if (ES.IsArray(iterable)) { usingIterator = function () { var i = -1; var arr = this; // eslint-disable-line no-invalid-this return { next: function () { i += 1; return { done: i >= arr.length, value: arr[i] }; } }; }; } else if (isString(iterable)) { usingIterator = function () { var i = 0; return { next: function () { var nextIndex = ES.AdvanceStringIndex($String(iterable), i, true); var value = $stringSlice(iterable, i, nextIndex); i = nextIndex; return { done: nextIndex > iterable.length, value: value }; } }; }; } return usingIterator; }; es-abstract-1.20.4/helpers/getOwnPropertyDescriptor.js000066400000000000000000000004061431761430200230560ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); if ($gOPD) { try { $gOPD([], 'length'); } catch (e) { // IE 8 has a broken gOPD $gOPD = null; } } module.exports = $gOPD; es-abstract-1.20.4/helpers/getProto.js000066400000000000000000000005761431761430200176220ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var originalGetProto = GetIntrinsic('%Object.getPrototypeOf%', true); var $ArrayProto = GetIntrinsic('%Array.prototype%'); module.exports = originalGetProto || ( // eslint-disable-next-line no-proto [].__proto__ === $ArrayProto ? function (O) { return O.__proto__; // eslint-disable-line no-proto } : null ); es-abstract-1.20.4/helpers/getSymbolDescription.js000066400000000000000000000001411431761430200221540ustar00rootroot00000000000000'use strict'; // TODO: remove, semver-major module.exports = require('get-symbol-description'); es-abstract-1.20.4/helpers/isAbstractClosure.js000066400000000000000000000003641431761430200214460ustar00rootroot00000000000000'use strict'; var functionName = require('function.prototype.name'); var anon = functionName(function () {}); module.exports = function isAbstractClosure(x) { return typeof x === 'function' && (!x.prototype || functionName(x) === anon); }; es-abstract-1.20.4/helpers/isByteValue.js000066400000000000000000000002331431761430200202410ustar00rootroot00000000000000'use strict'; module.exports = function isByteValue(value) { return typeof value === 'number' && value >= 0 && value <= 255 && (value | 0) === value; }; es-abstract-1.20.4/helpers/isCodePoint.js000066400000000000000000000002161431761430200202260ustar00rootroot00000000000000'use strict'; module.exports = function isCodePoint(cp) { return typeof cp === 'number' && cp >= 0 && cp <= 0x10FFFF && (cp | 0) === cp; }; es-abstract-1.20.4/helpers/isFinite.js000066400000000000000000000003261431761430200175620ustar00rootroot00000000000000'use strict'; var $isNaN = Number.isNaN || function (a) { return a !== a; }; module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; }; es-abstract-1.20.4/helpers/isFullyPopulatedPropertyDescriptor.js000066400000000000000000000003371431761430200251230ustar00rootroot00000000000000'use strict'; module.exports = function isFullyPopulatedPropertyDescriptor(ES, Desc) { return '[[Enumerable]]' in Desc && '[[Configurable]]' in Desc && (ES.IsAccessorDescriptor(Desc) || ES.IsDataDescriptor(Desc)); }; es-abstract-1.20.4/helpers/isLeadingSurrogate.js000066400000000000000000000002351431761430200216020ustar00rootroot00000000000000'use strict'; module.exports = function isLeadingSurrogate(charCode) { return typeof charCode === 'number' && charCode >= 0xD800 && charCode <= 0xDBFF; }; es-abstract-1.20.4/helpers/isMatchRecord.js000066400000000000000000000010241431761430200205330ustar00rootroot00000000000000'use strict'; var has = require('has'); // https://262.ecma-international.org/13.0/#sec-match-records module.exports = function isMatchRecord(record) { return ( has(record, '[[StartIndex]]') && has(record, '[[EndIndex]]') && record['[[StartIndex]]'] >= 0 && record['[[EndIndex]]'] >= record['[[StartIndex]]'] && String(parseInt(record['[[StartIndex]]'], 10)) === String(record['[[StartIndex]]']) && String(parseInt(record['[[EndIndex]]'], 10)) === String(record['[[EndIndex]]']) ); }; es-abstract-1.20.4/helpers/isNaN.js000066400000000000000000000001301431761430200170110ustar00rootroot00000000000000'use strict'; module.exports = Number.isNaN || function isNaN(a) { return a !== a; }; es-abstract-1.20.4/helpers/isPrefixOf.js000066400000000000000000000004611431761430200200660ustar00rootroot00000000000000'use strict'; var $strSlice = require('call-bind/callBound')('String.prototype.slice'); module.exports = function isPrefixOf(prefix, string) { if (prefix === string) { return true; } if (prefix.length > string.length) { return false; } return $strSlice(string, 0, prefix.length) === prefix; }; es-abstract-1.20.4/helpers/isPrimitive.js000066400000000000000000000002271431761430200203140ustar00rootroot00000000000000'use strict'; module.exports = function isPrimitive(value) { return value === null || (typeof value !== 'function' && typeof value !== 'object'); }; es-abstract-1.20.4/helpers/isPropertyDescriptor.js000066400000000000000000000013211431761430200222230ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); module.exports = function IsPropertyDescriptor(ES, Desc) { if (ES.Type(Desc) !== 'Object') { return false; } var allowed = { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Get]]': true, '[[Set]]': true, '[[Value]]': true, '[[Writable]]': true }; for (var key in Desc) { // eslint-disable-line no-restricted-syntax if (has(Desc, key) && !allowed[key]) { return false; } } if (ES.IsDataDescriptor(Desc) && ES.IsAccessorDescriptor(Desc)) { throw new $TypeError('Property Descriptors may not be both accessor and data descriptors'); } return true; }; es-abstract-1.20.4/helpers/isSamePropertyDescriptor.js000066400000000000000000000006051431761430200230350ustar00rootroot00000000000000'use strict'; var every = require('./every'); module.exports = function isSamePropertyDescriptor(ES, D1, D2) { var fields = [ '[[Configurable]]', '[[Enumerable]]', '[[Get]]', '[[Set]]', '[[Value]]', '[[Writable]]' ]; return every(fields, function (field) { if ((field in D1) !== (field in D2)) { return false; } return ES.SameValue(D1[field], D2[field]); }); }; es-abstract-1.20.4/helpers/isTrailingSurrogate.js000066400000000000000000000002361431761430200220110ustar00rootroot00000000000000'use strict'; module.exports = function isTrailingSurrogate(charCode) { return typeof charCode === 'number' && charCode >= 0xDC00 && charCode <= 0xDFFF; }; es-abstract-1.20.4/helpers/maxSafeInteger.js000066400000000000000000000003151431761430200207100ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $Math = GetIntrinsic('%Math%'); var $Number = GetIntrinsic('%Number%'); module.exports = $Number.MAX_SAFE_INTEGER || $Math.pow(2, 53) - 1; es-abstract-1.20.4/helpers/mod.js000066400000000000000000000002631431761430200165670ustar00rootroot00000000000000'use strict'; var $floor = Math.floor; module.exports = function mod(number, modulo) { var remain = number % modulo; return $floor(remain >= 0 ? remain : remain + modulo); }; es-abstract-1.20.4/helpers/modBigInt.js000066400000000000000000000002701431761430200176620ustar00rootroot00000000000000'use strict'; module.exports = function bigIntMod(BigIntRemainder, bigint, modulo) { var remain = BigIntRemainder(bigint, modulo); return remain >= 0 ? remain : remain + modulo; }; es-abstract-1.20.4/helpers/padTimeComponent.js000066400000000000000000000003341431761430200212550ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $strSlice = callBound('String.prototype.slice'); module.exports = function padTimeComponent(c, count) { return $strSlice('00' + c, -(count || 2)); }; es-abstract-1.20.4/helpers/regexTester.js000066400000000000000000000001331431761430200203050ustar00rootroot00000000000000'use strict'; // TODO: remove, semver-major module.exports = require('safe-regex-test'); es-abstract-1.20.4/helpers/setProto.js000066400000000000000000000006741431761430200176350ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var originalSetProto = GetIntrinsic('%Object.setPrototypeOf%', true); var $ArrayProto = GetIntrinsic('%Array.prototype%'); module.exports = originalSetProto || ( // eslint-disable-next-line no-proto, no-negated-condition [].__proto__ !== $ArrayProto ? null : function (O, proto) { O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign return O; } ); es-abstract-1.20.4/helpers/sign.js000066400000000000000000000001311431761430200167420ustar00rootroot00000000000000'use strict'; module.exports = function sign(number) { return number >= 0 ? 1 : -1; }; es-abstract-1.20.4/helpers/some.js000066400000000000000000000002771431761430200167600ustar00rootroot00000000000000'use strict'; module.exports = function some(array, predicate) { for (var i = 0; i < array.length; i += 1) { if (predicate(array[i], i, array)) { return true; } } return false; }; es-abstract-1.20.4/helpers/timeConstants.js000066400000000000000000000007021431761430200206410ustar00rootroot00000000000000'use strict'; var HoursPerDay = 24; var MinutesPerHour = 60; var SecondsPerMinute = 60; var msPerSecond = 1e3; var msPerMinute = msPerSecond * SecondsPerMinute; var msPerHour = msPerMinute * MinutesPerHour; var msPerDay = 86400000; module.exports = { HoursPerDay: HoursPerDay, MinutesPerHour: MinutesPerHour, SecondsPerMinute: SecondsPerMinute, msPerSecond: msPerSecond, msPerMinute: msPerMinute, msPerHour: msPerHour, msPerDay: msPerDay }; es-abstract-1.20.4/index.js000066400000000000000000000012521431761430200154540ustar00rootroot00000000000000'use strict'; var assign = require('./helpers/assign'); var ES5 = require('./es5'); var ES2015 = require('./es2015'); var ES2016 = require('./es2016'); var ES2017 = require('./es2017'); var ES2018 = require('./es2018'); var ES2019 = require('./es2019'); var ES2020 = require('./es2020'); var ES2021 = require('./es2021'); var ES2022 = require('./es2022'); var ES = { ES5: ES5, ES6: ES2015, ES2015: ES2015, ES7: ES2016, ES2016: ES2016, ES2017: ES2017, ES2018: ES2018, ES2019: ES2019, ES2020: ES2020, ES2021: ES2021, ES2022: ES2022 }; assign(ES, ES5); delete ES.CheckObjectCoercible; // renamed in ES6 to RequireObjectCoercible assign(ES, ES2015); module.exports = ES; es-abstract-1.20.4/operations/000077500000000000000000000000001431761430200161725ustar00rootroot00000000000000es-abstract-1.20.4/operations/.eslintrc000066400000000000000000000000461431761430200200160ustar00rootroot00000000000000{ "rules": { "id-length": 0, }, } es-abstract-1.20.4/operations/2015.js000066400000000000000000000565531431761430200171350ustar00rootroot00000000000000'use strict'; module.exports = { IsPropertyDescriptor: 'https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type', // not actually an abstract op abs: { url: 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions' }, 'Abstract Equality Comparison': { url: 'https://262.ecma-international.org/6.0/#sec-abstract-equality-comparison' }, 'Abstract Relational Comparison': { url: 'https://262.ecma-international.org/6.0/#sec-abstract-relational-comparison' }, AddRestrictedFunctionProperties: { url: 'https://262.ecma-international.org/6.0/#sec-addrestrictedfunctionproperties' }, AdvanceStringIndex: { url: 'https://262.ecma-international.org/6.0/#sec-advancestringindex' }, AllocateArrayBuffer: { url: 'https://262.ecma-international.org/6.0/#sec-allocatearraybuffer' }, AllocateTypedArray: { url: 'https://262.ecma-international.org/6.0/#sec-allocatetypedarray' }, ArrayCreate: { url: 'https://262.ecma-international.org/6.0/#sec-arraycreate' }, ArraySetLength: { url: 'https://262.ecma-international.org/6.0/#sec-arraysetlength' }, ArraySpeciesCreate: { url: 'https://262.ecma-international.org/6.0/#sec-arrayspeciescreate' }, BoundFunctionCreate: { url: 'https://262.ecma-international.org/6.0/#sec-boundfunctioncreate' }, Call: { url: 'https://262.ecma-international.org/6.0/#sec-call' }, Canonicalize: { url: 'https://262.ecma-international.org/6.0/#sec-runtime-semantics-canonicalize-ch' }, CanonicalNumericIndexString: { url: 'https://262.ecma-international.org/6.0/#sec-canonicalnumericindexstring' }, CharacterRange: { url: 'https://262.ecma-international.org/6.0/#sec-runtime-semantics-characterrange-abstract-operation' }, CharacterSetMatcher: { url: 'https://262.ecma-international.org/6.0/#sec-runtime-semantics-charactersetmatcher-abstract-operation' }, CloneArrayBuffer: { url: 'https://262.ecma-international.org/6.0/#sec-clonearraybuffer' }, CompletePropertyDescriptor: { url: 'https://262.ecma-international.org/6.0/#sec-completepropertydescriptor' }, Completion: { url: 'https://262.ecma-international.org/6.0/#sec-implicit-completion-values' }, Construct: { url: 'https://262.ecma-international.org/6.0/#sec-construct' }, CopyDataBlockBytes: { url: 'https://262.ecma-international.org/6.0/#sec-copydatablockbytes' }, CreateArrayFromList: { url: 'https://262.ecma-international.org/6.0/#sec-createarrayfromlist' }, CreateArrayIterator: { url: 'https://262.ecma-international.org/6.0/#sec-createarrayiterator' }, CreateBuiltinFunction: { url: 'https://262.ecma-international.org/6.0/#sec-createbuiltinfunction' }, CreateByteDataBlock: { url: 'https://262.ecma-international.org/6.0/#sec-createbytedatablock' }, CreateDataProperty: { url: 'https://262.ecma-international.org/6.0/#sec-createdataproperty' }, CreateDataPropertyOrThrow: { url: 'https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow' }, CreateDynamicFunction: { url: 'https://262.ecma-international.org/6.0/#sec-createdynamicfunction' }, CreateHTML: { url: 'https://262.ecma-international.org/6.0/#sec-createhtml' }, CreateIntrinsics: { url: 'https://262.ecma-international.org/6.0/#sec-createintrinsics' }, CreateIterResultObject: { url: 'https://262.ecma-international.org/6.0/#sec-createiterresultobject' }, CreateListFromArrayLike: { url: 'https://262.ecma-international.org/6.0/#sec-createlistfromarraylike' }, CreateListIterator: { url: 'https://262.ecma-international.org/6.0/#sec-createlistiterator' }, CreateMapIterator: { url: 'https://262.ecma-international.org/6.0/#sec-createmapiterator' }, CreateMappedArgumentsObject: { url: 'https://262.ecma-international.org/6.0/#sec-createmappedargumentsobject' }, CreateMethodProperty: { url: 'https://262.ecma-international.org/6.0/#sec-createmethodproperty' }, CreatePerIterationEnvironment: { url: 'https://262.ecma-international.org/6.0/#sec-createperiterationenvironment' }, CreateRealm: { url: 'https://262.ecma-international.org/6.0/#sec-createrealm' }, CreateSetIterator: { url: 'https://262.ecma-international.org/6.0/#sec-createsetiterator' }, CreateUnmappedArgumentsObject: { url: 'https://262.ecma-international.org/6.0/#sec-createunmappedargumentsobject' }, DateFromTime: { url: 'https://262.ecma-international.org/6.0/#sec-date-number' }, Day: { url: 'https://262.ecma-international.org/6.0/#sec-day-number-and-time-within-day' }, DayFromYear: { url: 'https://262.ecma-international.org/6.0/#sec-year-number' }, DaylightSavingTA: { url: 'https://262.ecma-international.org/6.0/#sec-daylight-saving-time-adjustment' }, DaysInYear: { url: 'https://262.ecma-international.org/6.0/#sec-year-number' }, DayWithinYear: { url: 'https://262.ecma-international.org/6.0/#sec-month-number' }, Decode: { url: 'https://262.ecma-international.org/6.0/#sec-decode' }, DefinePropertyOrThrow: { url: 'https://262.ecma-international.org/6.0/#sec-definepropertyorthrow' }, DeletePropertyOrThrow: { url: 'https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow' }, DetachArrayBuffer: { url: 'https://262.ecma-international.org/6.0/#sec-detacharraybuffer' }, Encode: { url: 'https://262.ecma-international.org/6.0/#sec-encode' }, EnqueueJob: { url: 'https://262.ecma-international.org/6.0/#sec-enqueuejob' }, EnumerableOwnNames: { url: 'https://262.ecma-international.org/6.0/#sec-enumerableownnames' }, EscapeRegExpPattern: { url: 'https://262.ecma-international.org/6.0/#sec-escaperegexppattern' }, EvalDeclarationInstantiation: { url: 'https://262.ecma-international.org/6.0/#sec-evaldeclarationinstantiation' }, EvaluateCall: { url: 'https://262.ecma-international.org/6.0/#sec-evaluatecall' }, EvaluateDirectCall: { url: 'https://262.ecma-international.org/6.0/#sec-evaluatedirectcall' }, EvaluateNew: { url: 'https://262.ecma-international.org/6.0/#sec-evaluatenew' }, floor: { url: 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions' }, ForBodyEvaluation: { url: 'https://262.ecma-international.org/6.0/#sec-forbodyevaluation' }, 'ForIn/OfBodyEvaluation': { url: 'https://262.ecma-international.org/6.0/#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset' }, 'ForIn/OfHeadEvaluation': { url: 'https://262.ecma-international.org/6.0/#sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind' }, FromPropertyDescriptor: { url: 'https://262.ecma-international.org/6.0/#sec-frompropertydescriptor' }, FulfillPromise: { url: 'https://262.ecma-international.org/6.0/#sec-fulfillpromise' }, FunctionAllocate: { url: 'https://262.ecma-international.org/6.0/#sec-functionallocate' }, FunctionCreate: { url: 'https://262.ecma-international.org/6.0/#sec-functioncreate' }, FunctionInitialize: { url: 'https://262.ecma-international.org/6.0/#sec-functioninitialize' }, GeneratorFunctionCreate: { url: 'https://262.ecma-international.org/6.0/#sec-generatorfunctioncreate' }, GeneratorResume: { url: 'https://262.ecma-international.org/6.0/#sec-generatorresume' }, GeneratorResumeAbrupt: { url: 'https://262.ecma-international.org/6.0/#sec-generatorresumeabrupt' }, GeneratorStart: { url: 'https://262.ecma-international.org/6.0/#sec-generatorstart' }, GeneratorValidate: { url: 'https://262.ecma-international.org/6.0/#sec-generatorvalidate' }, GeneratorYield: { url: 'https://262.ecma-international.org/6.0/#sec-generatoryield' }, Get: { url: 'https://262.ecma-international.org/6.0/#sec-get-o-p' }, GetBase: { url: 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues' }, GetFunctionRealm: { url: 'https://262.ecma-international.org/6.0/#sec-getfunctionrealm' }, GetGlobalObject: { url: 'https://262.ecma-international.org/6.0/#sec-getglobalobject' }, GetIdentifierReference: { url: 'https://262.ecma-international.org/6.0/#sec-getidentifierreference' }, GetIterator: { url: 'https://262.ecma-international.org/6.0/#sec-getiterator' }, GetMethod: { url: 'https://262.ecma-international.org/6.0/#sec-getmethod' }, GetModuleNamespace: { url: 'https://262.ecma-international.org/6.0/#sec-getmodulenamespace' }, GetNewTarget: { url: 'https://262.ecma-international.org/6.0/#sec-getnewtarget' }, GetOwnPropertyKeys: { url: 'https://262.ecma-international.org/6.0/#sec-getownpropertykeys' }, GetPrototypeFromConstructor: { url: 'https://262.ecma-international.org/6.0/#sec-getprototypefromconstructor' }, GetReferencedName: { url: 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues' }, GetSubstitution: { url: 'https://262.ecma-international.org/6.0/#sec-getsubstitution' }, GetSuperConstructor: { url: 'https://262.ecma-international.org/6.0/#sec-getsuperconstructor' }, GetTemplateObject: { url: 'https://262.ecma-international.org/6.0/#sec-gettemplateobject' }, GetThisEnvironment: { url: 'https://262.ecma-international.org/6.0/#sec-getthisenvironment' }, GetThisValue: { url: 'https://262.ecma-international.org/6.0/#sec-getthisvalue' }, GetV: { url: 'https://262.ecma-international.org/6.0/#sec-getv' }, GetValue: { url: 'https://262.ecma-international.org/6.0/#sec-getvalue' }, GetValueFromBuffer: { url: 'https://262.ecma-international.org/6.0/#sec-getvaluefrombuffer' }, GetViewValue: { url: 'https://262.ecma-international.org/6.0/#sec-getviewvalue' }, HasOwnProperty: { url: 'https://262.ecma-international.org/6.0/#sec-hasownproperty' }, HasPrimitiveBase: { url: 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues' }, HasProperty: { url: 'https://262.ecma-international.org/6.0/#sec-hasproperty' }, HostResolveImportedModule: { url: 'sec-hostresolveimportedmodule' }, HourFromTime: { url: 'https://262.ecma-international.org/6.0/#sec-hours-minutes-second-and-milliseconds' }, ImportedLocalNames: { url: 'https://262.ecma-international.org/6.0/#sec-importedlocalnames' }, InitializeHostDefinedRealm: { url: 'https://262.ecma-international.org/6.0/#sec-initializehostdefinedrealm' }, InitializeReferencedBinding: { url: 'https://262.ecma-international.org/6.0/#sec-initializereferencedbinding' }, InLeapYear: { url: 'https://262.ecma-international.org/6.0/#sec-year-number' }, InstanceofOperator: { url: 'https://262.ecma-international.org/6.0/#sec-instanceofoperator' }, IntegerIndexedElementGet: { url: 'https://262.ecma-international.org/6.0/#sec-integerindexedelementget' }, IntegerIndexedElementSet: { url: 'https://262.ecma-international.org/6.0/#sec-integerindexedelementset' }, IntegerIndexedObjectCreate: { url: 'https://262.ecma-international.org/6.0/#sec-integerindexedobjectcreate' }, InternalizeJSONProperty: { url: 'https://262.ecma-international.org/6.0/#sec-internalizejsonproperty' }, Invoke: { url: 'https://262.ecma-international.org/6.0/#sec-invoke' }, IsAccessorDescriptor: { url: 'https://262.ecma-international.org/6.0/#sec-isaccessordescriptor' }, IsAnonymousFunctionDefinition: { url: 'https://262.ecma-international.org/6.0/#sec-isanonymousfunctiondefinition' }, IsArray: { url: 'https://262.ecma-international.org/6.0/#sec-isarray' }, IsCallable: { url: 'https://262.ecma-international.org/6.0/#sec-iscallable' }, IsCompatiblePropertyDescriptor: { url: 'https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor' }, IsConcatSpreadable: { url: 'https://262.ecma-international.org/6.0/#sec-isconcatspreadable' }, IsConstructor: { url: 'https://262.ecma-international.org/6.0/#sec-isconstructor' }, IsDataDescriptor: { url: 'https://262.ecma-international.org/6.0/#sec-isdatadescriptor' }, IsDetachedBuffer: { url: 'https://262.ecma-international.org/6.0/#sec-isdetachedbuffer' }, IsExtensible: { url: 'https://262.ecma-international.org/6.0/#sec-isextensible-o' }, IsGenericDescriptor: { url: 'https://262.ecma-international.org/6.0/#sec-isgenericdescriptor' }, IsInTailPosition: { url: 'https://262.ecma-international.org/6.0/#sec-isintailposition' }, IsInteger: { url: 'https://262.ecma-international.org/6.0/#sec-isinteger' }, IsLabelledFunction: { url: 'https://262.ecma-international.org/6.0/#sec-islabelledfunction' }, IsPromise: { url: 'https://262.ecma-international.org/6.0/#sec-ispromise' }, IsPropertyKey: { url: 'https://262.ecma-international.org/6.0/#sec-ispropertykey' }, IsPropertyReference: { url: 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues' }, IsRegExp: { url: 'https://262.ecma-international.org/6.0/#sec-isregexp' }, IsStrictReference: { url: 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues' }, IsSuperReference: { url: 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues' }, IsUnresolvableReference: { url: 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues' }, IsWordChar: { url: 'https://262.ecma-international.org/6.0/#sec-runtime-semantics-iswordchar-abstract-operation' }, IteratorClose: { url: 'https://262.ecma-international.org/6.0/#sec-iteratorclose' }, IteratorComplete: { url: 'https://262.ecma-international.org/6.0/#sec-iteratorcomplete' }, IteratorNext: { url: 'https://262.ecma-international.org/6.0/#sec-iteratornext' }, IteratorStep: { url: 'https://262.ecma-international.org/6.0/#sec-iteratorstep' }, IteratorValue: { url: 'https://262.ecma-international.org/6.0/#sec-iteratorvalue' }, LocalTime: { url: 'https://262.ecma-international.org/6.0/#sec-localtime' }, LoopContinues: { url: 'https://262.ecma-international.org/6.0/#sec-loopcontinues' }, MakeArgGetter: { url: 'https://262.ecma-international.org/6.0/#sec-makearggetter' }, MakeArgSetter: { url: 'https://262.ecma-international.org/6.0/#sec-makeargsetter' }, MakeClassConstructor: { url: 'https://262.ecma-international.org/6.0/#sec-makeclassconstructor' }, MakeConstructor: { url: 'https://262.ecma-international.org/6.0/#sec-makeconstructor' }, MakeDate: { url: 'https://262.ecma-international.org/6.0/#sec-makedate' }, MakeDay: { url: 'https://262.ecma-international.org/6.0/#sec-makeday' }, MakeMethod: { url: 'https://262.ecma-international.org/6.0/#sec-makemethod' }, MakeSuperPropertyReference: { url: 'https://262.ecma-international.org/6.0/#sec-makesuperpropertyreference' }, MakeTime: { url: 'https://262.ecma-international.org/6.0/#sec-maketime' }, max: { url: 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions' }, min: { url: 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions' }, MinFromTime: { url: 'https://262.ecma-international.org/6.0/#sec-hours-minutes-second-and-milliseconds' }, ModuleNamespaceCreate: { url: 'https://262.ecma-international.org/6.0/#sec-modulenamespacecreate' }, modulo: { url: 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions' }, MonthFromTime: { url: 'https://262.ecma-international.org/6.0/#sec-month-number' }, msFromTime: { url: 'https://262.ecma-international.org/6.0/#sec-hours-minutes-second-and-milliseconds' }, msPerDay: { url: 'https://262.ecma-international.org/6.0/#sec-day-number-and-time-within-day' }, NewDeclarativeEnvironment: { url: 'https://262.ecma-international.org/6.0/#sec-newdeclarativeenvironment' }, NewFunctionEnvironment: { url: 'https://262.ecma-international.org/6.0/#sec-newfunctionenvironment' }, NewGlobalEnvironment: { url: 'https://262.ecma-international.org/6.0/#sec-newglobalenvironment' }, NewModuleEnvironment: { url: 'https://262.ecma-international.org/6.0/#sec-newmoduleenvironment' }, NewObjectEnvironment: { url: 'https://262.ecma-international.org/6.0/#sec-newobjectenvironment' }, NewPromiseCapability: { url: 'https://262.ecma-international.org/6.0/#sec-newpromisecapability' }, NormalCompletion: { url: 'https://262.ecma-international.org/6.0/#sec-normalcompletion' }, ObjectCreate: { url: 'https://262.ecma-international.org/6.0/#sec-objectcreate' }, ObjectDefineProperties: { url: 'https://262.ecma-international.org/6.0/#sec-objectdefineproperties' }, OrdinaryCallBindThis: { url: 'https://262.ecma-international.org/6.0/#sec-ordinarycallbindthis' }, OrdinaryCallEvaluateBody: { url: 'https://262.ecma-international.org/6.0/#sec-ordinarycallevaluatebody' }, OrdinaryCreateFromConstructor: { url: 'https://262.ecma-international.org/6.0/#sec-ordinarycreatefromconstructor' }, OrdinaryDefineOwnProperty: { url: 'https://262.ecma-international.org/6.0/#sec-ordinarydefineownproperty' }, OrdinaryGetOwnProperty: { url: 'https://262.ecma-international.org/6.0/#sec-ordinarygetownproperty' }, OrdinaryHasInstance: { url: 'https://262.ecma-international.org/6.0/#sec-ordinaryhasinstance' }, OrdinaryHasProperty: { url: 'https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty' }, ParseModule: { url: 'https://262.ecma-international.org/6.0/#sec-parsemodule' }, PerformEval: { url: 'https://262.ecma-international.org/6.0/#sec-performeval' }, PerformPromiseAll: { url: 'https://262.ecma-international.org/6.0/#sec-performpromiseall' }, PerformPromiseRace: { url: 'https://262.ecma-international.org/6.0/#sec-performpromiserace' }, PerformPromiseThen: { url: 'https://262.ecma-international.org/6.0/#sec-performpromisethen' }, PrepareForOrdinaryCall: { url: 'https://262.ecma-international.org/6.0/#sec-prepareforordinarycall' }, PrepareForTailCall: { url: 'https://262.ecma-international.org/6.0/#sec-preparefortailcall' }, ProxyCreate: { url: 'https://262.ecma-international.org/6.0/#sec-proxycreate' }, PutValue: { url: 'https://262.ecma-international.org/6.0/#sec-putvalue' }, QuoteJSONString: { url: 'https://262.ecma-international.org/6.0/#sec-quotejsonstring' }, RegExpAlloc: { url: 'https://262.ecma-international.org/6.0/#sec-regexpalloc' }, RegExpBuiltinExec: { url: 'https://262.ecma-international.org/6.0/#sec-regexpbuiltinexec' }, RegExpCreate: { url: 'https://262.ecma-international.org/6.0/#sec-regexpcreate' }, RegExpExec: { url: 'https://262.ecma-international.org/6.0/#sec-regexpexec' }, RegExpInitialize: { url: 'https://262.ecma-international.org/6.0/#sec-regexpinitialize' }, RejectPromise: { url: 'https://262.ecma-international.org/6.0/#sec-rejectpromise' }, RepeatMatcher: { url: 'https://262.ecma-international.org/6.0/#sec-runtime-semantics-repeatmatcher-abstract-operation' }, RequireObjectCoercible: { url: 'https://262.ecma-international.org/6.0/#sec-requireobjectcoercible' }, ResolveBinding: { url: 'https://262.ecma-international.org/6.0/#sec-resolvebinding' }, ResolveThisBinding: { url: 'https://262.ecma-international.org/6.0/#sec-resolvethisbinding' }, SameValue: { url: 'https://262.ecma-international.org/6.0/#sec-samevalue' }, SameValueZero: { url: 'https://262.ecma-international.org/6.0/#sec-samevaluezero' }, SecFromTime: { url: 'https://262.ecma-international.org/6.0/#sec-hours-minutes-second-and-milliseconds' }, SerializeJSONArray: { url: 'https://262.ecma-international.org/6.0/#sec-serializejsonarray' }, SerializeJSONObject: { url: 'https://262.ecma-international.org/6.0/#sec-serializejsonobject' }, SerializeJSONProperty: { url: 'https://262.ecma-international.org/6.0/#sec-serializejsonproperty' }, Set: { url: 'https://262.ecma-international.org/6.0/#sec-set-o-p-v-throw' }, SetDefaultGlobalBindings: { url: 'https://262.ecma-international.org/6.0/#sec-setdefaultglobalbindings' }, SetFunctionName: { url: 'https://262.ecma-international.org/6.0/#sec-setfunctionname' }, SetIntegrityLevel: { url: 'https://262.ecma-international.org/6.0/#sec-setintegritylevel' }, SetRealmGlobalObject: { url: 'https://262.ecma-international.org/6.0/#sec-setrealmglobalobject' }, SetValueInBuffer: { url: 'https://262.ecma-international.org/6.0/#sec-setvalueinbuffer' }, SetViewValue: { url: 'https://262.ecma-international.org/6.0/#sec-setviewvalue' }, sign: { url: 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions' }, SortCompare: { url: 'https://262.ecma-international.org/6.0/#sec-sortcompare' }, SpeciesConstructor: { url: 'https://262.ecma-international.org/6.0/#sec-speciesconstructor' }, SplitMatch: { url: 'https://262.ecma-international.org/6.0/#sec-splitmatch' }, 'Strict Equality Comparison': { url: 'https://262.ecma-international.org/6.0/#sec-strict-equality-comparison' }, StringCreate: { url: 'https://262.ecma-international.org/6.0/#sec-stringcreate' }, StringGetIndexProperty: { url: 'https://262.ecma-international.org/6.0/#sec-stringgetindexproperty' }, SymbolDescriptiveString: { url: 'https://262.ecma-international.org/6.0/#sec-symboldescriptivestring' }, TestIntegrityLevel: { url: 'https://262.ecma-international.org/6.0/#sec-testintegritylevel' }, thisBooleanValue: { url: 'https://262.ecma-international.org/6.0/#sec-properties-of-the-boolean-prototype-object' }, thisNumberValue: { url: 'https://262.ecma-international.org/6.0/#sec-properties-of-the-number-prototype-object' }, thisStringValue: { url: 'https://262.ecma-international.org/6.0/#sec-properties-of-the-string-prototype-object' }, thisTimeValue: { url: 'https://262.ecma-international.org/6.0/#sec-properties-of-the-date-prototype-object' }, TimeClip: { url: 'https://262.ecma-international.org/6.0/#sec-timeclip' }, TimeFromYear: { url: 'https://262.ecma-international.org/6.0/#sec-year-number' }, TimeWithinDay: { url: 'https://262.ecma-international.org/6.0/#sec-day-number-and-time-within-day' }, ToBoolean: { url: 'https://262.ecma-international.org/6.0/#sec-toboolean' }, ToDateString: { url: 'https://262.ecma-international.org/6.0/#sec-todatestring' }, ToInt16: { url: 'https://262.ecma-international.org/6.0/#sec-toint16' }, ToInt32: { url: 'https://262.ecma-international.org/6.0/#sec-toint32' }, ToInt8: { url: 'https://262.ecma-international.org/6.0/#sec-toint8' }, ToInteger: { url: 'https://262.ecma-international.org/6.0/#sec-tointeger' }, ToLength: { url: 'https://262.ecma-international.org/6.0/#sec-tolength' }, ToNumber: { url: 'https://262.ecma-international.org/6.0/#sec-tonumber' }, ToObject: { url: 'https://262.ecma-international.org/6.0/#sec-toobject' }, ToPrimitive: { url: 'https://262.ecma-international.org/6.0/#sec-toprimitive' }, ToPropertyDescriptor: { url: 'https://262.ecma-international.org/6.0/#sec-topropertydescriptor' }, ToPropertyKey: { url: 'https://262.ecma-international.org/6.0/#sec-topropertykey' }, ToString: { url: 'https://262.ecma-international.org/6.0/#sec-tostring' }, ToUint16: { url: 'https://262.ecma-international.org/6.0/#sec-touint16' }, ToUint32: { url: 'https://262.ecma-international.org/6.0/#sec-touint32' }, ToUint8: { url: 'https://262.ecma-international.org/6.0/#sec-touint8' }, ToUint8Clamp: { url: 'https://262.ecma-international.org/6.0/#sec-touint8clamp' }, TriggerPromiseReactions: { url: 'https://262.ecma-international.org/6.0/#sec-triggerpromisereactions' }, Type: { url: 'https://262.ecma-international.org/6.0/#sec-ecmascript-data-types-and-values' }, TypedArrayFrom: { url: 'https://262.ecma-international.org/6.0/#sec-typedarrayfrom' }, UpdateEmpty: { url: 'https://262.ecma-international.org/6.0/#sec-updateempty' }, UTC: { url: 'https://262.ecma-international.org/6.0/#sec-utc-t' }, ValidateAndApplyPropertyDescriptor: { url: 'https://262.ecma-international.org/6.0/#sec-validateandapplypropertydescriptor' }, WeekDay: { url: 'https://262.ecma-international.org/6.0/#sec-week-day' }, YearFromTime: { url: 'https://262.ecma-international.org/6.0/#sec-year-number' } }; es-abstract-1.20.4/operations/2016.js000066400000000000000000000642071431761430200171310ustar00rootroot00000000000000'use strict'; module.exports = { IsPropertyDescriptor: 'https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type', // not actually an abstract op abs: { url: 'https://262.ecma-international.org/7.0/#sec-algorithm-conventions' }, 'Abstract Equality Comparison': { url: 'https://262.ecma-international.org/7.0/#sec-abstract-equality-comparison' }, 'Abstract Relational Comparison': { url: 'https://262.ecma-international.org/7.0/#sec-abstract-relational-comparison' }, AddRestrictedFunctionProperties: { url: 'https://262.ecma-international.org/7.0/#sec-addrestrictedfunctionproperties' }, AdvanceStringIndex: { url: 'https://262.ecma-international.org/7.0/#sec-advancestringindex' }, AllocateArrayBuffer: { url: 'https://262.ecma-international.org/7.0/#sec-allocatearraybuffer' }, AllocateTypedArray: { url: 'https://262.ecma-international.org/7.0/#sec-allocatetypedarray' }, AllocateTypedArrayBuffer: { url: 'https://262.ecma-international.org/7.0/#sec-allocatetypedarraybuffer' }, ArrayCreate: { url: 'https://262.ecma-international.org/7.0/#sec-arraycreate' }, ArraySetLength: { url: 'https://262.ecma-international.org/7.0/#sec-arraysetlength' }, ArraySpeciesCreate: { url: 'https://262.ecma-international.org/7.0/#sec-arrayspeciescreate' }, BlockDeclarationInstantiation: { url: 'https://262.ecma-international.org/7.0/#sec-blockdeclarationinstantiation' }, BoundFunctionCreate: { url: 'https://262.ecma-international.org/7.0/#sec-boundfunctioncreate' }, Call: { url: 'https://262.ecma-international.org/7.0/#sec-call' }, Canonicalize: { url: 'https://262.ecma-international.org/7.0/#sec-runtime-semantics-canonicalize-ch' }, CanonicalNumericIndexString: { url: 'https://262.ecma-international.org/7.0/#sec-canonicalnumericindexstring' }, CharacterRange: { url: 'https://262.ecma-international.org/7.0/#sec-runtime-semantics-characterrange-abstract-operation' }, CharacterRangeOrUnion: { url: 'https://262.ecma-international.org/7.0/#sec-runtime-semantics-characterrangeorunion-abstract-operation' }, CharacterSetMatcher: { url: 'https://262.ecma-international.org/7.0/#sec-runtime-semantics-charactersetmatcher-abstract-operation' }, CloneArrayBuffer: { url: 'https://262.ecma-international.org/7.0/#sec-clonearraybuffer' }, CompletePropertyDescriptor: { url: 'https://262.ecma-international.org/7.0/#sec-completepropertydescriptor' }, Completion: { url: 'https://262.ecma-international.org/7.0/#sec-completion-record-specification-type' }, Construct: { url: 'https://262.ecma-international.org/7.0/#sec-construct' }, CopyDataBlockBytes: { url: 'https://262.ecma-international.org/7.0/#sec-copydatablockbytes' }, CreateArrayFromList: { url: 'https://262.ecma-international.org/7.0/#sec-createarrayfromlist' }, CreateArrayIterator: { url: 'https://262.ecma-international.org/7.0/#sec-createarrayiterator' }, CreateBuiltinFunction: { url: 'https://262.ecma-international.org/7.0/#sec-createbuiltinfunction' }, CreateByteDataBlock: { url: 'https://262.ecma-international.org/7.0/#sec-createbytedatablock' }, CreateDataProperty: { url: 'https://262.ecma-international.org/7.0/#sec-createdataproperty' }, CreateDataPropertyOrThrow: { url: 'https://262.ecma-international.org/7.0/#sec-createdatapropertyorthrow' }, CreateDynamicFunction: { url: 'https://262.ecma-international.org/7.0/#sec-createdynamicfunction' }, CreateHTML: { url: 'https://262.ecma-international.org/7.0/#sec-createhtml' }, CreateIntrinsics: { url: 'https://262.ecma-international.org/7.0/#sec-createintrinsics' }, CreateIterResultObject: { url: 'https://262.ecma-international.org/7.0/#sec-createiterresultobject' }, CreateListFromArrayLike: { url: 'https://262.ecma-international.org/7.0/#sec-createlistfromarraylike' }, CreateListIterator: { url: 'https://262.ecma-international.org/7.0/#sec-createlistiterator' }, CreateMapIterator: { url: 'https://262.ecma-international.org/7.0/#sec-createmapiterator' }, CreateMappedArgumentsObject: { url: 'https://262.ecma-international.org/7.0/#sec-createmappedargumentsobject' }, CreateMethodProperty: { url: 'https://262.ecma-international.org/7.0/#sec-createmethodproperty' }, CreatePerIterationEnvironment: { url: 'https://262.ecma-international.org/7.0/#sec-createperiterationenvironment' }, CreateRealm: { url: 'https://262.ecma-international.org/7.0/#sec-createrealm' }, CreateResolvingFunctions: { url: 'https://262.ecma-international.org/7.0/#sec-createresolvingfunctions' }, CreateSetIterator: { url: 'https://262.ecma-international.org/7.0/#sec-createsetiterator' }, CreateStringIterator: { url: 'https://262.ecma-international.org/7.0/#sec-createstringiterator' }, CreateUnmappedArgumentsObject: { url: 'https://262.ecma-international.org/7.0/#sec-createunmappedargumentsobject' }, DateFromTime: { url: 'https://262.ecma-international.org/7.0/#sec-date-number' }, Day: { url: 'https://262.ecma-international.org/7.0/#sec-day-number-and-time-within-day' }, DayFromYear: { url: 'https://262.ecma-international.org/7.0/#sec-year-number' }, DaylightSavingTA: { url: 'https://262.ecma-international.org/7.0/#sec-daylight-saving-time-adjustment' }, DaysInYear: { url: 'https://262.ecma-international.org/7.0/#sec-year-number' }, DayWithinYear: { url: 'https://262.ecma-international.org/7.0/#sec-month-number' }, Decode: { url: 'https://262.ecma-international.org/7.0/#sec-decode' }, DefinePropertyOrThrow: { url: 'https://262.ecma-international.org/7.0/#sec-definepropertyorthrow' }, DeletePropertyOrThrow: { url: 'https://262.ecma-international.org/7.0/#sec-deletepropertyorthrow' }, DetachArrayBuffer: { url: 'https://262.ecma-international.org/7.0/#sec-detacharraybuffer' }, Encode: { url: 'https://262.ecma-international.org/7.0/#sec-encode' }, EnqueueJob: { url: 'https://262.ecma-international.org/7.0/#sec-enqueuejob' }, EnumerableOwnNames: { url: 'https://262.ecma-international.org/7.0/#sec-enumerableownnames' }, EnumerateObjectProperties: { url: 'https://262.ecma-international.org/7.0/#sec-enumerate-object-properties' }, EscapeRegExpPattern: { url: 'https://262.ecma-international.org/7.0/#sec-escaperegexppattern' }, EvalDeclarationInstantiation: { url: 'https://262.ecma-international.org/7.0/#sec-evaldeclarationinstantiation' }, EvaluateCall: { url: 'https://262.ecma-international.org/7.0/#sec-evaluatecall' }, EvaluateDirectCall: { url: 'https://262.ecma-international.org/7.0/#sec-evaluatedirectcall' }, EvaluateNew: { url: 'https://262.ecma-international.org/7.0/#sec-evaluatenew' }, floor: { url: 'https://262.ecma-international.org/7.0/#sec-algorithm-conventions' }, ForBodyEvaluation: { url: 'https://262.ecma-international.org/7.0/#sec-forbodyevaluation' }, 'ForIn/OfBodyEvaluation': { url: 'https://262.ecma-international.org/7.0/#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset' }, 'ForIn/OfHeadEvaluation': { url: 'https://262.ecma-international.org/7.0/#sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind' }, FromPropertyDescriptor: { url: 'https://262.ecma-international.org/7.0/#sec-frompropertydescriptor' }, FulfillPromise: { url: 'https://262.ecma-international.org/7.0/#sec-fulfillpromise' }, FunctionAllocate: { url: 'https://262.ecma-international.org/7.0/#sec-functionallocate' }, FunctionCreate: { url: 'https://262.ecma-international.org/7.0/#sec-functioncreate' }, FunctionDeclarationInstantiation: { url: 'https://262.ecma-international.org/7.0/#sec-functiondeclarationinstantiation' }, FunctionInitialize: { url: 'https://262.ecma-international.org/7.0/#sec-functioninitialize' }, GeneratorFunctionCreate: { url: 'https://262.ecma-international.org/7.0/#sec-generatorfunctioncreate' }, GeneratorResume: { url: 'https://262.ecma-international.org/7.0/#sec-generatorresume' }, GeneratorResumeAbrupt: { url: 'https://262.ecma-international.org/7.0/#sec-generatorresumeabrupt' }, GeneratorStart: { url: 'https://262.ecma-international.org/7.0/#sec-generatorstart' }, GeneratorValidate: { url: 'https://262.ecma-international.org/7.0/#sec-generatorvalidate' }, GeneratorYield: { url: 'https://262.ecma-international.org/7.0/#sec-generatoryield' }, Get: { url: 'https://262.ecma-international.org/7.0/#sec-get-o-p' }, GetActiveScriptOrModule: { url: 'https://262.ecma-international.org/7.0/#sec-getactivescriptormodule' }, GetFunctionRealm: { url: 'https://262.ecma-international.org/7.0/#sec-getfunctionrealm' }, GetGlobalObject: { url: 'https://262.ecma-international.org/7.0/#sec-getglobalobject' }, GetIdentifierReference: { url: 'https://262.ecma-international.org/7.0/#sec-getidentifierreference' }, GetIterator: { url: 'https://262.ecma-international.org/7.0/#sec-getiterator' }, GetMethod: { url: 'https://262.ecma-international.org/7.0/#sec-getmethod' }, GetModuleNamespace: { url: 'https://262.ecma-international.org/7.0/#sec-getmodulenamespace' }, GetNewTarget: { url: 'https://262.ecma-international.org/7.0/#sec-getnewtarget' }, GetOwnPropertyKeys: { url: 'https://262.ecma-international.org/7.0/#sec-getownpropertykeys' }, GetPrototypeFromConstructor: { url: 'https://262.ecma-international.org/7.0/#sec-getprototypefromconstructor' }, GetSubstitution: { url: 'https://262.ecma-international.org/7.0/#sec-getsubstitution' }, GetSuperConstructor: { url: 'https://262.ecma-international.org/7.0/#sec-getsuperconstructor' }, GetTemplateObject: { url: 'https://262.ecma-international.org/7.0/#sec-gettemplateobject' }, GetThisEnvironment: { url: 'https://262.ecma-international.org/7.0/#sec-getthisenvironment' }, GetThisValue: { url: 'https://262.ecma-international.org/7.0/#sec-getthisvalue' }, GetV: { url: 'https://262.ecma-international.org/7.0/#sec-getv' }, GetValue: { url: 'https://262.ecma-international.org/7.0/#sec-getvalue' }, GetValueFromBuffer: { url: 'https://262.ecma-international.org/7.0/#sec-getvaluefrombuffer' }, GetViewValue: { url: 'https://262.ecma-international.org/7.0/#sec-getviewvalue' }, GlobalDeclarationInstantiation: { url: 'https://262.ecma-international.org/7.0/#sec-globaldeclarationinstantiation' }, HasOwnProperty: { url: 'https://262.ecma-international.org/7.0/#sec-hasownproperty' }, HasProperty: { url: 'https://262.ecma-international.org/7.0/#sec-hasproperty' }, HostPromiseRejectionTracker: { url: 'https://262.ecma-international.org/7.0/#sec-host-promise-rejection-tracker' }, HostReportErrors: { url: 'https://262.ecma-international.org/7.0/#sec-host-report-errors' }, HostResolveImportedModule: { url: 'https://262.ecma-international.org/7.0/#sec-hostresolveimportedmodule' }, HourFromTime: { url: 'https://262.ecma-international.org/7.0/#sec-hours-minutes-second-and-milliseconds' }, IfAbruptRejectPromise: { url: 'https://262.ecma-international.org/7.0/#sec-ifabruptrejectpromise' }, ImportedLocalNames: { url: 'https://262.ecma-international.org/7.0/#sec-importedlocalnames' }, InitializeBoundName: { url: 'https://262.ecma-international.org/7.0/#sec-initializeboundname' }, InitializeHostDefinedRealm: { url: 'https://262.ecma-international.org/7.0/#sec-initializehostdefinedrealm' }, InitializeReferencedBinding: { url: 'https://262.ecma-international.org/7.0/#sec-initializereferencedbinding' }, InLeapYear: { url: 'https://262.ecma-international.org/7.0/#sec-year-number' }, InstanceofOperator: { url: 'https://262.ecma-international.org/7.0/#sec-instanceofoperator' }, IntegerIndexedElementGet: { url: 'https://262.ecma-international.org/7.0/#sec-integerindexedelementget' }, IntegerIndexedElementSet: { url: 'https://262.ecma-international.org/7.0/#sec-integerindexedelementset' }, IntegerIndexedObjectCreate: { url: 'https://262.ecma-international.org/7.0/#sec-integerindexedobjectcreate' }, InternalizeJSONProperty: { url: 'https://262.ecma-international.org/7.0/#sec-internalizejsonproperty' }, Invoke: { url: 'https://262.ecma-international.org/7.0/#sec-invoke' }, IsAccessorDescriptor: { url: 'https://262.ecma-international.org/7.0/#sec-isaccessordescriptor' }, IsAnonymousFunctionDefinition: { url: 'https://262.ecma-international.org/7.0/#sec-isanonymousfunctiondefinition' }, IsArray: { url: 'https://262.ecma-international.org/7.0/#sec-isarray' }, IsCallable: { url: 'https://262.ecma-international.org/7.0/#sec-iscallable' }, IsCompatiblePropertyDescriptor: { url: 'https://262.ecma-international.org/7.0/#sec-iscompatiblepropertydescriptor' }, IsConcatSpreadable: { url: 'https://262.ecma-international.org/7.0/#sec-isconcatspreadable' }, IsConstructor: { url: 'https://262.ecma-international.org/7.0/#sec-isconstructor' }, IsDataDescriptor: { url: 'https://262.ecma-international.org/7.0/#sec-isdatadescriptor' }, IsDetachedBuffer: { url: 'https://262.ecma-international.org/7.0/#sec-isdetachedbuffer' }, IsExtensible: { url: 'https://262.ecma-international.org/7.0/#sec-isextensible-o' }, IsGenericDescriptor: { url: 'https://262.ecma-international.org/7.0/#sec-isgenericdescriptor' }, IsInTailPosition: { url: 'https://262.ecma-international.org/7.0/#sec-isintailposition' }, IsInteger: { url: 'https://262.ecma-international.org/7.0/#sec-isinteger' }, IsLabelledFunction: { url: 'https://262.ecma-international.org/7.0/#sec-islabelledfunction' }, IsPromise: { url: 'https://262.ecma-international.org/7.0/#sec-ispromise' }, IsPropertyKey: { url: 'https://262.ecma-international.org/7.0/#sec-ispropertykey' }, IsRegExp: { url: 'https://262.ecma-international.org/7.0/#sec-isregexp' }, IsWordChar: { url: 'https://262.ecma-international.org/7.0/#sec-runtime-semantics-iswordchar-abstract-operation' }, IterableToArrayLike: { url: 'https://262.ecma-international.org/7.0/#sec-iterabletoarraylike' }, IteratorClose: { url: 'https://262.ecma-international.org/7.0/#sec-iteratorclose' }, IteratorComplete: { url: 'https://262.ecma-international.org/7.0/#sec-iteratorcomplete' }, IteratorNext: { url: 'https://262.ecma-international.org/7.0/#sec-iteratornext' }, IteratorStep: { url: 'https://262.ecma-international.org/7.0/#sec-iteratorstep' }, IteratorValue: { url: 'https://262.ecma-international.org/7.0/#sec-iteratorvalue' }, LocalTime: { url: 'https://262.ecma-international.org/7.0/#sec-localtime' }, LoopContinues: { url: 'https://262.ecma-international.org/7.0/#sec-loopcontinues' }, MakeArgGetter: { url: 'https://262.ecma-international.org/7.0/#sec-makearggetter' }, MakeArgSetter: { url: 'https://262.ecma-international.org/7.0/#sec-makeargsetter' }, MakeClassConstructor: { url: 'https://262.ecma-international.org/7.0/#sec-makeclassconstructor' }, MakeConstructor: { url: 'https://262.ecma-international.org/7.0/#sec-makeconstructor' }, MakeDate: { url: 'https://262.ecma-international.org/7.0/#sec-makedate' }, MakeDay: { url: 'https://262.ecma-international.org/7.0/#sec-makeday' }, MakeMethod: { url: 'https://262.ecma-international.org/7.0/#sec-makemethod' }, MakeSuperPropertyReference: { url: 'https://262.ecma-international.org/7.0/#sec-makesuperpropertyreference' }, MakeTime: { url: 'https://262.ecma-international.org/7.0/#sec-maketime' }, max: { url: 'https://262.ecma-international.org/7.0/#sec-algorithm-conventions' }, min: { url: 'https://262.ecma-international.org/7.0/#sec-algorithm-conventions' }, MinFromTime: { url: 'https://262.ecma-international.org/7.0/#sec-hours-minutes-second-and-milliseconds' }, ModuleNamespaceCreate: { url: 'https://262.ecma-international.org/7.0/#sec-modulenamespacecreate' }, modulo: { url: 'https://262.ecma-international.org/7.0/#sec-algorithm-conventions' }, MonthFromTime: { url: 'https://262.ecma-international.org/7.0/#sec-month-number' }, msFromTime: { url: 'https://262.ecma-international.org/7.0/#sec-hours-minutes-second-and-milliseconds' }, NewDeclarativeEnvironment: { url: 'https://262.ecma-international.org/7.0/#sec-newdeclarativeenvironment' }, NewFunctionEnvironment: { url: 'https://262.ecma-international.org/7.0/#sec-newfunctionenvironment' }, NewGlobalEnvironment: { url: 'https://262.ecma-international.org/7.0/#sec-newglobalenvironment' }, NewModuleEnvironment: { url: 'https://262.ecma-international.org/7.0/#sec-newmoduleenvironment' }, NewObjectEnvironment: { url: 'https://262.ecma-international.org/7.0/#sec-newobjectenvironment' }, NewPromiseCapability: { url: 'https://262.ecma-international.org/7.0/#sec-newpromisecapability' }, NextJob: { url: 'https://262.ecma-international.org/7.0/#sec-nextjob-result' }, NormalCompletion: { url: 'https://262.ecma-international.org/7.0/#sec-normalcompletion' }, ObjectCreate: { url: 'https://262.ecma-international.org/7.0/#sec-objectcreate' }, ObjectDefineProperties: { url: 'https://262.ecma-international.org/7.0/#sec-objectdefineproperties' }, OrdinaryCallBindThis: { url: 'https://262.ecma-international.org/7.0/#sec-ordinarycallbindthis' }, OrdinaryCallEvaluateBody: { url: 'https://262.ecma-international.org/7.0/#sec-ordinarycallevaluatebody' }, OrdinaryCreateFromConstructor: { url: 'https://262.ecma-international.org/7.0/#sec-ordinarycreatefromconstructor' }, OrdinaryDefineOwnProperty: { url: 'https://262.ecma-international.org/7.0/#sec-ordinarydefineownproperty' }, OrdinaryDelete: { url: 'https://262.ecma-international.org/7.0/#sec-ordinarydelete' }, OrdinaryGet: { url: 'https://262.ecma-international.org/7.0/#sec-ordinaryget' }, OrdinaryGetOwnProperty: { url: 'https://262.ecma-international.org/7.0/#sec-ordinarygetownproperty' }, OrdinaryGetPrototypeOf: { url: 'https://262.ecma-international.org/7.0/#sec-ordinarygetprototypeof' }, OrdinaryHasInstance: { url: 'https://262.ecma-international.org/7.0/#sec-ordinaryhasinstance' }, OrdinaryHasProperty: { url: 'https://262.ecma-international.org/7.0/#sec-ordinaryhasproperty' }, OrdinaryIsExtensible: { url: 'https://262.ecma-international.org/7.0/#sec-ordinaryisextensible' }, OrdinaryOwnPropertyKeys: { url: 'https://262.ecma-international.org/7.0/#sec-ordinaryownpropertykeys' }, OrdinaryPreventExtensions: { url: 'https://262.ecma-international.org/7.0/#sec-ordinarypreventextensions' }, OrdinarySet: { url: 'https://262.ecma-international.org/7.0/#sec-ordinaryset' }, OrdinarySetPrototypeOf: { url: 'https://262.ecma-international.org/7.0/#sec-ordinarysetprototypeof' }, ParseModule: { url: 'https://262.ecma-international.org/7.0/#sec-parsemodule' }, ParseScript: { url: 'https://262.ecma-international.org/7.0/#sec-parse-script' }, PerformEval: { url: 'https://262.ecma-international.org/7.0/#sec-performeval' }, PerformPromiseAll: { url: 'https://262.ecma-international.org/7.0/#sec-performpromiseall' }, PerformPromiseRace: { url: 'https://262.ecma-international.org/7.0/#sec-performpromiserace' }, PerformPromiseThen: { url: 'https://262.ecma-international.org/7.0/#sec-performpromisethen' }, PrepareForOrdinaryCall: { url: 'https://262.ecma-international.org/7.0/#sec-prepareforordinarycall' }, PrepareForTailCall: { url: 'https://262.ecma-international.org/7.0/#sec-preparefortailcall' }, PromiseReactionJob: { url: 'https://262.ecma-international.org/7.0/#sec-promisereactionjob' }, PromiseResolveThenableJob: { url: 'https://262.ecma-international.org/7.0/#sec-promiseresolvethenablejob' }, ProxyCreate: { url: 'https://262.ecma-international.org/7.0/#sec-proxycreate' }, PutValue: { url: 'https://262.ecma-international.org/7.0/#sec-putvalue' }, QuoteJSONString: { url: 'https://262.ecma-international.org/7.0/#sec-quotejsonstring' }, RegExpAlloc: { url: 'https://262.ecma-international.org/7.0/#sec-regexpalloc' }, RegExpBuiltinExec: { url: 'https://262.ecma-international.org/7.0/#sec-regexpbuiltinexec' }, RegExpCreate: { url: 'https://262.ecma-international.org/7.0/#sec-regexpcreate' }, RegExpExec: { url: 'https://262.ecma-international.org/7.0/#sec-regexpexec' }, RegExpInitialize: { url: 'https://262.ecma-international.org/7.0/#sec-regexpinitialize' }, RejectPromise: { url: 'https://262.ecma-international.org/7.0/#sec-rejectpromise' }, RepeatMatcher: { url: 'https://262.ecma-international.org/7.0/#sec-runtime-semantics-repeatmatcher-abstract-operation' }, RequireObjectCoercible: { url: 'https://262.ecma-international.org/7.0/#sec-requireobjectcoercible' }, ResolveBinding: { url: 'https://262.ecma-international.org/7.0/#sec-resolvebinding' }, ResolveThisBinding: { url: 'https://262.ecma-international.org/7.0/#sec-resolvethisbinding' }, ReturnIfAbrupt: { url: 'https://262.ecma-international.org/7.0/#sec-returnifabrupt' }, SameValue: { url: 'https://262.ecma-international.org/7.0/#sec-samevalue' }, SameValueNonNumber: { url: 'https://262.ecma-international.org/7.0/#sec-samevaluenonnumber' }, SameValueZero: { url: 'https://262.ecma-international.org/7.0/#sec-samevaluezero' }, ScriptEvaluation: { url: 'https://262.ecma-international.org/7.0/#sec-runtime-semantics-scriptevaluation' }, ScriptEvaluationJob: { url: 'https://262.ecma-international.org/7.0/#sec-scriptevaluationjob' }, SecFromTime: { url: 'https://262.ecma-international.org/7.0/#sec-hours-minutes-second-and-milliseconds' }, SerializeJSONArray: { url: 'https://262.ecma-international.org/7.0/#sec-serializejsonarray' }, SerializeJSONObject: { url: 'https://262.ecma-international.org/7.0/#sec-serializejsonobject' }, SerializeJSONProperty: { url: 'https://262.ecma-international.org/7.0/#sec-serializejsonproperty' }, Set: { url: 'https://262.ecma-international.org/7.0/#sec-set-o-p-v-throw' }, SetDefaultGlobalBindings: { url: 'https://262.ecma-international.org/7.0/#sec-setdefaultglobalbindings' }, SetFunctionName: { url: 'https://262.ecma-international.org/7.0/#sec-setfunctionname' }, SetIntegrityLevel: { url: 'https://262.ecma-international.org/7.0/#sec-setintegritylevel' }, SetRealmGlobalObject: { url: 'https://262.ecma-international.org/7.0/#sec-setrealmglobalobject' }, SetValueInBuffer: { url: 'https://262.ecma-international.org/7.0/#sec-setvalueinbuffer' }, SetViewValue: { url: 'https://262.ecma-international.org/7.0/#sec-setviewvalue' }, SortCompare: { url: 'https://262.ecma-international.org/7.0/#sec-sortcompare' }, SpeciesConstructor: { url: 'https://262.ecma-international.org/7.0/#sec-speciesconstructor' }, SplitMatch: { url: 'https://262.ecma-international.org/7.0/#sec-splitmatch' }, 'Strict Equality Comparison': { url: 'https://262.ecma-international.org/7.0/#sec-strict-equality-comparison' }, StringCreate: { url: 'https://262.ecma-international.org/7.0/#sec-stringcreate' }, SymbolDescriptiveString: { url: 'https://262.ecma-international.org/7.0/#sec-symboldescriptivestring' }, TestIntegrityLevel: { url: 'https://262.ecma-international.org/7.0/#sec-testintegritylevel' }, thisBooleanValue: { url: 'https://262.ecma-international.org/7.0/#sec-thisbooleanvalue' }, thisNumberValue: { url: 'https://262.ecma-international.org/7.0/#sec-properties-of-the-number-prototype-object' }, thisStringValue: { url: 'https://262.ecma-international.org/7.0/#sec-properties-of-the-string-prototype-object' }, thisTimeValue: { url: 'https://262.ecma-international.org/7.0/#sec-properties-of-the-date-prototype-object' }, TimeClip: { url: 'https://262.ecma-international.org/7.0/#sec-timeclip' }, TimeFromYear: { url: 'https://262.ecma-international.org/7.0/#sec-year-number' }, TimeWithinDay: { url: 'https://262.ecma-international.org/7.0/#sec-day-number-and-time-within-day' }, ToBoolean: { url: 'https://262.ecma-international.org/7.0/#sec-toboolean' }, ToDateString: { url: 'https://262.ecma-international.org/7.0/#sec-todatestring' }, ToInt16: { url: 'https://262.ecma-international.org/7.0/#sec-toint16' }, ToInt32: { url: 'https://262.ecma-international.org/7.0/#sec-toint32' }, ToInt8: { url: 'https://262.ecma-international.org/7.0/#sec-toint8' }, ToInteger: { url: 'https://262.ecma-international.org/7.0/#sec-tointeger' }, ToLength: { url: 'https://262.ecma-international.org/7.0/#sec-tolength' }, ToNumber: { url: 'https://262.ecma-international.org/7.0/#sec-tonumber' }, ToObject: { url: 'https://262.ecma-international.org/7.0/#sec-toobject' }, TopLevelModuleEvaluationJob: { url: 'https://262.ecma-international.org/7.0/#sec-toplevelmoduleevaluationjob' }, ToPrimitive: { url: 'https://262.ecma-international.org/7.0/#sec-toprimitive' }, ToPropertyDescriptor: { url: 'https://262.ecma-international.org/7.0/#sec-topropertydescriptor' }, ToPropertyKey: { url: 'https://262.ecma-international.org/7.0/#sec-topropertykey' }, ToString: { url: 'https://262.ecma-international.org/7.0/#sec-tostring' }, 'ToString Applied to the Number Type': { url: 'https://262.ecma-international.org/7.0/#sec-tostring-applied-to-the-number-type' }, ToUint16: { url: 'https://262.ecma-international.org/7.0/#sec-touint16' }, ToUint32: { url: 'https://262.ecma-international.org/7.0/#sec-touint32' }, ToUint8: { url: 'https://262.ecma-international.org/7.0/#sec-touint8' }, ToUint8Clamp: { url: 'https://262.ecma-international.org/7.0/#sec-touint8clamp' }, TriggerPromiseReactions: { url: 'https://262.ecma-international.org/7.0/#sec-triggerpromisereactions' }, Type: { url: 'https://262.ecma-international.org/7.0/#sec-ecmascript-data-types-and-values' }, TypedArrayCreate: { url: 'https://262.ecma-international.org/7.0/#typedarray-create' }, TypedArraySpeciesCreate: { url: 'https://262.ecma-international.org/7.0/#typedarray-species-create' }, UpdateEmpty: { url: 'https://262.ecma-international.org/7.0/#sec-updateempty' }, UTC: { url: 'https://262.ecma-international.org/7.0/#sec-utc-t' }, UTF16Decode: { url: 'https://262.ecma-international.org/7.0/#sec-utf16decode' }, UTF16Encoding: { url: 'https://262.ecma-international.org/7.0/#sec-utf16encoding' }, ValidateAndApplyPropertyDescriptor: { url: 'https://262.ecma-international.org/7.0/#sec-validateandapplypropertydescriptor' }, ValidateTypedArray: { url: 'https://262.ecma-international.org/7.0/#sec-validatetypedarray' }, WeekDay: { url: 'https://262.ecma-international.org/7.0/#sec-week-day' }, YearFromTime: { url: 'https://262.ecma-international.org/7.0/#sec-year-number' } }; es-abstract-1.20.4/operations/2017.js000066400000000000000000000750001431761430200171230ustar00rootroot00000000000000'use strict'; module.exports = { IsPropertyDescriptor: 'https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type', // not actually an abstract op abs: { url: 'https://262.ecma-international.org/8.0/#eqn-abs' }, 'Abstract Equality Comparison': { url: 'https://262.ecma-international.org/8.0/#sec-abstract-equality-comparison' }, 'Abstract Relational Comparison': { url: 'https://262.ecma-international.org/8.0/#sec-abstract-relational-comparison' }, AddRestrictedFunctionProperties: { url: 'https://262.ecma-international.org/8.0/#sec-addrestrictedfunctionproperties' }, AddWaiter: { url: 'https://262.ecma-international.org/8.0/#sec-addwaiter' }, AdvanceStringIndex: { url: 'https://262.ecma-international.org/8.0/#sec-advancestringindex' }, 'agent-order': { url: 'https://262.ecma-international.org/8.0/#sec-agent-order' }, AgentCanSuspend: { url: 'https://262.ecma-international.org/8.0/#sec-agentcansuspend' }, AgentSignifier: { url: 'https://262.ecma-international.org/8.0/#sec-agentsignifier' }, AllocateArrayBuffer: { url: 'https://262.ecma-international.org/8.0/#sec-allocatearraybuffer' }, AllocateSharedArrayBuffer: { url: 'https://262.ecma-international.org/8.0/#sec-allocatesharedarraybuffer' }, AllocateTypedArray: { url: 'https://262.ecma-international.org/8.0/#sec-allocatetypedarray' }, AllocateTypedArrayBuffer: { url: 'https://262.ecma-international.org/8.0/#sec-allocatetypedarraybuffer' }, ArrayCreate: { url: 'https://262.ecma-international.org/8.0/#sec-arraycreate' }, ArraySetLength: { url: 'https://262.ecma-international.org/8.0/#sec-arraysetlength' }, ArraySpeciesCreate: { url: 'https://262.ecma-international.org/8.0/#sec-arrayspeciescreate' }, AsyncFunctionAwait: { url: 'https://262.ecma-international.org/8.0/#sec-async-functions-abstract-operations-async-function-await' }, AsyncFunctionCreate: { url: 'https://262.ecma-international.org/8.0/#sec-async-functions-abstract-operations-async-function-create' }, AsyncFunctionStart: { url: 'https://262.ecma-international.org/8.0/#sec-async-functions-abstract-operations-async-function-start' }, AtomicLoad: { url: 'https://262.ecma-international.org/8.0/#sec-atomicload' }, AtomicReadModifyWrite: { url: 'https://262.ecma-international.org/8.0/#sec-atomicreadmodifywrite' }, BlockDeclarationInstantiation: { url: 'https://262.ecma-international.org/8.0/#sec-blockdeclarationinstantiation' }, BoundFunctionCreate: { url: 'https://262.ecma-international.org/8.0/#sec-boundfunctioncreate' }, Call: { url: 'https://262.ecma-international.org/8.0/#sec-call' }, Canonicalize: { url: 'https://262.ecma-international.org/8.0/#sec-runtime-semantics-canonicalize-ch' }, CanonicalNumericIndexString: { url: 'https://262.ecma-international.org/8.0/#sec-canonicalnumericindexstring' }, CharacterRange: { url: 'https://262.ecma-international.org/8.0/#sec-runtime-semantics-characterrange-abstract-operation' }, CharacterRangeOrUnion: { url: 'https://262.ecma-international.org/8.0/#sec-runtime-semantics-characterrangeorunion-abstract-operation' }, CharacterSetMatcher: { url: 'https://262.ecma-international.org/8.0/#sec-runtime-semantics-charactersetmatcher-abstract-operation' }, CloneArrayBuffer: { url: 'https://262.ecma-international.org/8.0/#sec-clonearraybuffer' }, CompletePropertyDescriptor: { url: 'https://262.ecma-international.org/8.0/#sec-completepropertydescriptor' }, Completion: { url: 'https://262.ecma-international.org/8.0/#sec-completion-record-specification-type' }, ComposeWriteEventBytes: { url: 'https://262.ecma-international.org/8.0/#sec-composewriteeventbytes' }, Construct: { url: 'https://262.ecma-international.org/8.0/#sec-construct' }, CopyDataBlockBytes: { url: 'https://262.ecma-international.org/8.0/#sec-copydatablockbytes' }, CreateArrayFromList: { url: 'https://262.ecma-international.org/8.0/#sec-createarrayfromlist' }, CreateArrayIterator: { url: 'https://262.ecma-international.org/8.0/#sec-createarrayiterator' }, CreateBuiltinFunction: { url: 'https://262.ecma-international.org/8.0/#sec-createbuiltinfunction' }, CreateByteDataBlock: { url: 'https://262.ecma-international.org/8.0/#sec-createbytedatablock' }, CreateDataProperty: { url: 'https://262.ecma-international.org/8.0/#sec-createdataproperty' }, CreateDataPropertyOrThrow: { url: 'https://262.ecma-international.org/8.0/#sec-createdatapropertyorthrow' }, CreateDynamicFunction: { url: 'https://262.ecma-international.org/8.0/#sec-createdynamicfunction' }, CreateHTML: { url: 'https://262.ecma-international.org/8.0/#sec-createhtml' }, CreateIntrinsics: { url: 'https://262.ecma-international.org/8.0/#sec-createintrinsics' }, CreateIterResultObject: { url: 'https://262.ecma-international.org/8.0/#sec-createiterresultobject' }, CreateListFromArrayLike: { url: 'https://262.ecma-international.org/8.0/#sec-createlistfromarraylike' }, CreateListIterator: { url: 'https://262.ecma-international.org/8.0/#sec-createlistiterator' }, CreateMapIterator: { url: 'https://262.ecma-international.org/8.0/#sec-createmapiterator' }, CreateMappedArgumentsObject: { url: 'https://262.ecma-international.org/8.0/#sec-createmappedargumentsobject' }, CreateMethodProperty: { url: 'https://262.ecma-international.org/8.0/#sec-createmethodproperty' }, CreatePerIterationEnvironment: { url: 'https://262.ecma-international.org/8.0/#sec-createperiterationenvironment' }, CreateRealm: { url: 'https://262.ecma-international.org/8.0/#sec-createrealm' }, CreateResolvingFunctions: { url: 'https://262.ecma-international.org/8.0/#sec-createresolvingfunctions' }, CreateSetIterator: { url: 'https://262.ecma-international.org/8.0/#sec-createsetiterator' }, CreateSharedByteDataBlock: { url: 'https://262.ecma-international.org/8.0/#sec-createsharedbytedatablock' }, CreateStringIterator: { url: 'https://262.ecma-international.org/8.0/#sec-createstringiterator' }, CreateUnmappedArgumentsObject: { url: 'https://262.ecma-international.org/8.0/#sec-createunmappedargumentsobject' }, DateFromTime: { url: 'https://262.ecma-international.org/8.0/#sec-date-number' }, Day: { url: 'https://262.ecma-international.org/8.0/#eqn-Day' }, DayFromYear: { url: 'https://262.ecma-international.org/8.0/#eqn-DaysFromYear' }, DaylightSavingTA: { url: 'https://262.ecma-international.org/8.0/#sec-daylight-saving-time-adjustment' }, DaysInYear: { url: 'https://262.ecma-international.org/8.0/#eqn-DaysInYear' }, DayWithinYear: { url: 'https://262.ecma-international.org/8.0/#eqn-DayWithinYear' }, Decode: { url: 'https://262.ecma-international.org/8.0/#sec-decode' }, DefinePropertyOrThrow: { url: 'https://262.ecma-international.org/8.0/#sec-definepropertyorthrow' }, DeletePropertyOrThrow: { url: 'https://262.ecma-international.org/8.0/#sec-deletepropertyorthrow' }, DetachArrayBuffer: { url: 'https://262.ecma-international.org/8.0/#sec-detacharraybuffer' }, Encode: { url: 'https://262.ecma-international.org/8.0/#sec-encode' }, EnqueueJob: { url: 'https://262.ecma-international.org/8.0/#sec-enqueuejob' }, EnterCriticalSection: { url: 'https://262.ecma-international.org/8.0/#sec-entercriticalsection' }, EnumerableOwnProperties: { url: 'https://262.ecma-international.org/8.0/#sec-enumerableownproperties' }, EnumerateObjectProperties: { url: 'https://262.ecma-international.org/8.0/#sec-enumerate-object-properties' }, EscapeRegExpPattern: { url: 'https://262.ecma-international.org/8.0/#sec-escaperegexppattern' }, EvalDeclarationInstantiation: { url: 'https://262.ecma-international.org/8.0/#sec-evaldeclarationinstantiation' }, EvaluateCall: { url: 'https://262.ecma-international.org/8.0/#sec-evaluatecall' }, EvaluateDirectCall: { url: 'https://262.ecma-international.org/8.0/#sec-evaluatedirectcall' }, EvaluateNew: { url: 'https://262.ecma-international.org/8.0/#sec-evaluatenew' }, EventSet: { url: 'https://262.ecma-international.org/8.0/#sec-event-set' }, floor: { url: 'https://262.ecma-international.org/8.0/#eqn-floor' }, ForBodyEvaluation: { url: 'https://262.ecma-international.org/8.0/#sec-forbodyevaluation' }, 'ForIn/OfBodyEvaluation': { url: 'https://262.ecma-international.org/8.0/#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset' }, 'ForIn/OfHeadEvaluation': { url: 'https://262.ecma-international.org/8.0/#sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind' }, FromPropertyDescriptor: { url: 'https://262.ecma-international.org/8.0/#sec-frompropertydescriptor' }, FulfillPromise: { url: 'https://262.ecma-international.org/8.0/#sec-fulfillpromise' }, FunctionAllocate: { url: 'https://262.ecma-international.org/8.0/#sec-functionallocate' }, FunctionCreate: { url: 'https://262.ecma-international.org/8.0/#sec-functioncreate' }, FunctionDeclarationInstantiation: { url: 'https://262.ecma-international.org/8.0/#sec-functiondeclarationinstantiation' }, FunctionInitialize: { url: 'https://262.ecma-international.org/8.0/#sec-functioninitialize' }, GeneratorFunctionCreate: { url: 'https://262.ecma-international.org/8.0/#sec-generatorfunctioncreate' }, GeneratorResume: { url: 'https://262.ecma-international.org/8.0/#sec-generatorresume' }, GeneratorResumeAbrupt: { url: 'https://262.ecma-international.org/8.0/#sec-generatorresumeabrupt' }, GeneratorStart: { url: 'https://262.ecma-international.org/8.0/#sec-generatorstart' }, GeneratorValidate: { url: 'https://262.ecma-international.org/8.0/#sec-generatorvalidate' }, GeneratorYield: { url: 'https://262.ecma-international.org/8.0/#sec-generatoryield' }, Get: { url: 'https://262.ecma-international.org/8.0/#sec-get-o-p' }, GetActiveScriptOrModule: { url: 'https://262.ecma-international.org/8.0/#sec-getactivescriptormodule' }, GetBase: { url: 'https://262.ecma-international.org/8.0/#ao-getbase' }, GetFunctionRealm: { url: 'https://262.ecma-international.org/8.0/#sec-getfunctionrealm' }, GetGlobalObject: { url: 'https://262.ecma-international.org/8.0/#sec-getglobalobject' }, GetIdentifierReference: { url: 'https://262.ecma-international.org/8.0/#sec-getidentifierreference' }, GetIterator: { url: 'https://262.ecma-international.org/8.0/#sec-getiterator' }, GetMethod: { url: 'https://262.ecma-international.org/8.0/#sec-getmethod' }, GetModifySetValueInBuffer: { url: 'https://262.ecma-international.org/8.0/#sec-getmodifysetvalueinbuffer' }, GetModuleNamespace: { url: 'https://262.ecma-international.org/8.0/#sec-getmodulenamespace' }, GetNewTarget: { url: 'https://262.ecma-international.org/8.0/#sec-getnewtarget' }, GetOwnPropertyKeys: { url: 'https://262.ecma-international.org/8.0/#sec-getownpropertykeys' }, GetPrototypeFromConstructor: { url: 'https://262.ecma-international.org/8.0/#sec-getprototypefromconstructor' }, GetReferencedName: { url: 'https://262.ecma-international.org/8.0/#ao-getreferencedname' }, GetSubstitution: { url: 'https://262.ecma-international.org/8.0/#sec-getsubstitution' }, GetSuperConstructor: { url: 'https://262.ecma-international.org/8.0/#sec-getsuperconstructor' }, GetTemplateObject: { url: 'https://262.ecma-international.org/8.0/#sec-gettemplateobject' }, GetThisEnvironment: { url: 'https://262.ecma-international.org/8.0/#sec-getthisenvironment' }, GetThisValue: { url: 'https://262.ecma-international.org/8.0/#sec-getthisvalue' }, GetV: { url: 'https://262.ecma-international.org/8.0/#sec-getv' }, GetValue: { url: 'https://262.ecma-international.org/8.0/#sec-getvalue' }, GetValueFromBuffer: { url: 'https://262.ecma-international.org/8.0/#sec-getvaluefrombuffer' }, GetViewValue: { url: 'https://262.ecma-international.org/8.0/#sec-getviewvalue' }, GetWaiterList: { url: 'https://262.ecma-international.org/8.0/#sec-getwaiterlist' }, GlobalDeclarationInstantiation: { url: 'https://262.ecma-international.org/8.0/#sec-globaldeclarationinstantiation' }, 'happens-before': { url: 'https://262.ecma-international.org/8.0/#sec-happens-before' }, HasOwnProperty: { url: 'https://262.ecma-international.org/8.0/#sec-hasownproperty' }, HasPrimitiveBase: { url: 'https://262.ecma-international.org/8.0/#ao-hasprimitivebase' }, HasProperty: { url: 'https://262.ecma-international.org/8.0/#sec-hasproperty' }, 'host-synchronizes-with': { url: 'https://262.ecma-international.org/8.0/#sec-host-synchronizes-with' }, HostEnsureCanCompileStrings: { url: 'https://262.ecma-international.org/8.0/#sec-hostensurecancompilestrings' }, HostEventSet: { url: 'https://262.ecma-international.org/8.0/#sec-hosteventset' }, HostPromiseRejectionTracker: { url: 'https://262.ecma-international.org/8.0/#sec-host-promise-rejection-tracker' }, HostReportErrors: { url: 'https://262.ecma-international.org/8.0/#sec-host-report-errors' }, HostResolveImportedModule: { url: 'https://262.ecma-international.org/8.0/#sec-hostresolveimportedmodule' }, HourFromTime: { url: 'https://262.ecma-international.org/8.0/#eqn-HourFromTime' }, IfAbruptRejectPromise: { url: 'https://262.ecma-international.org/8.0/#sec-ifabruptrejectpromise' }, ImportedLocalNames: { url: 'https://262.ecma-international.org/8.0/#sec-importedlocalnames' }, InitializeBoundName: { url: 'https://262.ecma-international.org/8.0/#sec-initializeboundname' }, InitializeHostDefinedRealm: { url: 'https://262.ecma-international.org/8.0/#sec-initializehostdefinedrealm' }, InitializeReferencedBinding: { url: 'https://262.ecma-international.org/8.0/#sec-initializereferencedbinding' }, InLeapYear: { url: 'https://262.ecma-international.org/8.0/#eqn-InLeapYear' }, InstanceofOperator: { url: 'https://262.ecma-international.org/8.0/#sec-instanceofoperator' }, IntegerIndexedElementGet: { url: 'https://262.ecma-international.org/8.0/#sec-integerindexedelementget' }, IntegerIndexedElementSet: { url: 'https://262.ecma-international.org/8.0/#sec-integerindexedelementset' }, IntegerIndexedObjectCreate: { url: 'https://262.ecma-international.org/8.0/#sec-integerindexedobjectcreate' }, InternalizeJSONProperty: { url: 'https://262.ecma-international.org/8.0/#sec-internalizejsonproperty' }, Invoke: { url: 'https://262.ecma-international.org/8.0/#sec-invoke' }, IsAccessorDescriptor: { url: 'https://262.ecma-international.org/8.0/#sec-isaccessordescriptor' }, IsAnonymousFunctionDefinition: { url: 'https://262.ecma-international.org/8.0/#sec-isanonymousfunctiondefinition' }, IsArray: { url: 'https://262.ecma-international.org/8.0/#sec-isarray' }, IsCallable: { url: 'https://262.ecma-international.org/8.0/#sec-iscallable' }, IsCompatiblePropertyDescriptor: { url: 'https://262.ecma-international.org/8.0/#sec-iscompatiblepropertydescriptor' }, IsConcatSpreadable: { url: 'https://262.ecma-international.org/8.0/#sec-isconcatspreadable' }, IsConstructor: { url: 'https://262.ecma-international.org/8.0/#sec-isconstructor' }, IsDataDescriptor: { url: 'https://262.ecma-international.org/8.0/#sec-isdatadescriptor' }, IsDetachedBuffer: { url: 'https://262.ecma-international.org/8.0/#sec-isdetachedbuffer' }, IsExtensible: { url: 'https://262.ecma-international.org/8.0/#sec-isextensible-o' }, IsGenericDescriptor: { url: 'https://262.ecma-international.org/8.0/#sec-isgenericdescriptor' }, IsInTailPosition: { url: 'https://262.ecma-international.org/8.0/#sec-isintailposition' }, IsInteger: { url: 'https://262.ecma-international.org/8.0/#sec-isinteger' }, IsLabelledFunction: { url: 'https://262.ecma-international.org/8.0/#sec-islabelledfunction' }, IsPromise: { url: 'https://262.ecma-international.org/8.0/#sec-ispromise' }, IsPropertyKey: { url: 'https://262.ecma-international.org/8.0/#sec-ispropertykey' }, IsPropertyReference: { url: 'https://262.ecma-international.org/8.0/#ao-ispropertyreference' }, IsRegExp: { url: 'https://262.ecma-international.org/8.0/#sec-isregexp' }, IsSharedArrayBuffer: { url: 'https://262.ecma-international.org/8.0/#sec-issharedarraybuffer' }, IsStrictReference: { url: 'https://262.ecma-international.org/8.0/#ao-isstrictreference' }, IsSuperReference: { url: 'https://262.ecma-international.org/8.0/#ao-issuperreference' }, IsUnresolvableReference: { url: 'https://262.ecma-international.org/8.0/#ao-isunresolvablereference' }, IsWordChar: { url: 'https://262.ecma-international.org/8.0/#sec-runtime-semantics-iswordchar-abstract-operation' }, IterableToList: { url: 'https://262.ecma-international.org/8.0/#sec-iterabletolist' }, IteratorClose: { url: 'https://262.ecma-international.org/8.0/#sec-iteratorclose' }, IteratorComplete: { url: 'https://262.ecma-international.org/8.0/#sec-iteratorcomplete' }, IteratorNext: { url: 'https://262.ecma-international.org/8.0/#sec-iteratornext' }, IteratorStep: { url: 'https://262.ecma-international.org/8.0/#sec-iteratorstep' }, IteratorValue: { url: 'https://262.ecma-international.org/8.0/#sec-iteratorvalue' }, LeaveCriticalSection: { url: 'https://262.ecma-international.org/8.0/#sec-leavecriticalsection' }, LocalTime: { url: 'https://262.ecma-international.org/8.0/#sec-localtime' }, LoopContinues: { url: 'https://262.ecma-international.org/8.0/#sec-loopcontinues' }, MakeArgGetter: { url: 'https://262.ecma-international.org/8.0/#sec-makearggetter' }, MakeArgSetter: { url: 'https://262.ecma-international.org/8.0/#sec-makeargsetter' }, MakeClassConstructor: { url: 'https://262.ecma-international.org/8.0/#sec-makeclassconstructor' }, MakeConstructor: { url: 'https://262.ecma-international.org/8.0/#sec-makeconstructor' }, MakeDate: { url: 'https://262.ecma-international.org/8.0/#sec-makedate' }, MakeDay: { url: 'https://262.ecma-international.org/8.0/#sec-makeday' }, MakeMethod: { url: 'https://262.ecma-international.org/8.0/#sec-makemethod' }, MakeSuperPropertyReference: { url: 'https://262.ecma-international.org/8.0/#sec-makesuperpropertyreference' }, MakeTime: { url: 'https://262.ecma-international.org/8.0/#sec-maketime' }, max: { url: 'https://262.ecma-international.org/8.0/#eqn-max' }, 'memory-order': { url: 'https://262.ecma-international.org/8.0/#sec-memory-order' }, min: { url: 'https://262.ecma-international.org/8.0/#eqn-min' }, MinFromTime: { url: 'https://262.ecma-international.org/8.0/#eqn-MinFromTime' }, ModuleNamespaceCreate: { url: 'https://262.ecma-international.org/8.0/#sec-modulenamespacecreate' }, modulo: { url: 'https://262.ecma-international.org/8.0/#eqn-modulo' }, MonthFromTime: { url: 'https://262.ecma-international.org/8.0/#eqn-MonthFromTime' }, msFromTime: { url: 'https://262.ecma-international.org/8.0/#eqn-msFromTime' }, NewDeclarativeEnvironment: { url: 'https://262.ecma-international.org/8.0/#sec-newdeclarativeenvironment' }, NewFunctionEnvironment: { url: 'https://262.ecma-international.org/8.0/#sec-newfunctionenvironment' }, NewGlobalEnvironment: { url: 'https://262.ecma-international.org/8.0/#sec-newglobalenvironment' }, NewModuleEnvironment: { url: 'https://262.ecma-international.org/8.0/#sec-newmoduleenvironment' }, NewObjectEnvironment: { url: 'https://262.ecma-international.org/8.0/#sec-newobjectenvironment' }, NewPromiseCapability: { url: 'https://262.ecma-international.org/8.0/#sec-newpromisecapability' }, NormalCompletion: { url: 'https://262.ecma-international.org/8.0/#sec-normalcompletion' }, NumberToRawBytes: { url: 'https://262.ecma-international.org/8.0/#sec-numbertorawbytes' }, ObjectCreate: { url: 'https://262.ecma-international.org/8.0/#sec-objectcreate' }, ObjectDefineProperties: { url: 'https://262.ecma-international.org/8.0/#sec-objectdefineproperties' }, OrdinaryCallBindThis: { url: 'https://262.ecma-international.org/8.0/#sec-ordinarycallbindthis' }, OrdinaryCallEvaluateBody: { url: 'https://262.ecma-international.org/8.0/#sec-ordinarycallevaluatebody' }, OrdinaryCreateFromConstructor: { url: 'https://262.ecma-international.org/8.0/#sec-ordinarycreatefromconstructor' }, OrdinaryDefineOwnProperty: { url: 'https://262.ecma-international.org/8.0/#sec-ordinarydefineownproperty' }, OrdinaryDelete: { url: 'https://262.ecma-international.org/8.0/#sec-ordinarydelete' }, OrdinaryGet: { url: 'https://262.ecma-international.org/8.0/#sec-ordinaryget' }, OrdinaryGetOwnProperty: { url: 'https://262.ecma-international.org/8.0/#sec-ordinarygetownproperty' }, OrdinaryGetPrototypeOf: { url: 'https://262.ecma-international.org/8.0/#sec-ordinarygetprototypeof' }, OrdinaryHasInstance: { url: 'https://262.ecma-international.org/8.0/#sec-ordinaryhasinstance' }, OrdinaryHasProperty: { url: 'https://262.ecma-international.org/8.0/#sec-ordinaryhasproperty' }, OrdinaryIsExtensible: { url: 'https://262.ecma-international.org/8.0/#sec-ordinaryisextensible' }, OrdinaryOwnPropertyKeys: { url: 'https://262.ecma-international.org/8.0/#sec-ordinaryownpropertykeys' }, OrdinaryPreventExtensions: { url: 'https://262.ecma-international.org/8.0/#sec-ordinarypreventextensions' }, OrdinarySet: { url: 'https://262.ecma-international.org/8.0/#sec-ordinaryset' }, OrdinarySetPrototypeOf: { url: 'https://262.ecma-international.org/8.0/#sec-ordinarysetprototypeof' }, OrdinaryToPrimitive: { url: 'https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive' }, ParseModule: { url: 'https://262.ecma-international.org/8.0/#sec-parsemodule' }, ParseScript: { url: 'https://262.ecma-international.org/8.0/#sec-parse-script' }, PerformEval: { url: 'https://262.ecma-international.org/8.0/#sec-performeval' }, PerformPromiseAll: { url: 'https://262.ecma-international.org/8.0/#sec-performpromiseall' }, PerformPromiseRace: { url: 'https://262.ecma-international.org/8.0/#sec-performpromiserace' }, PerformPromiseThen: { url: 'https://262.ecma-international.org/8.0/#sec-performpromisethen' }, PrepareForOrdinaryCall: { url: 'https://262.ecma-international.org/8.0/#sec-prepareforordinarycall' }, PrepareForTailCall: { url: 'https://262.ecma-international.org/8.0/#sec-preparefortailcall' }, PromiseReactionJob: { url: 'https://262.ecma-international.org/8.0/#sec-promisereactionjob' }, PromiseResolveThenableJob: { url: 'https://262.ecma-international.org/8.0/#sec-promiseresolvethenablejob' }, ProxyCreate: { url: 'https://262.ecma-international.org/8.0/#sec-proxycreate' }, PutValue: { url: 'https://262.ecma-international.org/8.0/#sec-putvalue' }, QuoteJSONString: { url: 'https://262.ecma-international.org/8.0/#sec-quotejsonstring' }, RawBytesToNumber: { url: 'https://262.ecma-international.org/8.0/#sec-rawbytestonumber' }, 'reads-bytes-from': { url: 'https://262.ecma-international.org/8.0/#sec-reads-bytes-from' }, 'reads-from': { url: 'https://262.ecma-international.org/8.0/#sec-reads-from' }, RegExpAlloc: { url: 'https://262.ecma-international.org/8.0/#sec-regexpalloc' }, RegExpBuiltinExec: { url: 'https://262.ecma-international.org/8.0/#sec-regexpbuiltinexec' }, RegExpCreate: { url: 'https://262.ecma-international.org/8.0/#sec-regexpcreate' }, RegExpExec: { url: 'https://262.ecma-international.org/8.0/#sec-regexpexec' }, RegExpInitialize: { url: 'https://262.ecma-international.org/8.0/#sec-regexpinitialize' }, RejectPromise: { url: 'https://262.ecma-international.org/8.0/#sec-rejectpromise' }, RemoveWaiter: { url: 'https://262.ecma-international.org/8.0/#sec-removewaiter' }, RemoveWaiters: { url: 'https://262.ecma-international.org/8.0/#sec-removewaiters' }, RepeatMatcher: { url: 'https://262.ecma-international.org/8.0/#sec-runtime-semantics-repeatmatcher-abstract-operation' }, RequireObjectCoercible: { url: 'https://262.ecma-international.org/8.0/#sec-requireobjectcoercible' }, ResolveBinding: { url: 'https://262.ecma-international.org/8.0/#sec-resolvebinding' }, ResolveThisBinding: { url: 'https://262.ecma-international.org/8.0/#sec-resolvethisbinding' }, ReturnIfAbrupt: { url: 'https://262.ecma-international.org/8.0/#sec-returnifabrupt' }, RunJobs: { url: 'https://262.ecma-international.org/8.0/#sec-runjobs' }, SameValue: { url: 'https://262.ecma-international.org/8.0/#sec-samevalue' }, SameValueNonNumber: { url: 'https://262.ecma-international.org/8.0/#sec-samevaluenonnumber' }, SameValueZero: { url: 'https://262.ecma-international.org/8.0/#sec-samevaluezero' }, ScriptEvaluation: { url: 'https://262.ecma-international.org/8.0/#sec-runtime-semantics-scriptevaluation' }, ScriptEvaluationJob: { url: 'https://262.ecma-international.org/8.0/#sec-scriptevaluationjob' }, SecFromTime: { url: 'https://262.ecma-international.org/8.0/#eqn-SecFromTime' }, SerializeJSONArray: { url: 'https://262.ecma-international.org/8.0/#sec-serializejsonarray' }, SerializeJSONObject: { url: 'https://262.ecma-international.org/8.0/#sec-serializejsonobject' }, SerializeJSONProperty: { url: 'https://262.ecma-international.org/8.0/#sec-serializejsonproperty' }, Set: { url: 'https://262.ecma-international.org/8.0/#sec-set-o-p-v-throw' }, SetDefaultGlobalBindings: { url: 'https://262.ecma-international.org/8.0/#sec-setdefaultglobalbindings' }, SetFunctionName: { url: 'https://262.ecma-international.org/8.0/#sec-setfunctionname' }, SetImmutablePrototype: { url: 'https://262.ecma-international.org/8.0/#sec-set-immutable-prototype' }, SetIntegrityLevel: { url: 'https://262.ecma-international.org/8.0/#sec-setintegritylevel' }, SetRealmGlobalObject: { url: 'https://262.ecma-international.org/8.0/#sec-setrealmglobalobject' }, SetValueInBuffer: { url: 'https://262.ecma-international.org/8.0/#sec-setvalueinbuffer' }, SetViewValue: { url: 'https://262.ecma-international.org/8.0/#sec-setviewvalue' }, SharedDataBlockEventSet: { url: 'https://262.ecma-international.org/8.0/#sec-sharedatablockeventset' }, SortCompare: { url: 'https://262.ecma-international.org/8.0/#sec-sortcompare' }, SpeciesConstructor: { url: 'https://262.ecma-international.org/8.0/#sec-speciesconstructor' }, SplitMatch: { url: 'https://262.ecma-international.org/8.0/#sec-splitmatch' }, 'Strict Equality Comparison': { url: 'https://262.ecma-international.org/8.0/#sec-strict-equality-comparison' }, StringCreate: { url: 'https://262.ecma-international.org/8.0/#sec-stringcreate' }, StringGetOwnProperty: { url: 'https://262.ecma-international.org/8.0/#sec-stringgetownproperty' }, Suspend: { url: 'https://262.ecma-international.org/8.0/#sec-suspend' }, SymbolDescriptiveString: { url: 'https://262.ecma-international.org/8.0/#sec-symboldescriptivestring' }, 'synchronizes-with': { url: 'https://262.ecma-international.org/8.0/#sec-synchronizes-with' }, TestIntegrityLevel: { url: 'https://262.ecma-international.org/8.0/#sec-testintegritylevel' }, thisBooleanValue: { url: 'https://262.ecma-international.org/8.0/#sec-thisbooleanvalue' }, thisNumberValue: { url: 'https://262.ecma-international.org/8.0/#sec-thisnumbervalue' }, thisStringValue: { url: 'https://262.ecma-international.org/8.0/#sec-thisstringvalue' }, thisTimeValue: { url: 'https://262.ecma-international.org/8.0/#sec-thistimevalue' }, TimeClip: { url: 'https://262.ecma-international.org/8.0/#sec-timeclip' }, TimeFromYear: { url: 'https://262.ecma-international.org/8.0/#eqn-TimeFromYear' }, TimeWithinDay: { url: 'https://262.ecma-international.org/8.0/#eqn-TimeWithinDay' }, ToBoolean: { url: 'https://262.ecma-international.org/8.0/#sec-toboolean' }, ToDateString: { url: 'https://262.ecma-international.org/8.0/#sec-todatestring' }, ToIndex: { url: 'https://262.ecma-international.org/8.0/#sec-toindex' }, ToInt16: { url: 'https://262.ecma-international.org/8.0/#sec-toint16' }, ToInt32: { url: 'https://262.ecma-international.org/8.0/#sec-toint32' }, ToInt8: { url: 'https://262.ecma-international.org/8.0/#sec-toint8' }, ToInteger: { url: 'https://262.ecma-international.org/8.0/#sec-tointeger' }, ToLength: { url: 'https://262.ecma-international.org/8.0/#sec-tolength' }, ToNumber: { url: 'https://262.ecma-international.org/8.0/#sec-tonumber' }, ToObject: { url: 'https://262.ecma-international.org/8.0/#sec-toobject' }, TopLevelModuleEvaluationJob: { url: 'https://262.ecma-international.org/8.0/#sec-toplevelmoduleevaluationjob' }, ToPrimitive: { url: 'https://262.ecma-international.org/8.0/#sec-toprimitive' }, ToPropertyDescriptor: { url: 'https://262.ecma-international.org/8.0/#sec-topropertydescriptor' }, ToPropertyKey: { url: 'https://262.ecma-international.org/8.0/#sec-topropertykey' }, ToString: { url: 'https://262.ecma-international.org/8.0/#sec-tostring' }, 'ToString Applied to the Number Type': { url: 'https://262.ecma-international.org/8.0/#sec-tostring-applied-to-the-number-type' }, ToUint16: { url: 'https://262.ecma-international.org/8.0/#sec-touint16' }, ToUint32: { url: 'https://262.ecma-international.org/8.0/#sec-touint32' }, ToUint8: { url: 'https://262.ecma-international.org/8.0/#sec-touint8' }, ToUint8Clamp: { url: 'https://262.ecma-international.org/8.0/#sec-touint8clamp' }, TriggerPromiseReactions: { url: 'https://262.ecma-international.org/8.0/#sec-triggerpromisereactions' }, Type: { url: 'https://262.ecma-international.org/8.0/#sec-ecmascript-data-types-and-values' }, TypedArrayCreate: { url: 'https://262.ecma-international.org/8.0/#typedarray-create' }, TypedArraySpeciesCreate: { url: 'https://262.ecma-international.org/8.0/#typedarray-species-create' }, UpdateEmpty: { url: 'https://262.ecma-international.org/8.0/#sec-updateempty' }, UTC: { url: 'https://262.ecma-international.org/8.0/#sec-utc-t' }, UTF16Decode: { url: 'https://262.ecma-international.org/8.0/#sec-utf16decode' }, UTF16Encoding: { url: 'https://262.ecma-international.org/8.0/#sec-utf16encoding' }, ValidateAndApplyPropertyDescriptor: { url: 'https://262.ecma-international.org/8.0/#sec-validateandapplypropertydescriptor' }, ValidateAtomicAccess: { url: 'https://262.ecma-international.org/8.0/#sec-validateatomicaccess' }, ValidateSharedIntegerTypedArray: { url: 'https://262.ecma-international.org/8.0/#sec-validatesharedintegertypedarray' }, ValidateTypedArray: { url: 'https://262.ecma-international.org/8.0/#sec-validatetypedarray' }, ValueOfReadEvent: { url: 'https://262.ecma-international.org/8.0/#sec-valueofreadevent' }, WakeWaiter: { url: 'https://262.ecma-international.org/8.0/#sec-wakewaiter' }, WeekDay: { url: 'https://262.ecma-international.org/8.0/#sec-week-day' }, WordCharacters: { url: 'https://262.ecma-international.org/8.0/#sec-runtime-semantics-wordcharacters-abstract-operation' }, YearFromTime: { url: 'https://262.ecma-international.org/8.0/#eqn-YearFromTime' } }; es-abstract-1.20.4/operations/2018.js000066400000000000000000001020401431761430200171170ustar00rootroot00000000000000'use strict'; module.exports = { abs: { url: 'https://262.ecma-international.org/9.0/#eqn-abs' }, 'Abstract Equality Comparison': { url: 'https://262.ecma-international.org/9.0/#sec-abstract-equality-comparison' }, 'Abstract Relational Comparison': { url: 'https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison' }, AddRestrictedFunctionProperties: { url: 'https://262.ecma-international.org/9.0/#sec-addrestrictedfunctionproperties' }, AddWaiter: { url: 'https://262.ecma-international.org/9.0/#sec-addwaiter' }, AdvanceStringIndex: { url: 'https://262.ecma-international.org/9.0/#sec-advancestringindex' }, 'agent-order': { url: 'https://262.ecma-international.org/9.0/#sec-agent-order' }, AgentCanSuspend: { url: 'https://262.ecma-international.org/9.0/#sec-agentcansuspend' }, AgentSignifier: { url: 'https://262.ecma-international.org/9.0/#sec-agentsignifier' }, AllocateArrayBuffer: { url: 'https://262.ecma-international.org/9.0/#sec-allocatearraybuffer' }, AllocateSharedArrayBuffer: { url: 'https://262.ecma-international.org/9.0/#sec-allocatesharedarraybuffer' }, AllocateTypedArray: { url: 'https://262.ecma-international.org/9.0/#sec-allocatetypedarray' }, AllocateTypedArrayBuffer: { url: 'https://262.ecma-international.org/9.0/#sec-allocatetypedarraybuffer' }, ArrayCreate: { url: 'https://262.ecma-international.org/9.0/#sec-arraycreate' }, ArraySetLength: { url: 'https://262.ecma-international.org/9.0/#sec-arraysetlength' }, ArraySpeciesCreate: { url: 'https://262.ecma-international.org/9.0/#sec-arrayspeciescreate' }, AsyncFunctionCreate: { url: 'https://262.ecma-international.org/9.0/#sec-async-functions-abstract-operations-async-function-create' }, AsyncFunctionStart: { url: 'https://262.ecma-international.org/9.0/#sec-async-functions-abstract-operations-async-function-start' }, AsyncGeneratorEnqueue: { url: 'https://262.ecma-international.org/9.0/#sec-asyncgeneratorenqueue' }, AsyncGeneratorFunctionCreate: { url: 'https://262.ecma-international.org/9.0/#sec-asyncgeneratorfunctioncreate' }, AsyncGeneratorReject: { url: 'https://262.ecma-international.org/9.0/#sec-asyncgeneratorreject' }, AsyncGeneratorResolve: { url: 'https://262.ecma-international.org/9.0/#sec-asyncgeneratorresolve' }, AsyncGeneratorResumeNext: { url: 'https://262.ecma-international.org/9.0/#sec-asyncgeneratorresumenext' }, AsyncGeneratorStart: { url: 'https://262.ecma-international.org/9.0/#sec-asyncgeneratorstart' }, AsyncGeneratorYield: { url: 'https://262.ecma-international.org/9.0/#sec-asyncgeneratoryield' }, AsyncIteratorClose: { url: 'https://262.ecma-international.org/9.0/#sec-asynciteratorclose' }, AtomicLoad: { url: 'https://262.ecma-international.org/9.0/#sec-atomicload' }, AtomicReadModifyWrite: { url: 'https://262.ecma-international.org/9.0/#sec-atomicreadmodifywrite' }, Await: { url: 'https://262.ecma-international.org/9.0/#await' }, BackreferenceMatcher: { url: 'https://262.ecma-international.org/9.0/#sec-backreference-matcher' }, BlockDeclarationInstantiation: { url: 'https://262.ecma-international.org/9.0/#sec-blockdeclarationinstantiation' }, BoundFunctionCreate: { url: 'https://262.ecma-international.org/9.0/#sec-boundfunctioncreate' }, Call: { url: 'https://262.ecma-international.org/9.0/#sec-call' }, Canonicalize: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-canonicalize-ch' }, CanonicalNumericIndexString: { url: 'https://262.ecma-international.org/9.0/#sec-canonicalnumericindexstring' }, CaseClauseIsSelected: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-caseclauseisselected' }, CharacterRange: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-characterrange-abstract-operation' }, CharacterRangeOrUnion: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-characterrangeorunion-abstract-operation' }, CharacterSetMatcher: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-charactersetmatcher-abstract-operation' }, CloneArrayBuffer: { url: 'https://262.ecma-international.org/9.0/#sec-clonearraybuffer' }, CompletePropertyDescriptor: { url: 'https://262.ecma-international.org/9.0/#sec-completepropertydescriptor' }, Completion: { url: 'https://262.ecma-international.org/9.0/#sec-completion-record-specification-type' }, ComposeWriteEventBytes: { url: 'https://262.ecma-international.org/9.0/#sec-composewriteeventbytes' }, Construct: { url: 'https://262.ecma-international.org/9.0/#sec-construct' }, CopyDataBlockBytes: { url: 'https://262.ecma-international.org/9.0/#sec-copydatablockbytes' }, CopyDataProperties: { url: 'https://262.ecma-international.org/9.0/#sec-copydataproperties' }, CreateArrayFromList: { url: 'https://262.ecma-international.org/9.0/#sec-createarrayfromlist' }, CreateArrayIterator: { url: 'https://262.ecma-international.org/9.0/#sec-createarrayiterator' }, CreateAsyncFromSyncIterator: { url: 'https://262.ecma-international.org/9.0/#sec-createasyncfromsynciterator' }, CreateBuiltinFunction: { url: 'https://262.ecma-international.org/9.0/#sec-createbuiltinfunction' }, CreateByteDataBlock: { url: 'https://262.ecma-international.org/9.0/#sec-createbytedatablock' }, CreateDataProperty: { url: 'https://262.ecma-international.org/9.0/#sec-createdataproperty' }, CreateDataPropertyOrThrow: { url: 'https://262.ecma-international.org/9.0/#sec-createdatapropertyorthrow' }, CreateDynamicFunction: { url: 'https://262.ecma-international.org/9.0/#sec-createdynamicfunction' }, CreateHTML: { url: 'https://262.ecma-international.org/9.0/#sec-createhtml' }, CreateIntrinsics: { url: 'https://262.ecma-international.org/9.0/#sec-createintrinsics' }, CreateIterResultObject: { url: 'https://262.ecma-international.org/9.0/#sec-createiterresultobject' }, CreateListFromArrayLike: { url: 'https://262.ecma-international.org/9.0/#sec-createlistfromarraylike' }, CreateListIteratorRecord: { url: 'https://262.ecma-international.org/9.0/#sec-createlistiteratorRecord' }, CreateMapIterator: { url: 'https://262.ecma-international.org/9.0/#sec-createmapiterator' }, CreateMappedArgumentsObject: { url: 'https://262.ecma-international.org/9.0/#sec-createmappedargumentsobject' }, CreateMethodProperty: { url: 'https://262.ecma-international.org/9.0/#sec-createmethodproperty' }, CreatePerIterationEnvironment: { url: 'https://262.ecma-international.org/9.0/#sec-createperiterationenvironment' }, CreateRealm: { url: 'https://262.ecma-international.org/9.0/#sec-createrealm' }, CreateResolvingFunctions: { url: 'https://262.ecma-international.org/9.0/#sec-createresolvingfunctions' }, CreateSetIterator: { url: 'https://262.ecma-international.org/9.0/#sec-createsetiterator' }, CreateSharedByteDataBlock: { url: 'https://262.ecma-international.org/9.0/#sec-createsharedbytedatablock' }, CreateStringIterator: { url: 'https://262.ecma-international.org/9.0/#sec-createstringiterator' }, CreateUnmappedArgumentsObject: { url: 'https://262.ecma-international.org/9.0/#sec-createunmappedargumentsobject' }, DateFromTime: { url: 'https://262.ecma-international.org/9.0/#sec-date-number' }, DateString: { url: 'https://262.ecma-international.org/9.0/#sec-datestring' }, Day: { url: 'https://262.ecma-international.org/9.0/#eqn-Day' }, DayFromYear: { url: 'https://262.ecma-international.org/9.0/#eqn-DaysFromYear' }, DaysInYear: { url: 'https://262.ecma-international.org/9.0/#eqn-DaysInYear' }, DayWithinYear: { url: 'https://262.ecma-international.org/9.0/#eqn-DayWithinYear' }, Decode: { url: 'https://262.ecma-international.org/9.0/#sec-decode' }, DefinePropertyOrThrow: { url: 'https://262.ecma-international.org/9.0/#sec-definepropertyorthrow' }, DeletePropertyOrThrow: { url: 'https://262.ecma-international.org/9.0/#sec-deletepropertyorthrow' }, DetachArrayBuffer: { url: 'https://262.ecma-international.org/9.0/#sec-detacharraybuffer' }, Encode: { url: 'https://262.ecma-international.org/9.0/#sec-encode' }, EnqueueJob: { url: 'https://262.ecma-international.org/9.0/#sec-enqueuejob' }, EnterCriticalSection: { url: 'https://262.ecma-international.org/9.0/#sec-entercriticalsection' }, EnumerableOwnPropertyNames: { url: 'https://262.ecma-international.org/9.0/#sec-enumerableownpropertynames' }, EnumerateObjectProperties: { url: 'https://262.ecma-international.org/9.0/#sec-enumerate-object-properties' }, EscapeRegExpPattern: { url: 'https://262.ecma-international.org/9.0/#sec-escaperegexppattern' }, EvalDeclarationInstantiation: { url: 'https://262.ecma-international.org/9.0/#sec-evaldeclarationinstantiation' }, EvaluateCall: { url: 'https://262.ecma-international.org/9.0/#sec-evaluatecall' }, EvaluateNew: { url: 'https://262.ecma-international.org/9.0/#sec-evaluatenew' }, EventSet: { url: 'https://262.ecma-international.org/9.0/#sec-event-set' }, floor: { url: 'https://262.ecma-international.org/9.0/#eqn-floor' }, ForBodyEvaluation: { url: 'https://262.ecma-international.org/9.0/#sec-forbodyevaluation' }, 'ForIn/OfBodyEvaluation': { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset' }, 'ForIn/OfHeadEvaluation': { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind' }, FromPropertyDescriptor: { url: 'https://262.ecma-international.org/9.0/#sec-frompropertydescriptor' }, FulfillPromise: { url: 'https://262.ecma-international.org/9.0/#sec-fulfillpromise' }, FunctionAllocate: { url: 'https://262.ecma-international.org/9.0/#sec-functionallocate' }, FunctionCreate: { url: 'https://262.ecma-international.org/9.0/#sec-functioncreate' }, FunctionDeclarationInstantiation: { url: 'https://262.ecma-international.org/9.0/#sec-functiondeclarationinstantiation' }, FunctionInitialize: { url: 'https://262.ecma-international.org/9.0/#sec-functioninitialize' }, GeneratorFunctionCreate: { url: 'https://262.ecma-international.org/9.0/#sec-generatorfunctioncreate' }, GeneratorResume: { url: 'https://262.ecma-international.org/9.0/#sec-generatorresume' }, GeneratorResumeAbrupt: { url: 'https://262.ecma-international.org/9.0/#sec-generatorresumeabrupt' }, GeneratorStart: { url: 'https://262.ecma-international.org/9.0/#sec-generatorstart' }, GeneratorValidate: { url: 'https://262.ecma-international.org/9.0/#sec-generatorvalidate' }, GeneratorYield: { url: 'https://262.ecma-international.org/9.0/#sec-generatoryield' }, Get: { url: 'https://262.ecma-international.org/9.0/#sec-get-o-p' }, GetActiveScriptOrModule: { url: 'https://262.ecma-international.org/9.0/#sec-getactivescriptormodule' }, GetBase: { url: 'https://262.ecma-international.org/9.0/#sec-getbase' }, GetFunctionRealm: { url: 'https://262.ecma-international.org/9.0/#sec-getfunctionrealm' }, GetGeneratorKind: { url: 'https://262.ecma-international.org/9.0/#sec-getgeneratorkind' }, GetGlobalObject: { url: 'https://262.ecma-international.org/9.0/#sec-getglobalobject' }, GetIdentifierReference: { url: 'https://262.ecma-international.org/9.0/#sec-getidentifierreference' }, GetIterator: { url: 'https://262.ecma-international.org/9.0/#sec-getiterator' }, GetMethod: { url: 'https://262.ecma-international.org/9.0/#sec-getmethod' }, GetModifySetValueInBuffer: { url: 'https://262.ecma-international.org/9.0/#sec-getmodifysetvalueinbuffer' }, GetModuleNamespace: { url: 'https://262.ecma-international.org/9.0/#sec-getmodulenamespace' }, GetNewTarget: { url: 'https://262.ecma-international.org/9.0/#sec-getnewtarget' }, GetOwnPropertyKeys: { url: 'https://262.ecma-international.org/9.0/#sec-getownpropertykeys' }, GetPrototypeFromConstructor: { url: 'https://262.ecma-international.org/9.0/#sec-getprototypefromconstructor' }, GetReferencedName: { url: 'https://262.ecma-international.org/9.0/#sec-getreferencedname' }, GetSubstitution: { url: 'https://262.ecma-international.org/9.0/#sec-getsubstitution' }, GetSuperConstructor: { url: 'https://262.ecma-international.org/9.0/#sec-getsuperconstructor' }, GetTemplateObject: { url: 'https://262.ecma-international.org/9.0/#sec-gettemplateobject' }, GetThisEnvironment: { url: 'https://262.ecma-international.org/9.0/#sec-getthisenvironment' }, GetThisValue: { url: 'https://262.ecma-international.org/9.0/#sec-getthisvalue' }, GetV: { url: 'https://262.ecma-international.org/9.0/#sec-getv' }, GetValue: { url: 'https://262.ecma-international.org/9.0/#sec-getvalue' }, GetValueFromBuffer: { url: 'https://262.ecma-international.org/9.0/#sec-getvaluefrombuffer' }, GetViewValue: { url: 'https://262.ecma-international.org/9.0/#sec-getviewvalue' }, GetWaiterList: { url: 'https://262.ecma-international.org/9.0/#sec-getwaiterlist' }, GlobalDeclarationInstantiation: { url: 'https://262.ecma-international.org/9.0/#sec-globaldeclarationinstantiation' }, 'happens-before': { url: 'https://262.ecma-international.org/9.0/#sec-happens-before' }, HasOwnProperty: { url: 'https://262.ecma-international.org/9.0/#sec-hasownproperty' }, HasPrimitiveBase: { url: 'https://262.ecma-international.org/9.0/#sec-hasprimitivebase' }, HasProperty: { url: 'https://262.ecma-international.org/9.0/#sec-hasproperty' }, 'host-synchronizes-with': { url: 'https://262.ecma-international.org/9.0/#sec-host-synchronizes-with' }, HostEnsureCanCompileStrings: { url: 'https://262.ecma-international.org/9.0/#sec-hostensurecancompilestrings' }, HostEventSet: { url: 'https://262.ecma-international.org/9.0/#sec-hosteventset' }, HostPromiseRejectionTracker: { url: 'https://262.ecma-international.org/9.0/#sec-host-promise-rejection-tracker' }, HostReportErrors: { url: 'https://262.ecma-international.org/9.0/#sec-host-report-errors' }, HostResolveImportedModule: { url: 'https://262.ecma-international.org/9.0/#sec-hostresolveimportedmodule' }, HourFromTime: { url: 'https://262.ecma-international.org/9.0/#eqn-HourFromTime' }, IfAbruptRejectPromise: { url: 'https://262.ecma-international.org/9.0/#sec-ifabruptrejectpromise' }, ImportedLocalNames: { url: 'https://262.ecma-international.org/9.0/#sec-importedlocalnames' }, InitializeBoundName: { url: 'https://262.ecma-international.org/9.0/#sec-initializeboundname' }, InitializeHostDefinedRealm: { url: 'https://262.ecma-international.org/9.0/#sec-initializehostdefinedrealm' }, InitializeReferencedBinding: { url: 'https://262.ecma-international.org/9.0/#sec-initializereferencedbinding' }, InLeapYear: { url: 'https://262.ecma-international.org/9.0/#eqn-InLeapYear' }, InnerModuleEvaluation: { url: 'https://262.ecma-international.org/9.0/#sec-innermoduleevaluation' }, InnerModuleInstantiation: { url: 'https://262.ecma-international.org/9.0/#sec-innermoduleinstantiation' }, InstanceofOperator: { url: 'https://262.ecma-international.org/9.0/#sec-instanceofoperator' }, IntegerIndexedElementGet: { url: 'https://262.ecma-international.org/9.0/#sec-integerindexedelementget' }, IntegerIndexedElementSet: { url: 'https://262.ecma-international.org/9.0/#sec-integerindexedelementset' }, IntegerIndexedObjectCreate: { url: 'https://262.ecma-international.org/9.0/#sec-integerindexedobjectcreate' }, InternalizeJSONProperty: { url: 'https://262.ecma-international.org/9.0/#sec-internalizejsonproperty' }, Invoke: { url: 'https://262.ecma-international.org/9.0/#sec-invoke' }, IsAccessorDescriptor: { url: 'https://262.ecma-international.org/9.0/#sec-isaccessordescriptor' }, IsAnonymousFunctionDefinition: { url: 'https://262.ecma-international.org/9.0/#sec-isanonymousfunctiondefinition' }, IsArray: { url: 'https://262.ecma-international.org/9.0/#sec-isarray' }, IsCallable: { url: 'https://262.ecma-international.org/9.0/#sec-iscallable' }, IsCompatiblePropertyDescriptor: { url: 'https://262.ecma-international.org/9.0/#sec-iscompatiblepropertydescriptor' }, IsConcatSpreadable: { url: 'https://262.ecma-international.org/9.0/#sec-isconcatspreadable' }, IsConstructor: { url: 'https://262.ecma-international.org/9.0/#sec-isconstructor' }, IsDataDescriptor: { url: 'https://262.ecma-international.org/9.0/#sec-isdatadescriptor' }, IsDetachedBuffer: { url: 'https://262.ecma-international.org/9.0/#sec-isdetachedbuffer' }, IsExtensible: { url: 'https://262.ecma-international.org/9.0/#sec-isextensible-o' }, IsGenericDescriptor: { url: 'https://262.ecma-international.org/9.0/#sec-isgenericdescriptor' }, IsInTailPosition: { url: 'https://262.ecma-international.org/9.0/#sec-isintailposition' }, IsInteger: { url: 'https://262.ecma-international.org/9.0/#sec-isinteger' }, IsLabelledFunction: { url: 'https://262.ecma-international.org/9.0/#sec-islabelledfunction' }, IsPromise: { url: 'https://262.ecma-international.org/9.0/#sec-ispromise' }, IsPropertyKey: { url: 'https://262.ecma-international.org/9.0/#sec-ispropertykey' }, IsPropertyReference: { url: 'https://262.ecma-international.org/9.0/#sec-ispropertyreference' }, IsRegExp: { url: 'https://262.ecma-international.org/9.0/#sec-isregexp' }, IsSharedArrayBuffer: { url: 'https://262.ecma-international.org/9.0/#sec-issharedarraybuffer' }, IsStrictReference: { url: 'https://262.ecma-international.org/9.0/#sec-isstrictreference' }, IsStringPrefix: { url: 'https://262.ecma-international.org/9.0/#sec-isstringprefix' }, IsSuperReference: { url: 'https://262.ecma-international.org/9.0/#sec-issuperreference' }, IsUnresolvableReference: { url: 'https://262.ecma-international.org/9.0/#sec-isunresolvablereference' }, IsWordChar: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-iswordchar-abstract-operation' }, IterableToList: { url: 'https://262.ecma-international.org/9.0/#sec-iterabletolist' }, IteratorClose: { url: 'https://262.ecma-international.org/9.0/#sec-iteratorclose' }, IteratorComplete: { url: 'https://262.ecma-international.org/9.0/#sec-iteratorcomplete' }, IteratorNext: { url: 'https://262.ecma-international.org/9.0/#sec-iteratornext' }, IteratorStep: { url: 'https://262.ecma-international.org/9.0/#sec-iteratorstep' }, IteratorValue: { url: 'https://262.ecma-international.org/9.0/#sec-iteratorvalue' }, LeaveCriticalSection: { url: 'https://262.ecma-international.org/9.0/#sec-leavecriticalsection' }, LocalTime: { url: 'https://262.ecma-international.org/9.0/#sec-localtime' }, LoopContinues: { url: 'https://262.ecma-international.org/9.0/#sec-loopcontinues' }, MakeArgGetter: { url: 'https://262.ecma-international.org/9.0/#sec-makearggetter' }, MakeArgSetter: { url: 'https://262.ecma-international.org/9.0/#sec-makeargsetter' }, MakeClassConstructor: { url: 'https://262.ecma-international.org/9.0/#sec-makeclassconstructor' }, MakeConstructor: { url: 'https://262.ecma-international.org/9.0/#sec-makeconstructor' }, MakeDate: { url: 'https://262.ecma-international.org/9.0/#sec-makedate' }, MakeDay: { url: 'https://262.ecma-international.org/9.0/#sec-makeday' }, MakeMethod: { url: 'https://262.ecma-international.org/9.0/#sec-makemethod' }, MakeSuperPropertyReference: { url: 'https://262.ecma-international.org/9.0/#sec-makesuperpropertyreference' }, MakeTime: { url: 'https://262.ecma-international.org/9.0/#sec-maketime' }, max: { url: 'https://262.ecma-international.org/9.0/#eqn-max' }, 'memory-order': { url: 'https://262.ecma-international.org/9.0/#sec-memory-order' }, min: { url: 'https://262.ecma-international.org/9.0/#eqn-min' }, MinFromTime: { url: 'https://262.ecma-international.org/9.0/#eqn-MinFromTime' }, ModuleDeclarationEnvironmentSetup: { url: 'https://262.ecma-international.org/9.0/#sec-moduledeclarationenvironmentsetup' }, ModuleExecution: { url: 'https://262.ecma-international.org/9.0/#sec-moduleexecution' }, ModuleNamespaceCreate: { url: 'https://262.ecma-international.org/9.0/#sec-modulenamespacecreate' }, modulo: { url: 'https://262.ecma-international.org/9.0/#eqn-modulo' }, MonthFromTime: { url: 'https://262.ecma-international.org/9.0/#eqn-MonthFromTime' }, msFromTime: { url: 'https://262.ecma-international.org/9.0/#eqn-msFromTime' }, NewDeclarativeEnvironment: { url: 'https://262.ecma-international.org/9.0/#sec-newdeclarativeenvironment' }, NewFunctionEnvironment: { url: 'https://262.ecma-international.org/9.0/#sec-newfunctionenvironment' }, NewGlobalEnvironment: { url: 'https://262.ecma-international.org/9.0/#sec-newglobalenvironment' }, NewModuleEnvironment: { url: 'https://262.ecma-international.org/9.0/#sec-newmoduleenvironment' }, NewObjectEnvironment: { url: 'https://262.ecma-international.org/9.0/#sec-newobjectenvironment' }, NewPromiseCapability: { url: 'https://262.ecma-international.org/9.0/#sec-newpromisecapability' }, NormalCompletion: { url: 'https://262.ecma-international.org/9.0/#sec-normalcompletion' }, NumberToRawBytes: { url: 'https://262.ecma-international.org/9.0/#sec-numbertorawbytes' }, NumberToString: { url: 'https://262.ecma-international.org/9.0/#sec-tostring-applied-to-the-number-type' }, ObjectCreate: { url: 'https://262.ecma-international.org/9.0/#sec-objectcreate' }, ObjectDefineProperties: { url: 'https://262.ecma-international.org/9.0/#sec-objectdefineproperties' }, OrdinaryCallBindThis: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarycallbindthis' }, OrdinaryCallEvaluateBody: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarycallevaluatebody' }, OrdinaryCreateFromConstructor: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarycreatefromconstructor' }, OrdinaryDefineOwnProperty: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarydefineownproperty' }, OrdinaryDelete: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarydelete' }, OrdinaryGet: { url: 'https://262.ecma-international.org/9.0/#sec-ordinaryget' }, OrdinaryGetOwnProperty: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarygetownproperty' }, OrdinaryGetPrototypeOf: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarygetprototypeof' }, OrdinaryHasInstance: { url: 'https://262.ecma-international.org/9.0/#sec-ordinaryhasinstance' }, OrdinaryHasProperty: { url: 'https://262.ecma-international.org/9.0/#sec-ordinaryhasproperty' }, OrdinaryIsExtensible: { url: 'https://262.ecma-international.org/9.0/#sec-ordinaryisextensible' }, OrdinaryOwnPropertyKeys: { url: 'https://262.ecma-international.org/9.0/#sec-ordinaryownpropertykeys' }, OrdinaryPreventExtensions: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarypreventextensions' }, OrdinarySet: { url: 'https://262.ecma-international.org/9.0/#sec-ordinaryset' }, OrdinarySetPrototypeOf: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarysetprototypeof' }, OrdinarySetWithOwnDescriptor: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarysetwithowndescriptor' }, OrdinaryToPrimitive: { url: 'https://262.ecma-international.org/9.0/#sec-ordinarytoprimitive' }, ParseModule: { url: 'https://262.ecma-international.org/9.0/#sec-parsemodule' }, ParseScript: { url: 'https://262.ecma-international.org/9.0/#sec-parse-script' }, PerformEval: { url: 'https://262.ecma-international.org/9.0/#sec-performeval' }, PerformPromiseAll: { url: 'https://262.ecma-international.org/9.0/#sec-performpromiseall' }, PerformPromiseRace: { url: 'https://262.ecma-international.org/9.0/#sec-performpromiserace' }, PerformPromiseThen: { url: 'https://262.ecma-international.org/9.0/#sec-performpromisethen' }, PrepareForOrdinaryCall: { url: 'https://262.ecma-international.org/9.0/#sec-prepareforordinarycall' }, PrepareForTailCall: { url: 'https://262.ecma-international.org/9.0/#sec-preparefortailcall' }, PromiseReactionJob: { url: 'https://262.ecma-international.org/9.0/#sec-promisereactionjob' }, PromiseResolve: { url: 'https://262.ecma-international.org/9.0/#sec-promise-resolve' }, PromiseResolveThenableJob: { url: 'https://262.ecma-international.org/9.0/#sec-promiseresolvethenablejob' }, ProxyCreate: { url: 'https://262.ecma-international.org/9.0/#sec-proxycreate' }, PutValue: { url: 'https://262.ecma-international.org/9.0/#sec-putvalue' }, QuoteJSONString: { url: 'https://262.ecma-international.org/9.0/#sec-quotejsonstring' }, RawBytesToNumber: { url: 'https://262.ecma-international.org/9.0/#sec-rawbytestonumber' }, 'reads-bytes-from': { url: 'https://262.ecma-international.org/9.0/#sec-reads-bytes-from' }, 'reads-from': { url: 'https://262.ecma-international.org/9.0/#sec-reads-from' }, RegExpAlloc: { url: 'https://262.ecma-international.org/9.0/#sec-regexpalloc' }, RegExpBuiltinExec: { url: 'https://262.ecma-international.org/9.0/#sec-regexpbuiltinexec' }, RegExpCreate: { url: 'https://262.ecma-international.org/9.0/#sec-regexpcreate' }, RegExpExec: { url: 'https://262.ecma-international.org/9.0/#sec-regexpexec' }, RegExpInitialize: { url: 'https://262.ecma-international.org/9.0/#sec-regexpinitialize' }, RejectPromise: { url: 'https://262.ecma-international.org/9.0/#sec-rejectpromise' }, RemoveWaiter: { url: 'https://262.ecma-international.org/9.0/#sec-removewaiter' }, RemoveWaiters: { url: 'https://262.ecma-international.org/9.0/#sec-removewaiters' }, RepeatMatcher: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-repeatmatcher-abstract-operation' }, RequireObjectCoercible: { url: 'https://262.ecma-international.org/9.0/#sec-requireobjectcoercible' }, ResolveBinding: { url: 'https://262.ecma-international.org/9.0/#sec-resolvebinding' }, ResolveThisBinding: { url: 'https://262.ecma-international.org/9.0/#sec-resolvethisbinding' }, ReturnIfAbrupt: { url: 'https://262.ecma-international.org/9.0/#sec-returnifabrupt' }, RunJobs: { url: 'https://262.ecma-international.org/9.0/#sec-runjobs' }, SameValue: { url: 'https://262.ecma-international.org/9.0/#sec-samevalue' }, SameValueNonNumber: { url: 'https://262.ecma-international.org/9.0/#sec-samevaluenonnumber' }, SameValueZero: { url: 'https://262.ecma-international.org/9.0/#sec-samevaluezero' }, ScriptEvaluation: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-scriptevaluation' }, ScriptEvaluationJob: { url: 'https://262.ecma-international.org/9.0/#sec-scriptevaluationjob' }, SecFromTime: { url: 'https://262.ecma-international.org/9.0/#eqn-SecFromTime' }, SerializeJSONArray: { url: 'https://262.ecma-international.org/9.0/#sec-serializejsonarray' }, SerializeJSONObject: { url: 'https://262.ecma-international.org/9.0/#sec-serializejsonobject' }, SerializeJSONProperty: { url: 'https://262.ecma-international.org/9.0/#sec-serializejsonproperty' }, Set: { url: 'https://262.ecma-international.org/9.0/#sec-set-o-p-v-throw' }, SetDefaultGlobalBindings: { url: 'https://262.ecma-international.org/9.0/#sec-setdefaultglobalbindings' }, SetFunctionLength: { url: 'https://262.ecma-international.org/9.0/#sec-setfunctionlength' }, SetFunctionName: { url: 'https://262.ecma-international.org/9.0/#sec-setfunctionname' }, SetImmutablePrototype: { url: 'https://262.ecma-international.org/9.0/#sec-set-immutable-prototype' }, SetIntegrityLevel: { url: 'https://262.ecma-international.org/9.0/#sec-setintegritylevel' }, SetRealmGlobalObject: { url: 'https://262.ecma-international.org/9.0/#sec-setrealmglobalobject' }, SetValueInBuffer: { url: 'https://262.ecma-international.org/9.0/#sec-setvalueinbuffer' }, SetViewValue: { url: 'https://262.ecma-international.org/9.0/#sec-setviewvalue' }, SharedDataBlockEventSet: { url: 'https://262.ecma-international.org/9.0/#sec-sharedatablockeventset' }, SortCompare: { url: 'https://262.ecma-international.org/9.0/#sec-sortcompare' }, SpeciesConstructor: { url: 'https://262.ecma-international.org/9.0/#sec-speciesconstructor' }, SplitMatch: { url: 'https://262.ecma-international.org/9.0/#sec-splitmatch' }, 'Strict Equality Comparison': { url: 'https://262.ecma-international.org/9.0/#sec-strict-equality-comparison' }, StringCreate: { url: 'https://262.ecma-international.org/9.0/#sec-stringcreate' }, StringGetOwnProperty: { url: 'https://262.ecma-international.org/9.0/#sec-stringgetownproperty' }, Suspend: { url: 'https://262.ecma-international.org/9.0/#sec-suspend' }, SymbolDescriptiveString: { url: 'https://262.ecma-international.org/9.0/#sec-symboldescriptivestring' }, 'synchronizes-with': { url: 'https://262.ecma-international.org/9.0/#sec-synchronizes-with' }, TestIntegrityLevel: { url: 'https://262.ecma-international.org/9.0/#sec-testintegritylevel' }, thisBooleanValue: { url: 'https://262.ecma-international.org/9.0/#sec-thisbooleanvalue' }, thisNumberValue: { url: 'https://262.ecma-international.org/9.0/#sec-thisnumbervalue' }, thisStringValue: { url: 'https://262.ecma-international.org/9.0/#sec-thisstringvalue' }, thisSymbolValue: { url: 'https://262.ecma-international.org/9.0/#sec-thissymbolvalue' }, thisTimeValue: { url: 'https://262.ecma-international.org/9.0/#sec-thistimevalue' }, ThrowCompletion: { url: 'https://262.ecma-international.org/9.0/#sec-throwcompletion' }, TimeClip: { url: 'https://262.ecma-international.org/9.0/#sec-timeclip' }, TimeFromYear: { url: 'https://262.ecma-international.org/9.0/#eqn-TimeFromYear' }, TimeString: { url: 'https://262.ecma-international.org/9.0/#sec-timestring' }, TimeWithinDay: { url: 'https://262.ecma-international.org/9.0/#eqn-TimeWithinDay' }, TimeZoneString: { url: 'https://262.ecma-international.org/9.0/#sec-timezoneestring' }, ToBoolean: { url: 'https://262.ecma-international.org/9.0/#sec-toboolean' }, ToDateString: { url: 'https://262.ecma-international.org/9.0/#sec-todatestring' }, ToIndex: { url: 'https://262.ecma-international.org/9.0/#sec-toindex' }, ToInt16: { url: 'https://262.ecma-international.org/9.0/#sec-toint16' }, ToInt32: { url: 'https://262.ecma-international.org/9.0/#sec-toint32' }, ToInt8: { url: 'https://262.ecma-international.org/9.0/#sec-toint8' }, ToInteger: { url: 'https://262.ecma-international.org/9.0/#sec-tointeger' }, ToLength: { url: 'https://262.ecma-international.org/9.0/#sec-tolength' }, ToNumber: { url: 'https://262.ecma-international.org/9.0/#sec-tonumber' }, ToObject: { url: 'https://262.ecma-international.org/9.0/#sec-toobject' }, TopLevelModuleEvaluationJob: { url: 'https://262.ecma-international.org/9.0/#sec-toplevelmoduleevaluationjob' }, ToPrimitive: { url: 'https://262.ecma-international.org/9.0/#sec-toprimitive' }, ToPropertyDescriptor: { url: 'https://262.ecma-international.org/9.0/#sec-topropertydescriptor' }, ToPropertyKey: { url: 'https://262.ecma-international.org/9.0/#sec-topropertykey' }, ToString: { url: 'https://262.ecma-international.org/9.0/#sec-tostring' }, ToUint16: { url: 'https://262.ecma-international.org/9.0/#sec-touint16' }, ToUint32: { url: 'https://262.ecma-international.org/9.0/#sec-touint32' }, ToUint8: { url: 'https://262.ecma-international.org/9.0/#sec-touint8' }, ToUint8Clamp: { url: 'https://262.ecma-international.org/9.0/#sec-touint8clamp' }, TriggerPromiseReactions: { url: 'https://262.ecma-international.org/9.0/#sec-triggerpromisereactions' }, Type: { url: 'https://262.ecma-international.org/9.0/#sec-ecmascript-data-types-and-values' }, TypedArrayCreate: { url: 'https://262.ecma-international.org/9.0/#typedarray-create' }, TypedArraySpeciesCreate: { url: 'https://262.ecma-international.org/9.0/#typedarray-species-create' }, UnicodeEscape: { url: 'https://262.ecma-international.org/9.0/#sec-unicodeescape' }, UnicodeMatchProperty: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-unicodematchproperty-p' }, UnicodeMatchPropertyValue: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-unicodematchpropertyvalue-p-v' }, UpdateEmpty: { url: 'https://262.ecma-international.org/9.0/#sec-updateempty' }, UTC: { url: 'https://262.ecma-international.org/9.0/#sec-utc-t' }, UTF16Decode: { url: 'https://262.ecma-international.org/9.0/#sec-utf16decode' }, UTF16Encoding: { url: 'https://262.ecma-international.org/9.0/#sec-utf16encoding' }, ValidateAndApplyPropertyDescriptor: { url: 'https://262.ecma-international.org/9.0/#sec-validateandapplypropertydescriptor' }, ValidateAtomicAccess: { url: 'https://262.ecma-international.org/9.0/#sec-validateatomicaccess' }, ValidateSharedIntegerTypedArray: { url: 'https://262.ecma-international.org/9.0/#sec-validatesharedintegertypedarray' }, ValidateTypedArray: { url: 'https://262.ecma-international.org/9.0/#sec-validatetypedarray' }, ValueOfReadEvent: { url: 'https://262.ecma-international.org/9.0/#sec-valueofreadevent' }, WakeWaiter: { url: 'https://262.ecma-international.org/9.0/#sec-wakewaiter' }, WeekDay: { url: 'https://262.ecma-international.org/9.0/#sec-week-day' }, WordCharacters: { url: 'https://262.ecma-international.org/9.0/#sec-runtime-semantics-wordcharacters-abstract-operation' }, YearFromTime: { url: 'https://262.ecma-international.org/9.0/#eqn-YearFromTime' } }; es-abstract-1.20.4/operations/2019.js000066400000000000000000001036431431761430200171320ustar00rootroot00000000000000'use strict'; module.exports = { abs: { url: 'https://262.ecma-international.org/10.0/#eqn-abs' }, 'Abstract Equality Comparison': { url: 'https://262.ecma-international.org/10.0/#sec-abstract-equality-comparison' }, 'Abstract Relational Comparison': { url: 'https://262.ecma-international.org/10.0/#sec-abstract-relational-comparison' }, AddEntriesFromIterable: { url: 'https://262.ecma-international.org/10.0/#sec-add-entries-from-iterable' }, AddRestrictedFunctionProperties: { url: 'https://262.ecma-international.org/10.0/#sec-addrestrictedfunctionproperties' }, AddWaiter: { url: 'https://262.ecma-international.org/10.0/#sec-addwaiter' }, AdvanceStringIndex: { url: 'https://262.ecma-international.org/10.0/#sec-advancestringindex' }, 'agent-order': { url: 'https://262.ecma-international.org/10.0/#sec-agent-order' }, AgentCanSuspend: { url: 'https://262.ecma-international.org/10.0/#sec-agentcansuspend' }, AgentSignifier: { url: 'https://262.ecma-international.org/10.0/#sec-agentsignifier' }, AllocateArrayBuffer: { url: 'https://262.ecma-international.org/10.0/#sec-allocatearraybuffer' }, AllocateSharedArrayBuffer: { url: 'https://262.ecma-international.org/10.0/#sec-allocatesharedarraybuffer' }, AllocateTypedArray: { url: 'https://262.ecma-international.org/10.0/#sec-allocatetypedarray' }, AllocateTypedArrayBuffer: { url: 'https://262.ecma-international.org/10.0/#sec-allocatetypedarraybuffer' }, ArrayCreate: { url: 'https://262.ecma-international.org/10.0/#sec-arraycreate' }, ArraySetLength: { url: 'https://262.ecma-international.org/10.0/#sec-arraysetlength' }, ArraySpeciesCreate: { url: 'https://262.ecma-international.org/10.0/#sec-arrayspeciescreate' }, AsyncFromSyncIteratorContinuation: { url: 'https://262.ecma-international.org/10.0/#sec-asyncfromsynciteratorcontinuation' }, AsyncFunctionCreate: { url: 'https://262.ecma-international.org/10.0/#sec-async-functions-abstract-operations-async-function-create' }, AsyncFunctionStart: { url: 'https://262.ecma-international.org/10.0/#sec-async-functions-abstract-operations-async-function-start' }, AsyncGeneratorEnqueue: { url: 'https://262.ecma-international.org/10.0/#sec-asyncgeneratorenqueue' }, AsyncGeneratorFunctionCreate: { url: 'https://262.ecma-international.org/10.0/#sec-asyncgeneratorfunctioncreate' }, AsyncGeneratorReject: { url: 'https://262.ecma-international.org/10.0/#sec-asyncgeneratorreject' }, AsyncGeneratorResolve: { url: 'https://262.ecma-international.org/10.0/#sec-asyncgeneratorresolve' }, AsyncGeneratorResumeNext: { url: 'https://262.ecma-international.org/10.0/#sec-asyncgeneratorresumenext' }, AsyncGeneratorStart: { url: 'https://262.ecma-international.org/10.0/#sec-asyncgeneratorstart' }, AsyncGeneratorYield: { url: 'https://262.ecma-international.org/10.0/#sec-asyncgeneratoryield' }, AsyncIteratorClose: { url: 'https://262.ecma-international.org/10.0/#sec-asynciteratorclose' }, AtomicLoad: { url: 'https://262.ecma-international.org/10.0/#sec-atomicload' }, AtomicReadModifyWrite: { url: 'https://262.ecma-international.org/10.0/#sec-atomicreadmodifywrite' }, Await: { url: 'https://262.ecma-international.org/10.0/#await' }, BackreferenceMatcher: { url: 'https://262.ecma-international.org/10.0/#sec-backreference-matcher' }, BlockDeclarationInstantiation: { url: 'https://262.ecma-international.org/10.0/#sec-blockdeclarationinstantiation' }, BoundFunctionCreate: { url: 'https://262.ecma-international.org/10.0/#sec-boundfunctioncreate' }, Call: { url: 'https://262.ecma-international.org/10.0/#sec-call' }, Canonicalize: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-canonicalize-ch' }, CanonicalNumericIndexString: { url: 'https://262.ecma-international.org/10.0/#sec-canonicalnumericindexstring' }, CaseClauseIsSelected: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-caseclauseisselected' }, CharacterRange: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-characterrange-abstract-operation' }, CharacterRangeOrUnion: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-characterrangeorunion-abstract-operation' }, CharacterSetMatcher: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-charactersetmatcher-abstract-operation' }, CloneArrayBuffer: { url: 'https://262.ecma-international.org/10.0/#sec-clonearraybuffer' }, CompletePropertyDescriptor: { url: 'https://262.ecma-international.org/10.0/#sec-completepropertydescriptor' }, Completion: { url: 'https://262.ecma-international.org/10.0/#sec-completion-record-specification-type' }, ComposeWriteEventBytes: { url: 'https://262.ecma-international.org/10.0/#sec-composewriteeventbytes' }, Construct: { url: 'https://262.ecma-international.org/10.0/#sec-construct' }, CopyDataBlockBytes: { url: 'https://262.ecma-international.org/10.0/#sec-copydatablockbytes' }, CopyDataProperties: { url: 'https://262.ecma-international.org/10.0/#sec-copydataproperties' }, CreateArrayFromList: { url: 'https://262.ecma-international.org/10.0/#sec-createarrayfromlist' }, CreateArrayIterator: { url: 'https://262.ecma-international.org/10.0/#sec-createarrayiterator' }, CreateAsyncFromSyncIterator: { url: 'https://262.ecma-international.org/10.0/#sec-createasyncfromsynciterator' }, CreateBuiltinFunction: { url: 'https://262.ecma-international.org/10.0/#sec-createbuiltinfunction' }, CreateByteDataBlock: { url: 'https://262.ecma-international.org/10.0/#sec-createbytedatablock' }, CreateDataProperty: { url: 'https://262.ecma-international.org/10.0/#sec-createdataproperty' }, CreateDataPropertyOrThrow: { url: 'https://262.ecma-international.org/10.0/#sec-createdatapropertyorthrow' }, CreateDynamicFunction: { url: 'https://262.ecma-international.org/10.0/#sec-createdynamicfunction' }, CreateHTML: { url: 'https://262.ecma-international.org/10.0/#sec-createhtml' }, CreateIntrinsics: { url: 'https://262.ecma-international.org/10.0/#sec-createintrinsics' }, CreateIterResultObject: { url: 'https://262.ecma-international.org/10.0/#sec-createiterresultobject' }, CreateListFromArrayLike: { url: 'https://262.ecma-international.org/10.0/#sec-createlistfromarraylike' }, CreateListIteratorRecord: { url: 'https://262.ecma-international.org/10.0/#sec-createlistiteratorRecord' }, CreateMapIterator: { url: 'https://262.ecma-international.org/10.0/#sec-createmapiterator' }, CreateMappedArgumentsObject: { url: 'https://262.ecma-international.org/10.0/#sec-createmappedargumentsobject' }, CreateMethodProperty: { url: 'https://262.ecma-international.org/10.0/#sec-createmethodproperty' }, CreatePerIterationEnvironment: { url: 'https://262.ecma-international.org/10.0/#sec-createperiterationenvironment' }, CreateRealm: { url: 'https://262.ecma-international.org/10.0/#sec-createrealm' }, CreateResolvingFunctions: { url: 'https://262.ecma-international.org/10.0/#sec-createresolvingfunctions' }, CreateSetIterator: { url: 'https://262.ecma-international.org/10.0/#sec-createsetiterator' }, CreateSharedByteDataBlock: { url: 'https://262.ecma-international.org/10.0/#sec-createsharedbytedatablock' }, CreateStringIterator: { url: 'https://262.ecma-international.org/10.0/#sec-createstringiterator' }, CreateUnmappedArgumentsObject: { url: 'https://262.ecma-international.org/10.0/#sec-createunmappedargumentsobject' }, DateFromTime: { url: 'https://262.ecma-international.org/10.0/#sec-date-number' }, DateString: { url: 'https://262.ecma-international.org/10.0/#sec-datestring' }, Day: { url: 'https://262.ecma-international.org/10.0/#eqn-Day' }, DayFromYear: { url: 'https://262.ecma-international.org/10.0/#eqn-DaysFromYear' }, DaysInYear: { url: 'https://262.ecma-international.org/10.0/#eqn-DaysInYear' }, DayWithinYear: { url: 'https://262.ecma-international.org/10.0/#eqn-DayWithinYear' }, Decode: { url: 'https://262.ecma-international.org/10.0/#sec-decode' }, DefinePropertyOrThrow: { url: 'https://262.ecma-international.org/10.0/#sec-definepropertyorthrow' }, DeletePropertyOrThrow: { url: 'https://262.ecma-international.org/10.0/#sec-deletepropertyorthrow' }, DetachArrayBuffer: { url: 'https://262.ecma-international.org/10.0/#sec-detacharraybuffer' }, Encode: { url: 'https://262.ecma-international.org/10.0/#sec-encode' }, EnqueueJob: { url: 'https://262.ecma-international.org/10.0/#sec-enqueuejob' }, EnterCriticalSection: { url: 'https://262.ecma-international.org/10.0/#sec-entercriticalsection' }, EnumerableOwnPropertyNames: { url: 'https://262.ecma-international.org/10.0/#sec-enumerableownpropertynames' }, EnumerateObjectProperties: { url: 'https://262.ecma-international.org/10.0/#sec-enumerate-object-properties' }, EscapeRegExpPattern: { url: 'https://262.ecma-international.org/10.0/#sec-escaperegexppattern' }, EvalDeclarationInstantiation: { url: 'https://262.ecma-international.org/10.0/#sec-evaldeclarationinstantiation' }, EvaluateCall: { url: 'https://262.ecma-international.org/10.0/#sec-evaluatecall' }, EvaluateNew: { url: 'https://262.ecma-international.org/10.0/#sec-evaluatenew' }, EventSet: { url: 'https://262.ecma-international.org/10.0/#sec-event-set' }, ExecuteModule: { url: 'https://262.ecma-international.org/10.0/#sec-source-text-module-record-execute-module' }, FlattenIntoArray: { url: 'https://262.ecma-international.org/10.0/#sec-flattenintoarray' }, floor: { url: 'https://262.ecma-international.org/10.0/#eqn-floor' }, ForBodyEvaluation: { url: 'https://262.ecma-international.org/10.0/#sec-forbodyevaluation' }, 'ForIn/OfBodyEvaluation': { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset' }, 'ForIn/OfHeadEvaluation': { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind' }, FromPropertyDescriptor: { url: 'https://262.ecma-international.org/10.0/#sec-frompropertydescriptor' }, FulfillPromise: { url: 'https://262.ecma-international.org/10.0/#sec-fulfillpromise' }, FunctionAllocate: { url: 'https://262.ecma-international.org/10.0/#sec-functionallocate' }, FunctionCreate: { url: 'https://262.ecma-international.org/10.0/#sec-functioncreate' }, FunctionDeclarationInstantiation: { url: 'https://262.ecma-international.org/10.0/#sec-functiondeclarationinstantiation' }, FunctionInitialize: { url: 'https://262.ecma-international.org/10.0/#sec-functioninitialize' }, GeneratorFunctionCreate: { url: 'https://262.ecma-international.org/10.0/#sec-generatorfunctioncreate' }, GeneratorResume: { url: 'https://262.ecma-international.org/10.0/#sec-generatorresume' }, GeneratorResumeAbrupt: { url: 'https://262.ecma-international.org/10.0/#sec-generatorresumeabrupt' }, GeneratorStart: { url: 'https://262.ecma-international.org/10.0/#sec-generatorstart' }, GeneratorValidate: { url: 'https://262.ecma-international.org/10.0/#sec-generatorvalidate' }, GeneratorYield: { url: 'https://262.ecma-international.org/10.0/#sec-generatoryield' }, Get: { url: 'https://262.ecma-international.org/10.0/#sec-get-o-p' }, GetActiveScriptOrModule: { url: 'https://262.ecma-international.org/10.0/#sec-getactivescriptormodule' }, GetBase: { url: 'https://262.ecma-international.org/10.0/#sec-getbase' }, GetFunctionRealm: { url: 'https://262.ecma-international.org/10.0/#sec-getfunctionrealm' }, GetGeneratorKind: { url: 'https://262.ecma-international.org/10.0/#sec-getgeneratorkind' }, GetGlobalObject: { url: 'https://262.ecma-international.org/10.0/#sec-getglobalobject' }, GetIdentifierReference: { url: 'https://262.ecma-international.org/10.0/#sec-getidentifierreference' }, GetIterator: { url: 'https://262.ecma-international.org/10.0/#sec-getiterator' }, GetMethod: { url: 'https://262.ecma-international.org/10.0/#sec-getmethod' }, GetModifySetValueInBuffer: { url: 'https://262.ecma-international.org/10.0/#sec-getmodifysetvalueinbuffer' }, GetModuleNamespace: { url: 'https://262.ecma-international.org/10.0/#sec-getmodulenamespace' }, GetNewTarget: { url: 'https://262.ecma-international.org/10.0/#sec-getnewtarget' }, GetOwnPropertyKeys: { url: 'https://262.ecma-international.org/10.0/#sec-getownpropertykeys' }, GetPrototypeFromConstructor: { url: 'https://262.ecma-international.org/10.0/#sec-getprototypefromconstructor' }, GetReferencedName: { url: 'https://262.ecma-international.org/10.0/#sec-getreferencedname' }, GetSubstitution: { url: 'https://262.ecma-international.org/10.0/#sec-getsubstitution' }, GetSuperConstructor: { url: 'https://262.ecma-international.org/10.0/#sec-getsuperconstructor' }, GetTemplateObject: { url: 'https://262.ecma-international.org/10.0/#sec-gettemplateobject' }, GetThisEnvironment: { url: 'https://262.ecma-international.org/10.0/#sec-getthisenvironment' }, GetThisValue: { url: 'https://262.ecma-international.org/10.0/#sec-getthisvalue' }, GetV: { url: 'https://262.ecma-international.org/10.0/#sec-getv' }, GetValue: { url: 'https://262.ecma-international.org/10.0/#sec-getvalue' }, GetValueFromBuffer: { url: 'https://262.ecma-international.org/10.0/#sec-getvaluefrombuffer' }, GetViewValue: { url: 'https://262.ecma-international.org/10.0/#sec-getviewvalue' }, GetWaiterList: { url: 'https://262.ecma-international.org/10.0/#sec-getwaiterlist' }, GlobalDeclarationInstantiation: { url: 'https://262.ecma-international.org/10.0/#sec-globaldeclarationinstantiation' }, 'happens-before': { url: 'https://262.ecma-international.org/10.0/#sec-happens-before' }, HasOwnProperty: { url: 'https://262.ecma-international.org/10.0/#sec-hasownproperty' }, HasPrimitiveBase: { url: 'https://262.ecma-international.org/10.0/#sec-hasprimitivebase' }, HasProperty: { url: 'https://262.ecma-international.org/10.0/#sec-hasproperty' }, 'host-synchronizes-with': { url: 'https://262.ecma-international.org/10.0/#sec-host-synchronizes-with' }, HostEnsureCanCompileStrings: { url: 'https://262.ecma-international.org/10.0/#sec-hostensurecancompilestrings' }, HostEventSet: { url: 'https://262.ecma-international.org/10.0/#sec-hosteventset' }, HostPromiseRejectionTracker: { url: 'https://262.ecma-international.org/10.0/#sec-host-promise-rejection-tracker' }, HostReportErrors: { url: 'https://262.ecma-international.org/10.0/#sec-host-report-errors' }, HostResolveImportedModule: { url: 'https://262.ecma-international.org/10.0/#sec-hostresolveimportedmodule' }, HourFromTime: { url: 'https://262.ecma-international.org/10.0/#eqn-HourFromTime' }, IfAbruptRejectPromise: { url: 'https://262.ecma-international.org/10.0/#sec-ifabruptrejectpromise' }, ImportedLocalNames: { url: 'https://262.ecma-international.org/10.0/#sec-importedlocalnames' }, InitializeBoundName: { url: 'https://262.ecma-international.org/10.0/#sec-initializeboundname' }, InitializeEnvironment: { url: 'https://262.ecma-international.org/10.0/#sec-source-text-module-record-initialize-environment' }, InitializeHostDefinedRealm: { url: 'https://262.ecma-international.org/10.0/#sec-initializehostdefinedrealm' }, InitializeReferencedBinding: { url: 'https://262.ecma-international.org/10.0/#sec-initializereferencedbinding' }, InLeapYear: { url: 'https://262.ecma-international.org/10.0/#eqn-InLeapYear' }, InnerModuleEvaluation: { url: 'https://262.ecma-international.org/10.0/#sec-innermoduleevaluation' }, InnerModuleInstantiation: { url: 'https://262.ecma-international.org/10.0/#sec-innermoduleinstantiation' }, InstanceofOperator: { url: 'https://262.ecma-international.org/10.0/#sec-instanceofoperator' }, IntegerIndexedElementGet: { url: 'https://262.ecma-international.org/10.0/#sec-integerindexedelementget' }, IntegerIndexedElementSet: { url: 'https://262.ecma-international.org/10.0/#sec-integerindexedelementset' }, IntegerIndexedObjectCreate: { url: 'https://262.ecma-international.org/10.0/#sec-integerindexedobjectcreate' }, InternalizeJSONProperty: { url: 'https://262.ecma-international.org/10.0/#sec-internalizejsonproperty' }, Invoke: { url: 'https://262.ecma-international.org/10.0/#sec-invoke' }, IsAccessorDescriptor: { url: 'https://262.ecma-international.org/10.0/#sec-isaccessordescriptor' }, IsAnonymousFunctionDefinition: { url: 'https://262.ecma-international.org/10.0/#sec-isanonymousfunctiondefinition' }, IsArray: { url: 'https://262.ecma-international.org/10.0/#sec-isarray' }, IsCallable: { url: 'https://262.ecma-international.org/10.0/#sec-iscallable' }, IsCompatiblePropertyDescriptor: { url: 'https://262.ecma-international.org/10.0/#sec-iscompatiblepropertydescriptor' }, IsConcatSpreadable: { url: 'https://262.ecma-international.org/10.0/#sec-isconcatspreadable' }, IsConstructor: { url: 'https://262.ecma-international.org/10.0/#sec-isconstructor' }, IsDataDescriptor: { url: 'https://262.ecma-international.org/10.0/#sec-isdatadescriptor' }, IsDetachedBuffer: { url: 'https://262.ecma-international.org/10.0/#sec-isdetachedbuffer' }, IsExtensible: { url: 'https://262.ecma-international.org/10.0/#sec-isextensible-o' }, IsGenericDescriptor: { url: 'https://262.ecma-international.org/10.0/#sec-isgenericdescriptor' }, IsInTailPosition: { url: 'https://262.ecma-international.org/10.0/#sec-isintailposition' }, IsInteger: { url: 'https://262.ecma-international.org/10.0/#sec-isinteger' }, IsLabelledFunction: { url: 'https://262.ecma-international.org/10.0/#sec-islabelledfunction' }, IsPromise: { url: 'https://262.ecma-international.org/10.0/#sec-ispromise' }, IsPropertyKey: { url: 'https://262.ecma-international.org/10.0/#sec-ispropertykey' }, IsPropertyReference: { url: 'https://262.ecma-international.org/10.0/#sec-ispropertyreference' }, IsRegExp: { url: 'https://262.ecma-international.org/10.0/#sec-isregexp' }, IsSharedArrayBuffer: { url: 'https://262.ecma-international.org/10.0/#sec-issharedarraybuffer' }, IsStrictReference: { url: 'https://262.ecma-international.org/10.0/#sec-isstrictreference' }, IsStringPrefix: { url: 'https://262.ecma-international.org/10.0/#sec-isstringprefix' }, IsSuperReference: { url: 'https://262.ecma-international.org/10.0/#sec-issuperreference' }, IsUnresolvableReference: { url: 'https://262.ecma-international.org/10.0/#sec-isunresolvablereference' }, IsWordChar: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-iswordchar-abstract-operation' }, IterableToList: { url: 'https://262.ecma-international.org/10.0/#sec-iterabletolist' }, IteratorClose: { url: 'https://262.ecma-international.org/10.0/#sec-iteratorclose' }, IteratorComplete: { url: 'https://262.ecma-international.org/10.0/#sec-iteratorcomplete' }, IteratorNext: { url: 'https://262.ecma-international.org/10.0/#sec-iteratornext' }, IteratorStep: { url: 'https://262.ecma-international.org/10.0/#sec-iteratorstep' }, IteratorValue: { url: 'https://262.ecma-international.org/10.0/#sec-iteratorvalue' }, LeaveCriticalSection: { url: 'https://262.ecma-international.org/10.0/#sec-leavecriticalsection' }, LocalTime: { url: 'https://262.ecma-international.org/10.0/#sec-localtime' }, LoopContinues: { url: 'https://262.ecma-international.org/10.0/#sec-loopcontinues' }, MakeArgGetter: { url: 'https://262.ecma-international.org/10.0/#sec-makearggetter' }, MakeArgSetter: { url: 'https://262.ecma-international.org/10.0/#sec-makeargsetter' }, MakeClassConstructor: { url: 'https://262.ecma-international.org/10.0/#sec-makeclassconstructor' }, MakeConstructor: { url: 'https://262.ecma-international.org/10.0/#sec-makeconstructor' }, MakeDate: { url: 'https://262.ecma-international.org/10.0/#sec-makedate' }, MakeDay: { url: 'https://262.ecma-international.org/10.0/#sec-makeday' }, MakeMethod: { url: 'https://262.ecma-international.org/10.0/#sec-makemethod' }, MakeSuperPropertyReference: { url: 'https://262.ecma-international.org/10.0/#sec-makesuperpropertyreference' }, MakeTime: { url: 'https://262.ecma-international.org/10.0/#sec-maketime' }, max: { url: 'https://262.ecma-international.org/10.0/#eqn-max' }, 'memory-order': { url: 'https://262.ecma-international.org/10.0/#sec-memory-order' }, min: { url: 'https://262.ecma-international.org/10.0/#eqn-min' }, MinFromTime: { url: 'https://262.ecma-international.org/10.0/#eqn-MinFromTime' }, ModuleNamespaceCreate: { url: 'https://262.ecma-international.org/10.0/#sec-modulenamespacecreate' }, modulo: { url: 'https://262.ecma-international.org/10.0/#eqn-modulo' }, MonthFromTime: { url: 'https://262.ecma-international.org/10.0/#eqn-MonthFromTime' }, msFromTime: { url: 'https://262.ecma-international.org/10.0/#eqn-msFromTime' }, NewDeclarativeEnvironment: { url: 'https://262.ecma-international.org/10.0/#sec-newdeclarativeenvironment' }, NewFunctionEnvironment: { url: 'https://262.ecma-international.org/10.0/#sec-newfunctionenvironment' }, NewGlobalEnvironment: { url: 'https://262.ecma-international.org/10.0/#sec-newglobalenvironment' }, NewModuleEnvironment: { url: 'https://262.ecma-international.org/10.0/#sec-newmoduleenvironment' }, NewObjectEnvironment: { url: 'https://262.ecma-international.org/10.0/#sec-newobjectenvironment' }, NewPromiseCapability: { url: 'https://262.ecma-international.org/10.0/#sec-newpromisecapability' }, NormalCompletion: { url: 'https://262.ecma-international.org/10.0/#sec-normalcompletion' }, NotifyWaiter: { url: 'https://262.ecma-international.org/10.0/#sec-notifywaiter' }, NumberToRawBytes: { url: 'https://262.ecma-international.org/10.0/#sec-numbertorawbytes' }, NumberToString: { url: 'https://262.ecma-international.org/10.0/#sec-tostring-applied-to-the-number-type' }, ObjectCreate: { url: 'https://262.ecma-international.org/10.0/#sec-objectcreate' }, ObjectDefineProperties: { url: 'https://262.ecma-international.org/10.0/#sec-objectdefineproperties' }, OrdinaryCallBindThis: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarycallbindthis' }, OrdinaryCallEvaluateBody: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarycallevaluatebody' }, OrdinaryCreateFromConstructor: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarycreatefromconstructor' }, OrdinaryDefineOwnProperty: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarydefineownproperty' }, OrdinaryDelete: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarydelete' }, OrdinaryGet: { url: 'https://262.ecma-international.org/10.0/#sec-ordinaryget' }, OrdinaryGetOwnProperty: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarygetownproperty' }, OrdinaryGetPrototypeOf: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarygetprototypeof' }, OrdinaryHasInstance: { url: 'https://262.ecma-international.org/10.0/#sec-ordinaryhasinstance' }, OrdinaryHasProperty: { url: 'https://262.ecma-international.org/10.0/#sec-ordinaryhasproperty' }, OrdinaryIsExtensible: { url: 'https://262.ecma-international.org/10.0/#sec-ordinaryisextensible' }, OrdinaryOwnPropertyKeys: { url: 'https://262.ecma-international.org/10.0/#sec-ordinaryownpropertykeys' }, OrdinaryPreventExtensions: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarypreventextensions' }, OrdinarySet: { url: 'https://262.ecma-international.org/10.0/#sec-ordinaryset' }, OrdinarySetPrototypeOf: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarysetprototypeof' }, OrdinarySetWithOwnDescriptor: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarysetwithowndescriptor' }, OrdinaryToPrimitive: { url: 'https://262.ecma-international.org/10.0/#sec-ordinarytoprimitive' }, ParseModule: { url: 'https://262.ecma-international.org/10.0/#sec-parsemodule' }, ParseScript: { url: 'https://262.ecma-international.org/10.0/#sec-parse-script' }, PerformEval: { url: 'https://262.ecma-international.org/10.0/#sec-performeval' }, PerformPromiseAll: { url: 'https://262.ecma-international.org/10.0/#sec-performpromiseall' }, PerformPromiseRace: { url: 'https://262.ecma-international.org/10.0/#sec-performpromiserace' }, PerformPromiseThen: { url: 'https://262.ecma-international.org/10.0/#sec-performpromisethen' }, PrepareForOrdinaryCall: { url: 'https://262.ecma-international.org/10.0/#sec-prepareforordinarycall' }, PrepareForTailCall: { url: 'https://262.ecma-international.org/10.0/#sec-preparefortailcall' }, PromiseReactionJob: { url: 'https://262.ecma-international.org/10.0/#sec-promisereactionjob' }, PromiseResolve: { url: 'https://262.ecma-international.org/10.0/#sec-promise-resolve' }, PromiseResolveThenableJob: { url: 'https://262.ecma-international.org/10.0/#sec-promiseresolvethenablejob' }, ProxyCreate: { url: 'https://262.ecma-international.org/10.0/#sec-proxycreate' }, PutValue: { url: 'https://262.ecma-international.org/10.0/#sec-putvalue' }, QuoteJSONString: { url: 'https://262.ecma-international.org/10.0/#sec-quotejsonstring' }, RawBytesToNumber: { url: 'https://262.ecma-international.org/10.0/#sec-rawbytestonumber' }, 'reads-bytes-from': { url: 'https://262.ecma-international.org/10.0/#sec-reads-bytes-from' }, 'reads-from': { url: 'https://262.ecma-international.org/10.0/#sec-reads-from' }, RegExpAlloc: { url: 'https://262.ecma-international.org/10.0/#sec-regexpalloc' }, RegExpBuiltinExec: { url: 'https://262.ecma-international.org/10.0/#sec-regexpbuiltinexec' }, RegExpCreate: { url: 'https://262.ecma-international.org/10.0/#sec-regexpcreate' }, RegExpExec: { url: 'https://262.ecma-international.org/10.0/#sec-regexpexec' }, RegExpInitialize: { url: 'https://262.ecma-international.org/10.0/#sec-regexpinitialize' }, RejectPromise: { url: 'https://262.ecma-international.org/10.0/#sec-rejectpromise' }, RemoveWaiter: { url: 'https://262.ecma-international.org/10.0/#sec-removewaiter' }, RemoveWaiters: { url: 'https://262.ecma-international.org/10.0/#sec-removewaiters' }, RepeatMatcher: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-repeatmatcher-abstract-operation' }, RequireObjectCoercible: { url: 'https://262.ecma-international.org/10.0/#sec-requireobjectcoercible' }, ResolveBinding: { url: 'https://262.ecma-international.org/10.0/#sec-resolvebinding' }, ResolveThisBinding: { url: 'https://262.ecma-international.org/10.0/#sec-resolvethisbinding' }, ReturnIfAbrupt: { url: 'https://262.ecma-international.org/10.0/#sec-returnifabrupt' }, RunJobs: { url: 'https://262.ecma-international.org/10.0/#sec-runjobs' }, SameValue: { url: 'https://262.ecma-international.org/10.0/#sec-samevalue' }, SameValueNonNumber: { url: 'https://262.ecma-international.org/10.0/#sec-samevaluenonnumber' }, SameValueZero: { url: 'https://262.ecma-international.org/10.0/#sec-samevaluezero' }, ScriptEvaluation: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-scriptevaluation' }, ScriptEvaluationJob: { url: 'https://262.ecma-international.org/10.0/#sec-scriptevaluationjob' }, SecFromTime: { url: 'https://262.ecma-international.org/10.0/#eqn-SecFromTime' }, SerializeJSONArray: { url: 'https://262.ecma-international.org/10.0/#sec-serializejsonarray' }, SerializeJSONObject: { url: 'https://262.ecma-international.org/10.0/#sec-serializejsonobject' }, SerializeJSONProperty: { url: 'https://262.ecma-international.org/10.0/#sec-serializejsonproperty' }, Set: { url: 'https://262.ecma-international.org/10.0/#sec-set-o-p-v-throw' }, SetDefaultGlobalBindings: { url: 'https://262.ecma-international.org/10.0/#sec-setdefaultglobalbindings' }, SetFunctionLength: { url: 'https://262.ecma-international.org/10.0/#sec-setfunctionlength' }, SetFunctionName: { url: 'https://262.ecma-international.org/10.0/#sec-setfunctionname' }, SetImmutablePrototype: { url: 'https://262.ecma-international.org/10.0/#sec-set-immutable-prototype' }, SetIntegrityLevel: { url: 'https://262.ecma-international.org/10.0/#sec-setintegritylevel' }, SetRealmGlobalObject: { url: 'https://262.ecma-international.org/10.0/#sec-setrealmglobalobject' }, SetValueInBuffer: { url: 'https://262.ecma-international.org/10.0/#sec-setvalueinbuffer' }, SetViewValue: { url: 'https://262.ecma-international.org/10.0/#sec-setviewvalue' }, SharedDataBlockEventSet: { url: 'https://262.ecma-international.org/10.0/#sec-sharedatablockeventset' }, SortCompare: { url: 'https://262.ecma-international.org/10.0/#sec-sortcompare' }, SpeciesConstructor: { url: 'https://262.ecma-international.org/10.0/#sec-speciesconstructor' }, SplitMatch: { url: 'https://262.ecma-international.org/10.0/#sec-splitmatch' }, 'Strict Equality Comparison': { url: 'https://262.ecma-international.org/10.0/#sec-strict-equality-comparison' }, StringCreate: { url: 'https://262.ecma-international.org/10.0/#sec-stringcreate' }, StringGetOwnProperty: { url: 'https://262.ecma-international.org/10.0/#sec-stringgetownproperty' }, Suspend: { url: 'https://262.ecma-international.org/10.0/#sec-suspend' }, SymbolDescriptiveString: { url: 'https://262.ecma-international.org/10.0/#sec-symboldescriptivestring' }, SynchronizeEventSet: { url: 'https://262.ecma-international.org/10.0/#sec-synchronizeeventset' }, 'synchronizes-with': { url: 'https://262.ecma-international.org/10.0/#sec-synchronizes-with' }, TestIntegrityLevel: { url: 'https://262.ecma-international.org/10.0/#sec-testintegritylevel' }, thisBooleanValue: { url: 'https://262.ecma-international.org/10.0/#sec-thisbooleanvalue' }, thisNumberValue: { url: 'https://262.ecma-international.org/10.0/#sec-thisnumbervalue' }, thisStringValue: { url: 'https://262.ecma-international.org/10.0/#sec-thisstringvalue' }, thisSymbolValue: { url: 'https://262.ecma-international.org/10.0/#sec-thissymbolvalue' }, thisTimeValue: { url: 'https://262.ecma-international.org/10.0/#sec-thistimevalue' }, ThrowCompletion: { url: 'https://262.ecma-international.org/10.0/#sec-throwcompletion' }, TimeClip: { url: 'https://262.ecma-international.org/10.0/#sec-timeclip' }, TimeFromYear: { url: 'https://262.ecma-international.org/10.0/#eqn-TimeFromYear' }, TimeString: { url: 'https://262.ecma-international.org/10.0/#sec-timestring' }, TimeWithinDay: { url: 'https://262.ecma-international.org/10.0/#eqn-TimeWithinDay' }, TimeZoneString: { url: 'https://262.ecma-international.org/10.0/#sec-timezoneestring' }, ToBoolean: { url: 'https://262.ecma-international.org/10.0/#sec-toboolean' }, ToDateString: { url: 'https://262.ecma-international.org/10.0/#sec-todatestring' }, ToIndex: { url: 'https://262.ecma-international.org/10.0/#sec-toindex' }, ToInt16: { url: 'https://262.ecma-international.org/10.0/#sec-toint16' }, ToInt32: { url: 'https://262.ecma-international.org/10.0/#sec-toint32' }, ToInt8: { url: 'https://262.ecma-international.org/10.0/#sec-toint8' }, ToInteger: { url: 'https://262.ecma-international.org/10.0/#sec-tointeger' }, ToLength: { url: 'https://262.ecma-international.org/10.0/#sec-tolength' }, ToNumber: { url: 'https://262.ecma-international.org/10.0/#sec-tonumber' }, ToObject: { url: 'https://262.ecma-international.org/10.0/#sec-toobject' }, TopLevelModuleEvaluationJob: { url: 'https://262.ecma-international.org/10.0/#sec-toplevelmoduleevaluationjob' }, ToPrimitive: { url: 'https://262.ecma-international.org/10.0/#sec-toprimitive' }, ToPropertyDescriptor: { url: 'https://262.ecma-international.org/10.0/#sec-topropertydescriptor' }, ToPropertyKey: { url: 'https://262.ecma-international.org/10.0/#sec-topropertykey' }, ToString: { url: 'https://262.ecma-international.org/10.0/#sec-tostring' }, ToUint16: { url: 'https://262.ecma-international.org/10.0/#sec-touint16' }, ToUint32: { url: 'https://262.ecma-international.org/10.0/#sec-touint32' }, ToUint8: { url: 'https://262.ecma-international.org/10.0/#sec-touint8' }, ToUint8Clamp: { url: 'https://262.ecma-international.org/10.0/#sec-touint8clamp' }, TriggerPromiseReactions: { url: 'https://262.ecma-international.org/10.0/#sec-triggerpromisereactions' }, TrimString: { url: 'https://262.ecma-international.org/10.0/#sec-trimstring' }, Type: { url: 'https://262.ecma-international.org/10.0/#sec-ecmascript-data-types-and-values' }, TypedArrayCreate: { url: 'https://262.ecma-international.org/10.0/#typedarray-create' }, TypedArraySpeciesCreate: { url: 'https://262.ecma-international.org/10.0/#typedarray-species-create' }, UnicodeEscape: { url: 'https://262.ecma-international.org/10.0/#sec-unicodeescape' }, UnicodeMatchProperty: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-unicodematchproperty-p' }, UnicodeMatchPropertyValue: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-unicodematchpropertyvalue-p-v' }, UpdateEmpty: { url: 'https://262.ecma-international.org/10.0/#sec-updateempty' }, UTC: { url: 'https://262.ecma-international.org/10.0/#sec-utc-t' }, UTF16Decode: { url: 'https://262.ecma-international.org/10.0/#sec-utf16decode' }, UTF16Encoding: { url: 'https://262.ecma-international.org/10.0/#sec-utf16encoding' }, ValidateAndApplyPropertyDescriptor: { url: 'https://262.ecma-international.org/10.0/#sec-validateandapplypropertydescriptor' }, ValidateAtomicAccess: { url: 'https://262.ecma-international.org/10.0/#sec-validateatomicaccess' }, ValidateSharedIntegerTypedArray: { url: 'https://262.ecma-international.org/10.0/#sec-validatesharedintegertypedarray' }, ValidateTypedArray: { url: 'https://262.ecma-international.org/10.0/#sec-validatetypedarray' }, ValueOfReadEvent: { url: 'https://262.ecma-international.org/10.0/#sec-valueofreadevent' }, WeekDay: { url: 'https://262.ecma-international.org/10.0/#sec-week-day' }, WordCharacters: { url: 'https://262.ecma-international.org/10.0/#sec-runtime-semantics-wordcharacters-abstract-operation' }, YearFromTime: { url: 'https://262.ecma-international.org/10.0/#eqn-YearFromTime' } }; es-abstract-1.20.4/operations/2020.js000066400000000000000000001211251431761430200171150ustar00rootroot00000000000000'use strict'; module.exports = { abs: { url: 'https://262.ecma-international.org/11.0/#eqn-abs' }, 'Abstract Equality Comparison': { url: 'https://262.ecma-international.org/11.0/#sec-abstract-equality-comparison' }, 'Abstract Relational Comparison': { url: 'https://262.ecma-international.org/11.0/#sec-abstract-relational-comparison' }, AddEntriesFromIterable: { url: 'https://262.ecma-international.org/11.0/#sec-add-entries-from-iterable' }, AddRestrictedFunctionProperties: { url: 'https://262.ecma-international.org/11.0/#sec-addrestrictedfunctionproperties' }, AddWaiter: { url: 'https://262.ecma-international.org/11.0/#sec-addwaiter' }, AdvanceStringIndex: { url: 'https://262.ecma-international.org/11.0/#sec-advancestringindex' }, 'agent-order': { url: 'https://262.ecma-international.org/11.0/#sec-agent-order' }, AgentCanSuspend: { url: 'https://262.ecma-international.org/11.0/#sec-agentcansuspend' }, AgentSignifier: { url: 'https://262.ecma-international.org/11.0/#sec-agentsignifier' }, AllocateArrayBuffer: { url: 'https://262.ecma-international.org/11.0/#sec-allocatearraybuffer' }, AllocateSharedArrayBuffer: { url: 'https://262.ecma-international.org/11.0/#sec-allocatesharedarraybuffer' }, AllocateTypedArray: { url: 'https://262.ecma-international.org/11.0/#sec-allocatetypedarray' }, AllocateTypedArrayBuffer: { url: 'https://262.ecma-international.org/11.0/#sec-allocatetypedarraybuffer' }, ArrayCreate: { url: 'https://262.ecma-international.org/11.0/#sec-arraycreate' }, ArraySetLength: { url: 'https://262.ecma-international.org/11.0/#sec-arraysetlength' }, ArraySpeciesCreate: { url: 'https://262.ecma-international.org/11.0/#sec-arrayspeciescreate' }, AsyncFromSyncIteratorContinuation: { url: 'https://262.ecma-international.org/11.0/#sec-asyncfromsynciteratorcontinuation' }, AsyncFunctionStart: { url: 'https://262.ecma-international.org/11.0/#sec-async-functions-abstract-operations-async-function-start' }, AsyncGeneratorEnqueue: { url: 'https://262.ecma-international.org/11.0/#sec-asyncgeneratorenqueue' }, AsyncGeneratorReject: { url: 'https://262.ecma-international.org/11.0/#sec-asyncgeneratorreject' }, AsyncGeneratorResolve: { url: 'https://262.ecma-international.org/11.0/#sec-asyncgeneratorresolve' }, AsyncGeneratorResumeNext: { url: 'https://262.ecma-international.org/11.0/#sec-asyncgeneratorresumenext' }, AsyncGeneratorStart: { url: 'https://262.ecma-international.org/11.0/#sec-asyncgeneratorstart' }, AsyncGeneratorYield: { url: 'https://262.ecma-international.org/11.0/#sec-asyncgeneratoryield' }, AsyncIteratorClose: { url: 'https://262.ecma-international.org/11.0/#sec-asynciteratorclose' }, AtomicLoad: { url: 'https://262.ecma-international.org/11.0/#sec-atomicload' }, AtomicReadModifyWrite: { url: 'https://262.ecma-international.org/11.0/#sec-atomicreadmodifywrite' }, Await: { url: 'https://262.ecma-international.org/11.0/#await' }, BackreferenceMatcher: { url: 'https://262.ecma-international.org/11.0/#sec-backreference-matcher' }, 'BigInt::add': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-add' }, 'BigInt::bitwiseAND': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseAND' }, 'BigInt::bitwiseNOT': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseNOT' }, 'BigInt::bitwiseOR': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseOR' }, 'BigInt::bitwiseXOR': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseXOR' }, 'BigInt::divide': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-divide' }, 'BigInt::equal': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-equal' }, 'BigInt::exponentiate': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-exponentiate' }, 'BigInt::leftShift': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-leftShift' }, 'BigInt::lessThan': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-lessThan' }, 'BigInt::multiply': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-multiply' }, 'BigInt::remainder': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-remainder' }, 'BigInt::sameValue': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValue' }, 'BigInt::sameValueZero': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValueZero' }, 'BigInt::signedRightShift': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-signedRightShift' }, 'BigInt::subtract': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-subtract' }, 'BigInt::toString': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-tostring' }, 'BigInt::unaryMinus': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unaryMinus' }, 'BigInt::unsignedRightShift': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unsignedRightShift' }, BigIntBitwiseOp: { url: 'https://262.ecma-international.org/11.0/#sec-bigintbitwiseop' }, BinaryAnd: { url: 'https://262.ecma-international.org/11.0/#sec-binaryand' }, BinaryOr: { url: 'https://262.ecma-international.org/11.0/#sec-binaryor' }, BinaryXor: { url: 'https://262.ecma-international.org/11.0/#sec-binaryxor' }, BlockDeclarationInstantiation: { url: 'https://262.ecma-international.org/11.0/#sec-blockdeclarationinstantiation' }, BoundFunctionCreate: { url: 'https://262.ecma-international.org/11.0/#sec-boundfunctioncreate' }, Call: { url: 'https://262.ecma-international.org/11.0/#sec-call' }, Canonicalize: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-canonicalize-ch' }, CanonicalNumericIndexString: { url: 'https://262.ecma-international.org/11.0/#sec-canonicalnumericindexstring' }, CaseClauseIsSelected: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-caseclauseisselected' }, CharacterRange: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-characterrange-abstract-operation' }, CharacterRangeOrUnion: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-characterrangeorunion-abstract-operation' }, CharacterSetMatcher: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-charactersetmatcher-abstract-operation' }, CloneArrayBuffer: { url: 'https://262.ecma-international.org/11.0/#sec-clonearraybuffer' }, CodePointAt: { url: 'https://262.ecma-international.org/11.0/#sec-codepointat' }, CompletePropertyDescriptor: { url: 'https://262.ecma-international.org/11.0/#sec-completepropertydescriptor' }, Completion: { url: 'https://262.ecma-international.org/11.0/#sec-completion-record-specification-type' }, ComposeWriteEventBytes: { url: 'https://262.ecma-international.org/11.0/#sec-composewriteeventbytes' }, Construct: { url: 'https://262.ecma-international.org/11.0/#sec-construct' }, CopyDataBlockBytes: { url: 'https://262.ecma-international.org/11.0/#sec-copydatablockbytes' }, CopyDataProperties: { url: 'https://262.ecma-international.org/11.0/#sec-copydataproperties' }, CreateArrayFromList: { url: 'https://262.ecma-international.org/11.0/#sec-createarrayfromlist' }, CreateArrayIterator: { url: 'https://262.ecma-international.org/11.0/#sec-createarrayiterator' }, CreateAsyncFromSyncIterator: { url: 'https://262.ecma-international.org/11.0/#sec-createasyncfromsynciterator' }, CreateBuiltinFunction: { url: 'https://262.ecma-international.org/11.0/#sec-createbuiltinfunction' }, CreateByteDataBlock: { url: 'https://262.ecma-international.org/11.0/#sec-createbytedatablock' }, CreateDataProperty: { url: 'https://262.ecma-international.org/11.0/#sec-createdataproperty' }, CreateDataPropertyOrThrow: { url: 'https://262.ecma-international.org/11.0/#sec-createdatapropertyorthrow' }, CreateDynamicFunction: { url: 'https://262.ecma-international.org/11.0/#sec-createdynamicfunction' }, CreateForInIterator: { url: 'https://262.ecma-international.org/11.0/#sec-createforiniterator' }, CreateHTML: { url: 'https://262.ecma-international.org/11.0/#sec-createhtml' }, CreateIntrinsics: { url: 'https://262.ecma-international.org/11.0/#sec-createintrinsics' }, CreateIterResultObject: { url: 'https://262.ecma-international.org/11.0/#sec-createiterresultobject' }, CreateListFromArrayLike: { url: 'https://262.ecma-international.org/11.0/#sec-createlistfromarraylike' }, CreateListIteratorRecord: { url: 'https://262.ecma-international.org/11.0/#sec-createlistiteratorRecord' }, CreateMapIterator: { url: 'https://262.ecma-international.org/11.0/#sec-createmapiterator' }, CreateMappedArgumentsObject: { url: 'https://262.ecma-international.org/11.0/#sec-createmappedargumentsobject' }, CreateMethodProperty: { url: 'https://262.ecma-international.org/11.0/#sec-createmethodproperty' }, CreatePerIterationEnvironment: { url: 'https://262.ecma-international.org/11.0/#sec-createperiterationenvironment' }, CreateRealm: { url: 'https://262.ecma-international.org/11.0/#sec-createrealm' }, CreateRegExpStringIterator: { url: 'https://262.ecma-international.org/11.0/#sec-createregexpstringiterator' }, CreateResolvingFunctions: { url: 'https://262.ecma-international.org/11.0/#sec-createresolvingfunctions' }, CreateSetIterator: { url: 'https://262.ecma-international.org/11.0/#sec-createsetiterator' }, CreateSharedByteDataBlock: { url: 'https://262.ecma-international.org/11.0/#sec-createsharedbytedatablock' }, CreateStringIterator: { url: 'https://262.ecma-international.org/11.0/#sec-createstringiterator' }, CreateUnmappedArgumentsObject: { url: 'https://262.ecma-international.org/11.0/#sec-createunmappedargumentsobject' }, DateFromTime: { url: 'https://262.ecma-international.org/11.0/#sec-date-number' }, DateString: { url: 'https://262.ecma-international.org/11.0/#sec-datestring' }, Day: { url: 'https://262.ecma-international.org/11.0/#eqn-Day' }, DayFromYear: { url: 'https://262.ecma-international.org/11.0/#eqn-DaysFromYear' }, DaysInYear: { url: 'https://262.ecma-international.org/11.0/#eqn-DaysInYear' }, DayWithinYear: { url: 'https://262.ecma-international.org/11.0/#eqn-DayWithinYear' }, Decode: { url: 'https://262.ecma-international.org/11.0/#sec-decode' }, DefinePropertyOrThrow: { url: 'https://262.ecma-international.org/11.0/#sec-definepropertyorthrow' }, DeletePropertyOrThrow: { url: 'https://262.ecma-international.org/11.0/#sec-deletepropertyorthrow' }, DetachArrayBuffer: { url: 'https://262.ecma-international.org/11.0/#sec-detacharraybuffer' }, Encode: { url: 'https://262.ecma-international.org/11.0/#sec-encode' }, EnterCriticalSection: { url: 'https://262.ecma-international.org/11.0/#sec-entercriticalsection' }, EnumerableOwnPropertyNames: { url: 'https://262.ecma-international.org/11.0/#sec-enumerableownpropertynames' }, EnumerateObjectProperties: { url: 'https://262.ecma-international.org/11.0/#sec-enumerate-object-properties' }, EscapeRegExpPattern: { url: 'https://262.ecma-international.org/11.0/#sec-escaperegexppattern' }, EvalDeclarationInstantiation: { url: 'https://262.ecma-international.org/11.0/#sec-evaldeclarationinstantiation' }, EvaluateCall: { url: 'https://262.ecma-international.org/11.0/#sec-evaluatecall' }, EvaluateNew: { url: 'https://262.ecma-international.org/11.0/#sec-evaluatenew' }, EvaluatePropertyAccessWithExpressionKey: { url: 'https://262.ecma-international.org/11.0/#sec-evaluate-property-access-with-expression-key' }, EvaluatePropertyAccessWithIdentifierKey: { url: 'https://262.ecma-international.org/11.0/#sec-evaluate-property-access-with-identifier-key' }, EventSet: { url: 'https://262.ecma-international.org/11.0/#sec-event-set' }, ExecuteModule: { url: 'https://262.ecma-international.org/11.0/#sec-source-text-module-record-execute-module' }, FinishDynamicImport: { url: 'https://262.ecma-international.org/11.0/#sec-finishdynamicimport' }, FlattenIntoArray: { url: 'https://262.ecma-international.org/11.0/#sec-flattenintoarray' }, floor: { url: 'https://262.ecma-international.org/11.0/#eqn-floor' }, ForBodyEvaluation: { url: 'https://262.ecma-international.org/11.0/#sec-forbodyevaluation' }, 'ForIn/OfBodyEvaluation': { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset' }, 'ForIn/OfHeadEvaluation': { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-forinofheadevaluation' }, FromPropertyDescriptor: { url: 'https://262.ecma-international.org/11.0/#sec-frompropertydescriptor' }, FulfillPromise: { url: 'https://262.ecma-international.org/11.0/#sec-fulfillpromise' }, FunctionDeclarationInstantiation: { url: 'https://262.ecma-international.org/11.0/#sec-functiondeclarationinstantiation' }, GeneratorResume: { url: 'https://262.ecma-international.org/11.0/#sec-generatorresume' }, GeneratorResumeAbrupt: { url: 'https://262.ecma-international.org/11.0/#sec-generatorresumeabrupt' }, GeneratorStart: { url: 'https://262.ecma-international.org/11.0/#sec-generatorstart' }, GeneratorValidate: { url: 'https://262.ecma-international.org/11.0/#sec-generatorvalidate' }, GeneratorYield: { url: 'https://262.ecma-international.org/11.0/#sec-generatoryield' }, Get: { url: 'https://262.ecma-international.org/11.0/#sec-get-o-p' }, GetActiveScriptOrModule: { url: 'https://262.ecma-international.org/11.0/#sec-getactivescriptormodule' }, GetBase: { url: 'https://262.ecma-international.org/11.0/#sec-getbase' }, GetFunctionRealm: { url: 'https://262.ecma-international.org/11.0/#sec-getfunctionrealm' }, GetGeneratorKind: { url: 'https://262.ecma-international.org/11.0/#sec-getgeneratorkind' }, GetGlobalObject: { url: 'https://262.ecma-international.org/11.0/#sec-getglobalobject' }, GetIdentifierReference: { url: 'https://262.ecma-international.org/11.0/#sec-getidentifierreference' }, GetIterator: { url: 'https://262.ecma-international.org/11.0/#sec-getiterator' }, GetMethod: { url: 'https://262.ecma-international.org/11.0/#sec-getmethod' }, GetModifySetValueInBuffer: { url: 'https://262.ecma-international.org/11.0/#sec-getmodifysetvalueinbuffer' }, GetModuleNamespace: { url: 'https://262.ecma-international.org/11.0/#sec-getmodulenamespace' }, GetNewTarget: { url: 'https://262.ecma-international.org/11.0/#sec-getnewtarget' }, GetOwnPropertyKeys: { url: 'https://262.ecma-international.org/11.0/#sec-getownpropertykeys' }, GetPrototypeFromConstructor: { url: 'https://262.ecma-international.org/11.0/#sec-getprototypefromconstructor' }, GetReferencedName: { url: 'https://262.ecma-international.org/11.0/#sec-getreferencedname' }, GetSubstitution: { url: 'https://262.ecma-international.org/11.0/#sec-getsubstitution' }, GetSuperConstructor: { url: 'https://262.ecma-international.org/11.0/#sec-getsuperconstructor' }, GetTemplateObject: { url: 'https://262.ecma-international.org/11.0/#sec-gettemplateobject' }, GetThisEnvironment: { url: 'https://262.ecma-international.org/11.0/#sec-getthisenvironment' }, GetThisValue: { url: 'https://262.ecma-international.org/11.0/#sec-getthisvalue' }, GetV: { url: 'https://262.ecma-international.org/11.0/#sec-getv' }, GetValue: { url: 'https://262.ecma-international.org/11.0/#sec-getvalue' }, GetValueFromBuffer: { url: 'https://262.ecma-international.org/11.0/#sec-getvaluefrombuffer' }, GetViewValue: { url: 'https://262.ecma-international.org/11.0/#sec-getviewvalue' }, GetWaiterList: { url: 'https://262.ecma-international.org/11.0/#sec-getwaiterlist' }, GlobalDeclarationInstantiation: { url: 'https://262.ecma-international.org/11.0/#sec-globaldeclarationinstantiation' }, 'happens-before': { url: 'https://262.ecma-international.org/11.0/#sec-happens-before' }, HasOwnProperty: { url: 'https://262.ecma-international.org/11.0/#sec-hasownproperty' }, HasPrimitiveBase: { url: 'https://262.ecma-international.org/11.0/#sec-hasprimitivebase' }, HasProperty: { url: 'https://262.ecma-international.org/11.0/#sec-hasproperty' }, 'host-synchronizes-with': { url: 'https://262.ecma-international.org/11.0/#sec-host-synchronizes-with' }, HostEnqueuePromiseJob: { url: 'https://262.ecma-international.org/11.0/#sec-hostenqueuepromisejob' }, HostEnsureCanCompileStrings: { url: 'https://262.ecma-international.org/11.0/#sec-hostensurecancompilestrings' }, HostEventSet: { url: 'https://262.ecma-international.org/11.0/#sec-hosteventset' }, HostFinalizeImportMeta: { url: 'https://262.ecma-international.org/11.0/#sec-hostfinalizeimportmeta' }, HostGetImportMetaProperties: { url: 'https://262.ecma-international.org/11.0/#sec-hostgetimportmetaproperties' }, HostImportModuleDynamically: { url: 'https://262.ecma-international.org/11.0/#sec-hostimportmoduledynamically' }, HostPromiseRejectionTracker: { url: 'https://262.ecma-international.org/11.0/#sec-host-promise-rejection-tracker' }, HostResolveImportedModule: { url: 'https://262.ecma-international.org/11.0/#sec-hostresolveimportedmodule' }, HourFromTime: { url: 'https://262.ecma-international.org/11.0/#eqn-HourFromTime' }, IfAbruptRejectPromise: { url: 'https://262.ecma-international.org/11.0/#sec-ifabruptrejectpromise' }, ImportedLocalNames: { url: 'https://262.ecma-international.org/11.0/#sec-importedlocalnames' }, InitializeBoundName: { url: 'https://262.ecma-international.org/11.0/#sec-initializeboundname' }, InitializeEnvironment: { url: 'https://262.ecma-international.org/11.0/#sec-source-text-module-record-initialize-environment' }, InitializeHostDefinedRealm: { url: 'https://262.ecma-international.org/11.0/#sec-initializehostdefinedrealm' }, InitializeReferencedBinding: { url: 'https://262.ecma-international.org/11.0/#sec-initializereferencedbinding' }, InLeapYear: { url: 'https://262.ecma-international.org/11.0/#eqn-InLeapYear' }, InnerModuleEvaluation: { url: 'https://262.ecma-international.org/11.0/#sec-innermoduleevaluation' }, InnerModuleLinking: { url: 'https://262.ecma-international.org/11.0/#sec-InnerModuleLinking' }, InstanceofOperator: { url: 'https://262.ecma-international.org/11.0/#sec-instanceofoperator' }, IntegerIndexedElementGet: { url: 'https://262.ecma-international.org/11.0/#sec-integerindexedelementget' }, IntegerIndexedElementSet: { url: 'https://262.ecma-international.org/11.0/#sec-integerindexedelementset' }, IntegerIndexedObjectCreate: { url: 'https://262.ecma-international.org/11.0/#sec-integerindexedobjectcreate' }, InternalizeJSONProperty: { url: 'https://262.ecma-international.org/11.0/#sec-internalizejsonproperty' }, Invoke: { url: 'https://262.ecma-international.org/11.0/#sec-invoke' }, IsAccessorDescriptor: { url: 'https://262.ecma-international.org/11.0/#sec-isaccessordescriptor' }, IsAnonymousFunctionDefinition: { url: 'https://262.ecma-international.org/11.0/#sec-isanonymousfunctiondefinition' }, IsArray: { url: 'https://262.ecma-international.org/11.0/#sec-isarray' }, IsBigIntElementType: { url: 'https://262.ecma-international.org/11.0/#sec-isbigintelementtype' }, IsCallable: { url: 'https://262.ecma-international.org/11.0/#sec-iscallable' }, IsCompatiblePropertyDescriptor: { url: 'https://262.ecma-international.org/11.0/#sec-iscompatiblepropertydescriptor' }, IsConcatSpreadable: { url: 'https://262.ecma-international.org/11.0/#sec-isconcatspreadable' }, IsConstructor: { url: 'https://262.ecma-international.org/11.0/#sec-isconstructor' }, IsDataDescriptor: { url: 'https://262.ecma-international.org/11.0/#sec-isdatadescriptor' }, IsDetachedBuffer: { url: 'https://262.ecma-international.org/11.0/#sec-isdetachedbuffer' }, IsExtensible: { url: 'https://262.ecma-international.org/11.0/#sec-isextensible-o' }, IsGenericDescriptor: { url: 'https://262.ecma-international.org/11.0/#sec-isgenericdescriptor' }, IsInTailPosition: { url: 'https://262.ecma-international.org/11.0/#sec-isintailposition' }, IsInteger: { url: 'https://262.ecma-international.org/11.0/#sec-isinteger' }, IsLabelledFunction: { url: 'https://262.ecma-international.org/11.0/#sec-islabelledfunction' }, IsNonNegativeInteger: { url: 'https://262.ecma-international.org/11.0/#sec-isnonnegativeinteger' }, IsNoTearConfiguration: { url: 'https://262.ecma-international.org/11.0/#sec-isnotearconfiguration' }, IsPromise: { url: 'https://262.ecma-international.org/11.0/#sec-ispromise' }, IsPropertyKey: { url: 'https://262.ecma-international.org/11.0/#sec-ispropertykey' }, IsPropertyReference: { url: 'https://262.ecma-international.org/11.0/#sec-ispropertyreference' }, IsRegExp: { url: 'https://262.ecma-international.org/11.0/#sec-isregexp' }, IsSharedArrayBuffer: { url: 'https://262.ecma-international.org/11.0/#sec-issharedarraybuffer' }, IsStrictReference: { url: 'https://262.ecma-international.org/11.0/#sec-isstrictreference' }, IsStringPrefix: { url: 'https://262.ecma-international.org/11.0/#sec-isstringprefix' }, IsSuperReference: { url: 'https://262.ecma-international.org/11.0/#sec-issuperreference' }, IsUnclampedIntegerElementType: { url: 'https://262.ecma-international.org/11.0/#sec-isunclampedintegerelementtype' }, IsUnresolvableReference: { url: 'https://262.ecma-international.org/11.0/#sec-isunresolvablereference' }, IsUnsignedElementType: { url: 'https://262.ecma-international.org/11.0/#sec-isunsignedelementtype' }, IsValidIntegerIndex: { url: 'https://262.ecma-international.org/11.0/#sec-isvalidintegerindex' }, IsValidRegularExpressionLiteral: { url: 'https://262.ecma-international.org/11.0/#sec-isvalidregularexpressionliteral' }, IsWordChar: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-iswordchar-abstract-operation' }, IterableToList: { url: 'https://262.ecma-international.org/11.0/#sec-iterabletolist' }, IteratorClose: { url: 'https://262.ecma-international.org/11.0/#sec-iteratorclose' }, IteratorComplete: { url: 'https://262.ecma-international.org/11.0/#sec-iteratorcomplete' }, IteratorNext: { url: 'https://262.ecma-international.org/11.0/#sec-iteratornext' }, IteratorStep: { url: 'https://262.ecma-international.org/11.0/#sec-iteratorstep' }, IteratorValue: { url: 'https://262.ecma-international.org/11.0/#sec-iteratorvalue' }, LeaveCriticalSection: { url: 'https://262.ecma-international.org/11.0/#sec-leavecriticalsection' }, LengthOfArrayLike: { url: 'https://262.ecma-international.org/11.0/#sec-lengthofarraylike' }, LocalTime: { url: 'https://262.ecma-international.org/11.0/#sec-localtime' }, LocalTZA: { url: 'https://262.ecma-international.org/11.0/#sec-local-time-zone-adjustment' }, LoopContinues: { url: 'https://262.ecma-international.org/11.0/#sec-loopcontinues' }, MakeArgGetter: { url: 'https://262.ecma-international.org/11.0/#sec-makearggetter' }, MakeArgSetter: { url: 'https://262.ecma-international.org/11.0/#sec-makeargsetter' }, MakeBasicObject: { url: 'https://262.ecma-international.org/11.0/#sec-makebasicobject' }, MakeClassConstructor: { url: 'https://262.ecma-international.org/11.0/#sec-makeclassconstructor' }, MakeConstructor: { url: 'https://262.ecma-international.org/11.0/#sec-makeconstructor' }, MakeDate: { url: 'https://262.ecma-international.org/11.0/#sec-makedate' }, MakeDay: { url: 'https://262.ecma-international.org/11.0/#sec-makeday' }, MakeMethod: { url: 'https://262.ecma-international.org/11.0/#sec-makemethod' }, MakeSuperPropertyReference: { url: 'https://262.ecma-international.org/11.0/#sec-makesuperpropertyreference' }, MakeTime: { url: 'https://262.ecma-international.org/11.0/#sec-maketime' }, max: { url: 'https://262.ecma-international.org/11.0/#eqn-max' }, 'memory-order': { url: 'https://262.ecma-international.org/11.0/#sec-memory-order' }, min: { url: 'https://262.ecma-international.org/11.0/#eqn-min' }, MinFromTime: { url: 'https://262.ecma-international.org/11.0/#eqn-MinFromTime' }, ModuleNamespaceCreate: { url: 'https://262.ecma-international.org/11.0/#sec-modulenamespacecreate' }, modulo: { url: 'https://262.ecma-international.org/11.0/#eqn-modulo' }, MonthFromTime: { url: 'https://262.ecma-international.org/11.0/#eqn-MonthFromTime' }, msFromTime: { url: 'https://262.ecma-international.org/11.0/#eqn-msFromTime' }, NewDeclarativeEnvironment: { url: 'https://262.ecma-international.org/11.0/#sec-newdeclarativeenvironment' }, NewFunctionEnvironment: { url: 'https://262.ecma-international.org/11.0/#sec-newfunctionenvironment' }, NewGlobalEnvironment: { url: 'https://262.ecma-international.org/11.0/#sec-newglobalenvironment' }, NewModuleEnvironment: { url: 'https://262.ecma-international.org/11.0/#sec-newmoduleenvironment' }, NewObjectEnvironment: { url: 'https://262.ecma-international.org/11.0/#sec-newobjectenvironment' }, NewPromiseCapability: { url: 'https://262.ecma-international.org/11.0/#sec-newpromisecapability' }, NewPromiseReactionJob: { url: 'https://262.ecma-international.org/11.0/#sec-newpromisereactionjob' }, NewPromiseResolveThenableJob: { url: 'https://262.ecma-international.org/11.0/#sec-newpromiseresolvethenablejob' }, NormalCompletion: { url: 'https://262.ecma-international.org/11.0/#sec-normalcompletion' }, NotifyWaiter: { url: 'https://262.ecma-international.org/11.0/#sec-notifywaiter' }, 'Number::add': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-add' }, 'Number::bitwiseAND': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseAND' }, 'Number::bitwiseNOT': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseNOT' }, 'Number::bitwiseOR': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseOR' }, 'Number::bitwiseXOR': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseXOR' }, 'Number::divide': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-divide' }, 'Number::equal': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-equal' }, 'Number::exponentiate': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-exponentiate' }, 'Number::leftShift': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-leftShift' }, 'Number::lessThan': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-lessThan' }, 'Number::multiply': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-multiply' }, 'Number::remainder': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-remainder' }, 'Number::sameValue': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValue' }, 'Number::sameValueZero': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValueZero' }, 'Number::signedRightShift': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-signedRightShift' }, 'Number::subtract': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-subtract' }, 'Number::toString': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-tostring' }, 'Number::unaryMinus': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-unaryMinus' }, 'Number::unsignedRightShift': { url: 'https://262.ecma-international.org/11.0/#sec-numeric-types-number-unsignedRightShift' }, NumberBitwiseOp: { url: 'https://262.ecma-international.org/11.0/#sec-numberbitwiseop' }, NumberToBigInt: { url: 'https://262.ecma-international.org/11.0/#sec-numbertobigint' }, NumericToRawBytes: { url: 'https://262.ecma-international.org/11.0/#sec-numerictorawbytes' }, ObjectDefineProperties: { url: 'https://262.ecma-international.org/11.0/#sec-objectdefineproperties' }, OrdinaryCallBindThis: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarycallbindthis' }, OrdinaryCallEvaluateBody: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarycallevaluatebody' }, OrdinaryCreateFromConstructor: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarycreatefromconstructor' }, OrdinaryDefineOwnProperty: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarydefineownproperty' }, OrdinaryDelete: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarydelete' }, OrdinaryFunctionCreate: { url: 'https://262.ecma-international.org/11.0/#sec-ordinaryfunctioncreate' }, OrdinaryGet: { url: 'https://262.ecma-international.org/11.0/#sec-ordinaryget' }, OrdinaryGetOwnProperty: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarygetownproperty' }, OrdinaryGetPrototypeOf: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarygetprototypeof' }, OrdinaryHasInstance: { url: 'https://262.ecma-international.org/11.0/#sec-ordinaryhasinstance' }, OrdinaryHasProperty: { url: 'https://262.ecma-international.org/11.0/#sec-ordinaryhasproperty' }, OrdinaryIsExtensible: { url: 'https://262.ecma-international.org/11.0/#sec-ordinaryisextensible' }, OrdinaryObjectCreate: { url: 'https://262.ecma-international.org/11.0/#sec-ordinaryobjectcreate' }, OrdinaryOwnPropertyKeys: { url: 'https://262.ecma-international.org/11.0/#sec-ordinaryownpropertykeys' }, OrdinaryPreventExtensions: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarypreventextensions' }, OrdinarySet: { url: 'https://262.ecma-international.org/11.0/#sec-ordinaryset' }, OrdinarySetPrototypeOf: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarysetprototypeof' }, OrdinarySetWithOwnDescriptor: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarysetwithowndescriptor' }, OrdinaryToPrimitive: { url: 'https://262.ecma-international.org/11.0/#sec-ordinarytoprimitive' }, ParseModule: { url: 'https://262.ecma-international.org/11.0/#sec-parsemodule' }, ParseScript: { url: 'https://262.ecma-international.org/11.0/#sec-parse-script' }, PerformEval: { url: 'https://262.ecma-international.org/11.0/#sec-performeval' }, PerformPromiseAll: { url: 'https://262.ecma-international.org/11.0/#sec-performpromiseall' }, PerformPromiseAllSettled: { url: 'https://262.ecma-international.org/11.0/#sec-performpromiseallsettled' }, PerformPromiseRace: { url: 'https://262.ecma-international.org/11.0/#sec-performpromiserace' }, PerformPromiseThen: { url: 'https://262.ecma-international.org/11.0/#sec-performpromisethen' }, PrepareForOrdinaryCall: { url: 'https://262.ecma-international.org/11.0/#sec-prepareforordinarycall' }, PrepareForTailCall: { url: 'https://262.ecma-international.org/11.0/#sec-preparefortailcall' }, PromiseResolve: { url: 'https://262.ecma-international.org/11.0/#sec-promise-resolve' }, ProxyCreate: { url: 'https://262.ecma-international.org/11.0/#sec-proxycreate' }, PutValue: { url: 'https://262.ecma-international.org/11.0/#sec-putvalue' }, QuoteJSONString: { url: 'https://262.ecma-international.org/11.0/#sec-quotejsonstring' }, RawBytesToNumeric: { url: 'https://262.ecma-international.org/11.0/#sec-rawbytestonumeric' }, 'reads-bytes-from': { url: 'https://262.ecma-international.org/11.0/#sec-reads-bytes-from' }, 'reads-from': { url: 'https://262.ecma-international.org/11.0/#sec-reads-from' }, RegExpAlloc: { url: 'https://262.ecma-international.org/11.0/#sec-regexpalloc' }, RegExpBuiltinExec: { url: 'https://262.ecma-international.org/11.0/#sec-regexpbuiltinexec' }, RegExpCreate: { url: 'https://262.ecma-international.org/11.0/#sec-regexpcreate' }, RegExpExec: { url: 'https://262.ecma-international.org/11.0/#sec-regexpexec' }, RegExpInitialize: { url: 'https://262.ecma-international.org/11.0/#sec-regexpinitialize' }, RejectPromise: { url: 'https://262.ecma-international.org/11.0/#sec-rejectpromise' }, RemoveWaiter: { url: 'https://262.ecma-international.org/11.0/#sec-removewaiter' }, RemoveWaiters: { url: 'https://262.ecma-international.org/11.0/#sec-removewaiters' }, RepeatMatcher: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-repeatmatcher-abstract-operation' }, RequireInternalSlot: { url: 'https://262.ecma-international.org/11.0/#sec-requireinternalslot' }, RequireObjectCoercible: { url: 'https://262.ecma-international.org/11.0/#sec-requireobjectcoercible' }, ResolveBinding: { url: 'https://262.ecma-international.org/11.0/#sec-resolvebinding' }, ResolveThisBinding: { url: 'https://262.ecma-international.org/11.0/#sec-resolvethisbinding' }, ReturnIfAbrupt: { url: 'https://262.ecma-international.org/11.0/#sec-returnifabrupt' }, SameValue: { url: 'https://262.ecma-international.org/11.0/#sec-samevalue' }, SameValueNonNumeric: { url: 'https://262.ecma-international.org/11.0/#sec-samevaluenonnumeric' }, SameValueZero: { url: 'https://262.ecma-international.org/11.0/#sec-samevaluezero' }, ScriptEvaluation: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-scriptevaluation' }, SecFromTime: { url: 'https://262.ecma-international.org/11.0/#eqn-SecFromTime' }, SerializeJSONArray: { url: 'https://262.ecma-international.org/11.0/#sec-serializejsonarray' }, SerializeJSONObject: { url: 'https://262.ecma-international.org/11.0/#sec-serializejsonobject' }, SerializeJSONProperty: { url: 'https://262.ecma-international.org/11.0/#sec-serializejsonproperty' }, Set: { url: 'https://262.ecma-international.org/11.0/#sec-set-o-p-v-throw' }, SetDefaultGlobalBindings: { url: 'https://262.ecma-international.org/11.0/#sec-setdefaultglobalbindings' }, SetFunctionLength: { url: 'https://262.ecma-international.org/11.0/#sec-setfunctionlength' }, SetFunctionName: { url: 'https://262.ecma-international.org/11.0/#sec-setfunctionname' }, SetImmutablePrototype: { url: 'https://262.ecma-international.org/11.0/#sec-set-immutable-prototype' }, SetIntegrityLevel: { url: 'https://262.ecma-international.org/11.0/#sec-setintegritylevel' }, SetRealmGlobalObject: { url: 'https://262.ecma-international.org/11.0/#sec-setrealmglobalobject' }, SetValueInBuffer: { url: 'https://262.ecma-international.org/11.0/#sec-setvalueinbuffer' }, SetViewValue: { url: 'https://262.ecma-international.org/11.0/#sec-setviewvalue' }, SharedDataBlockEventSet: { url: 'https://262.ecma-international.org/11.0/#sec-sharedatablockeventset' }, SortCompare: { url: 'https://262.ecma-international.org/11.0/#sec-sortcompare' }, SpeciesConstructor: { url: 'https://262.ecma-international.org/11.0/#sec-speciesconstructor' }, SplitMatch: { url: 'https://262.ecma-international.org/11.0/#sec-splitmatch' }, 'Strict Equality Comparison': { url: 'https://262.ecma-international.org/11.0/#sec-strict-equality-comparison' }, StringCreate: { url: 'https://262.ecma-international.org/11.0/#sec-stringcreate' }, StringGetOwnProperty: { url: 'https://262.ecma-international.org/11.0/#sec-stringgetownproperty' }, StringPad: { url: 'https://262.ecma-international.org/11.0/#sec-stringpad' }, StringToBigInt: { url: 'https://262.ecma-international.org/11.0/#sec-stringtobigint' }, Suspend: { url: 'https://262.ecma-international.org/11.0/#sec-suspend' }, SymbolDescriptiveString: { url: 'https://262.ecma-international.org/11.0/#sec-symboldescriptivestring' }, 'synchronizes-with': { url: 'https://262.ecma-international.org/11.0/#sec-synchronizes-with' }, TestIntegrityLevel: { url: 'https://262.ecma-international.org/11.0/#sec-testintegritylevel' }, thisBigIntValue: { url: 'https://262.ecma-international.org/11.0/#sec-thisbigintvalue' }, thisBooleanValue: { url: 'https://262.ecma-international.org/11.0/#sec-thisbooleanvalue' }, thisNumberValue: { url: 'https://262.ecma-international.org/11.0/#sec-thisnumbervalue' }, thisStringValue: { url: 'https://262.ecma-international.org/11.0/#sec-thisstringvalue' }, thisSymbolValue: { url: 'https://262.ecma-international.org/11.0/#sec-thissymbolvalue' }, thisTimeValue: { url: 'https://262.ecma-international.org/11.0/#sec-thistimevalue' }, ThrowCompletion: { url: 'https://262.ecma-international.org/11.0/#sec-throwcompletion' }, TimeClip: { url: 'https://262.ecma-international.org/11.0/#sec-timeclip' }, TimeFromYear: { url: 'https://262.ecma-international.org/11.0/#eqn-TimeFromYear' }, TimeString: { url: 'https://262.ecma-international.org/11.0/#sec-timestring' }, TimeWithinDay: { url: 'https://262.ecma-international.org/11.0/#eqn-TimeWithinDay' }, TimeZoneString: { url: 'https://262.ecma-international.org/11.0/#sec-timezoneestring' }, ToBigInt: { url: 'https://262.ecma-international.org/11.0/#sec-tobigint' }, ToBigInt64: { url: 'https://262.ecma-international.org/11.0/#sec-tobigint64' }, ToBigUint64: { url: 'https://262.ecma-international.org/11.0/#sec-tobiguint64' }, ToBoolean: { url: 'https://262.ecma-international.org/11.0/#sec-toboolean' }, ToDateString: { url: 'https://262.ecma-international.org/11.0/#sec-todatestring' }, ToIndex: { url: 'https://262.ecma-international.org/11.0/#sec-toindex' }, ToInt16: { url: 'https://262.ecma-international.org/11.0/#sec-toint16' }, ToInt32: { url: 'https://262.ecma-international.org/11.0/#sec-toint32' }, ToInt8: { url: 'https://262.ecma-international.org/11.0/#sec-toint8' }, ToInteger: { url: 'https://262.ecma-international.org/11.0/#sec-tointeger' }, ToLength: { url: 'https://262.ecma-international.org/11.0/#sec-tolength' }, ToNumber: { url: 'https://262.ecma-international.org/11.0/#sec-tonumber' }, ToNumeric: { url: 'https://262.ecma-international.org/11.0/#sec-tonumeric' }, ToObject: { url: 'https://262.ecma-international.org/11.0/#sec-toobject' }, ToPrimitive: { url: 'https://262.ecma-international.org/11.0/#sec-toprimitive' }, ToPropertyDescriptor: { url: 'https://262.ecma-international.org/11.0/#sec-topropertydescriptor' }, ToPropertyKey: { url: 'https://262.ecma-international.org/11.0/#sec-topropertykey' }, ToString: { url: 'https://262.ecma-international.org/11.0/#sec-tostring' }, ToUint16: { url: 'https://262.ecma-international.org/11.0/#sec-touint16' }, ToUint32: { url: 'https://262.ecma-international.org/11.0/#sec-touint32' }, ToUint8: { url: 'https://262.ecma-international.org/11.0/#sec-touint8' }, ToUint8Clamp: { url: 'https://262.ecma-international.org/11.0/#sec-touint8clamp' }, TriggerPromiseReactions: { url: 'https://262.ecma-international.org/11.0/#sec-triggerpromisereactions' }, TrimString: { url: 'https://262.ecma-international.org/11.0/#sec-trimstring' }, Type: { url: 'https://262.ecma-international.org/11.0/#sec-ecmascript-data-types-and-values' }, TypedArrayCreate: { url: 'https://262.ecma-international.org/11.0/#typedarray-create' }, TypedArraySpeciesCreate: { url: 'https://262.ecma-international.org/11.0/#typedarray-species-create' }, UnicodeEscape: { url: 'https://262.ecma-international.org/11.0/#sec-unicodeescape' }, UnicodeMatchProperty: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-unicodematchproperty-p' }, UnicodeMatchPropertyValue: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-unicodematchpropertyvalue-p-v' }, UpdateEmpty: { url: 'https://262.ecma-international.org/11.0/#sec-updateempty' }, UTC: { url: 'https://262.ecma-international.org/11.0/#sec-utc-t' }, UTF16DecodeString: { url: 'https://262.ecma-international.org/11.0/#sec-utf16decodestring' }, UTF16DecodeSurrogatePair: { url: 'https://262.ecma-international.org/11.0/#sec-utf16decodesurrogatepair' }, UTF16Encode: { url: 'https://262.ecma-international.org/11.0/#sec-utf16encode' }, UTF16Encoding: { url: 'https://262.ecma-international.org/11.0/#sec-utf16encoding' }, ValidateAndApplyPropertyDescriptor: { url: 'https://262.ecma-international.org/11.0/#sec-validateandapplypropertydescriptor' }, ValidateAtomicAccess: { url: 'https://262.ecma-international.org/11.0/#sec-validateatomicaccess' }, ValidateSharedIntegerTypedArray: { url: 'https://262.ecma-international.org/11.0/#sec-validatesharedintegertypedarray' }, ValidateTypedArray: { url: 'https://262.ecma-international.org/11.0/#sec-validatetypedarray' }, ValueOfReadEvent: { url: 'https://262.ecma-international.org/11.0/#sec-valueofreadevent' }, WeekDay: { url: 'https://262.ecma-international.org/11.0/#sec-week-day' }, WordCharacters: { url: 'https://262.ecma-international.org/11.0/#sec-runtime-semantics-wordcharacters-abstract-operation' }, YearFromTime: { url: 'https://262.ecma-international.org/11.0/#eqn-YearFromTime' } }; es-abstract-1.20.4/operations/2021.js000066400000000000000000001256051431761430200171250ustar00rootroot00000000000000'use strict'; module.exports = { abs: { url: 'https://262.ecma-international.org/12.0/#eqn-abs' }, 'Abstract Equality Comparison': { url: 'https://262.ecma-international.org/12.0/#sec-abstract-equality-comparison' }, 'Abstract Relational Comparison': { url: 'https://262.ecma-international.org/12.0/#sec-abstract-relational-comparison' }, AddEntriesFromIterable: { url: 'https://262.ecma-international.org/12.0/#sec-add-entries-from-iterable' }, AddRestrictedFunctionProperties: { url: 'https://262.ecma-international.org/12.0/#sec-addrestrictedfunctionproperties' }, AddToKeptObjects: { url: 'https://262.ecma-international.org/12.0/#sec-addtokeptobjects' }, AddWaiter: { url: 'https://262.ecma-international.org/12.0/#sec-addwaiter' }, AdvanceStringIndex: { url: 'https://262.ecma-international.org/12.0/#sec-advancestringindex' }, 'agent-order': { url: 'https://262.ecma-international.org/12.0/#sec-agent-order' }, AgentCanSuspend: { url: 'https://262.ecma-international.org/12.0/#sec-agentcansuspend' }, AgentSignifier: { url: 'https://262.ecma-international.org/12.0/#sec-agentsignifier' }, AllocateArrayBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-allocatearraybuffer' }, AllocateSharedArrayBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-allocatesharedarraybuffer' }, AllocateTypedArray: { url: 'https://262.ecma-international.org/12.0/#sec-allocatetypedarray' }, AllocateTypedArrayBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-allocatetypedarraybuffer' }, ApplyStringOrNumericBinaryOperator: { url: 'https://262.ecma-international.org/12.0/#sec-applystringornumericbinaryoperator' }, ArrayCreate: { url: 'https://262.ecma-international.org/12.0/#sec-arraycreate' }, ArraySetLength: { url: 'https://262.ecma-international.org/12.0/#sec-arraysetlength' }, ArraySpeciesCreate: { url: 'https://262.ecma-international.org/12.0/#sec-arrayspeciescreate' }, AsyncFromSyncIteratorContinuation: { url: 'https://262.ecma-international.org/12.0/#sec-asyncfromsynciteratorcontinuation' }, AsyncFunctionStart: { url: 'https://262.ecma-international.org/12.0/#sec-async-functions-abstract-operations-async-function-start' }, AsyncGeneratorEnqueue: { url: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorenqueue' }, AsyncGeneratorReject: { url: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorreject' }, AsyncGeneratorResolve: { url: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorresolve' }, AsyncGeneratorResumeNext: { url: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorresumenext' }, AsyncGeneratorStart: { url: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorstart' }, AsyncGeneratorValidate: { url: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorvalidate' }, AsyncGeneratorYield: { url: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratoryield' }, AsyncIteratorClose: { url: 'https://262.ecma-international.org/12.0/#sec-asynciteratorclose' }, AtomicReadModifyWrite: { url: 'https://262.ecma-international.org/12.0/#sec-atomicreadmodifywrite' }, Await: { url: 'https://262.ecma-international.org/12.0/#await' }, BackreferenceMatcher: { url: 'https://262.ecma-international.org/12.0/#sec-backreference-matcher' }, 'BigInt::add': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-add' }, 'BigInt::bitwiseAND': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-bitwiseAND' }, 'BigInt::bitwiseNOT': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-bitwiseNOT' }, 'BigInt::bitwiseOR': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-bitwiseOR' }, 'BigInt::bitwiseXOR': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-bitwiseXOR' }, 'BigInt::divide': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-divide' }, 'BigInt::equal': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-equal' }, 'BigInt::exponentiate': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-exponentiate' }, 'BigInt::leftShift': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-leftShift' }, 'BigInt::lessThan': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-lessThan' }, 'BigInt::multiply': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-multiply' }, 'BigInt::remainder': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-remainder' }, 'BigInt::sameValue': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-sameValue' }, 'BigInt::sameValueZero': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-sameValueZero' }, 'BigInt::signedRightShift': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-signedRightShift' }, 'BigInt::subtract': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-subtract' }, 'BigInt::toString': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-tostring' }, 'BigInt::unaryMinus': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-unaryMinus' }, 'BigInt::unsignedRightShift': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-unsignedRightShift' }, BigIntBitwiseOp: { url: 'https://262.ecma-international.org/12.0/#sec-bigintbitwiseop' }, BinaryAnd: { url: 'https://262.ecma-international.org/12.0/#sec-binaryand' }, BinaryOr: { url: 'https://262.ecma-international.org/12.0/#sec-binaryor' }, BinaryXor: { url: 'https://262.ecma-international.org/12.0/#sec-binaryxor' }, BlockDeclarationInstantiation: { url: 'https://262.ecma-international.org/12.0/#sec-blockdeclarationinstantiation' }, BoundFunctionCreate: { url: 'https://262.ecma-international.org/12.0/#sec-boundfunctioncreate' }, ByteListBitwiseOp: { url: 'https://262.ecma-international.org/12.0/#sec-bytelistbitwiseop' }, ByteListEqual: { url: 'https://262.ecma-international.org/12.0/#sec-bytelistequal' }, Call: { url: 'https://262.ecma-international.org/12.0/#sec-call' }, Canonicalize: { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-canonicalize-ch' }, CanonicalNumericIndexString: { url: 'https://262.ecma-international.org/12.0/#sec-canonicalnumericindexstring' }, CaseClauseIsSelected: { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-caseclauseisselected' }, CharacterRange: { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-characterrange-abstract-operation' }, CharacterRangeOrUnion: { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-characterrangeorunion-abstract-operation' }, CharacterSetMatcher: { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-charactersetmatcher-abstract-operation' }, clamp: { url: 'https://262.ecma-international.org/12.0/#clamping' }, CleanupFinalizationRegistry: { url: 'https://262.ecma-international.org/12.0/#sec-cleanup-finalization-registry' }, ClearKeptObjects: { url: 'https://262.ecma-international.org/12.0/#sec-clear-kept-objects' }, CloneArrayBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-clonearraybuffer' }, CodePointAt: { url: 'https://262.ecma-international.org/12.0/#sec-codepointat' }, CodePointsToString: { url: 'https://262.ecma-international.org/12.0/#sec-codepointstostring' }, CompletePropertyDescriptor: { url: 'https://262.ecma-international.org/12.0/#sec-completepropertydescriptor' }, Completion: { url: 'https://262.ecma-international.org/12.0/#sec-completion-record-specification-type' }, ComposeWriteEventBytes: { url: 'https://262.ecma-international.org/12.0/#sec-composewriteeventbytes' }, Construct: { url: 'https://262.ecma-international.org/12.0/#sec-construct' }, CopyDataBlockBytes: { url: 'https://262.ecma-international.org/12.0/#sec-copydatablockbytes' }, CopyDataProperties: { url: 'https://262.ecma-international.org/12.0/#sec-copydataproperties' }, CreateArrayFromList: { url: 'https://262.ecma-international.org/12.0/#sec-createarrayfromlist' }, CreateArrayIterator: { url: 'https://262.ecma-international.org/12.0/#sec-createarrayiterator' }, CreateAsyncFromSyncIterator: { url: 'https://262.ecma-international.org/12.0/#sec-createasyncfromsynciterator' }, CreateAsyncIteratorFromClosure: { url: 'https://262.ecma-international.org/12.0/#sec-createasynciteratorfromclosure' }, CreateBuiltinFunction: { url: 'https://262.ecma-international.org/12.0/#sec-createbuiltinfunction' }, CreateByteDataBlock: { url: 'https://262.ecma-international.org/12.0/#sec-createbytedatablock' }, CreateDataProperty: { url: 'https://262.ecma-international.org/12.0/#sec-createdataproperty' }, CreateDataPropertyOrThrow: { url: 'https://262.ecma-international.org/12.0/#sec-createdatapropertyorthrow' }, CreateDynamicFunction: { url: 'https://262.ecma-international.org/12.0/#sec-createdynamicfunction' }, CreateForInIterator: { url: 'https://262.ecma-international.org/12.0/#sec-createforiniterator' }, CreateHTML: { url: 'https://262.ecma-international.org/12.0/#sec-createhtml' }, CreateIntrinsics: { url: 'https://262.ecma-international.org/12.0/#sec-createintrinsics' }, CreateIteratorFromClosure: { url: 'https://262.ecma-international.org/12.0/#sec-createiteratorfromclosure' }, CreateIterResultObject: { url: 'https://262.ecma-international.org/12.0/#sec-createiterresultobject' }, CreateListFromArrayLike: { url: 'https://262.ecma-international.org/12.0/#sec-createlistfromarraylike' }, CreateListIteratorRecord: { url: 'https://262.ecma-international.org/12.0/#sec-createlistiteratorRecord' }, CreateMapIterator: { url: 'https://262.ecma-international.org/12.0/#sec-createmapiterator' }, CreateMappedArgumentsObject: { url: 'https://262.ecma-international.org/12.0/#sec-createmappedargumentsobject' }, CreateMethodProperty: { url: 'https://262.ecma-international.org/12.0/#sec-createmethodproperty' }, CreatePerIterationEnvironment: { url: 'https://262.ecma-international.org/12.0/#sec-createperiterationenvironment' }, CreateRealm: { url: 'https://262.ecma-international.org/12.0/#sec-createrealm' }, CreateRegExpStringIterator: { url: 'https://262.ecma-international.org/12.0/#sec-createregexpstringiterator' }, CreateResolvingFunctions: { url: 'https://262.ecma-international.org/12.0/#sec-createresolvingfunctions' }, CreateSetIterator: { url: 'https://262.ecma-international.org/12.0/#sec-createsetiterator' }, CreateSharedByteDataBlock: { url: 'https://262.ecma-international.org/12.0/#sec-createsharedbytedatablock' }, CreateUnmappedArgumentsObject: { url: 'https://262.ecma-international.org/12.0/#sec-createunmappedargumentsobject' }, DateFromTime: { url: 'https://262.ecma-international.org/12.0/#sec-date-number' }, DateString: { url: 'https://262.ecma-international.org/12.0/#sec-datestring' }, Day: { url: 'https://262.ecma-international.org/12.0/#eqn-Day' }, DayFromYear: { url: 'https://262.ecma-international.org/12.0/#eqn-DaysFromYear' }, DaysInYear: { url: 'https://262.ecma-international.org/12.0/#eqn-DaysInYear' }, DayWithinYear: { url: 'https://262.ecma-international.org/12.0/#eqn-DayWithinYear' }, Decode: { url: 'https://262.ecma-international.org/12.0/#sec-decode' }, DefinePropertyOrThrow: { url: 'https://262.ecma-international.org/12.0/#sec-definepropertyorthrow' }, DeletePropertyOrThrow: { url: 'https://262.ecma-international.org/12.0/#sec-deletepropertyorthrow' }, DetachArrayBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-detacharraybuffer' }, Encode: { url: 'https://262.ecma-international.org/12.0/#sec-encode' }, EnterCriticalSection: { url: 'https://262.ecma-international.org/12.0/#sec-entercriticalsection' }, EnumerableOwnPropertyNames: { url: 'https://262.ecma-international.org/12.0/#sec-enumerableownpropertynames' }, EnumerateObjectProperties: { url: 'https://262.ecma-international.org/12.0/#sec-enumerate-object-properties' }, EscapeRegExpPattern: { url: 'https://262.ecma-international.org/12.0/#sec-escaperegexppattern' }, EvalDeclarationInstantiation: { url: 'https://262.ecma-international.org/12.0/#sec-evaldeclarationinstantiation' }, EvaluateCall: { url: 'https://262.ecma-international.org/12.0/#sec-evaluatecall' }, EvaluateNew: { url: 'https://262.ecma-international.org/12.0/#sec-evaluatenew' }, EvaluatePropertyAccessWithExpressionKey: { url: 'https://262.ecma-international.org/12.0/#sec-evaluate-property-access-with-expression-key' }, EvaluatePropertyAccessWithIdentifierKey: { url: 'https://262.ecma-international.org/12.0/#sec-evaluate-property-access-with-identifier-key' }, EvaluateStringOrNumericBinaryExpression: { url: 'https://262.ecma-international.org/12.0/#sec-evaluatestringornumericbinaryexpression' }, EventSet: { url: 'https://262.ecma-international.org/12.0/#sec-event-set' }, ExecuteModule: { url: 'https://262.ecma-international.org/12.0/#sec-source-text-module-record-execute-module' }, FinishDynamicImport: { url: 'https://262.ecma-international.org/12.0/#sec-finishdynamicimport' }, FlattenIntoArray: { url: 'https://262.ecma-international.org/12.0/#sec-flattenintoarray' }, floor: { url: 'https://262.ecma-international.org/12.0/#eqn-floor' }, ForBodyEvaluation: { url: 'https://262.ecma-international.org/12.0/#sec-forbodyevaluation' }, 'ForIn/OfBodyEvaluation': { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset' }, 'ForIn/OfHeadEvaluation': { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-forinofheadevaluation' }, FromPropertyDescriptor: { url: 'https://262.ecma-international.org/12.0/#sec-frompropertydescriptor' }, FulfillPromise: { url: 'https://262.ecma-international.org/12.0/#sec-fulfillpromise' }, FunctionDeclarationInstantiation: { url: 'https://262.ecma-international.org/12.0/#sec-functiondeclarationinstantiation' }, GeneratorResume: { url: 'https://262.ecma-international.org/12.0/#sec-generatorresume' }, GeneratorResumeAbrupt: { url: 'https://262.ecma-international.org/12.0/#sec-generatorresumeabrupt' }, GeneratorStart: { url: 'https://262.ecma-international.org/12.0/#sec-generatorstart' }, GeneratorValidate: { url: 'https://262.ecma-international.org/12.0/#sec-generatorvalidate' }, GeneratorYield: { url: 'https://262.ecma-international.org/12.0/#sec-generatoryield' }, Get: { url: 'https://262.ecma-international.org/12.0/#sec-get-o-p' }, GetActiveScriptOrModule: { url: 'https://262.ecma-international.org/12.0/#sec-getactivescriptormodule' }, GetFunctionRealm: { url: 'https://262.ecma-international.org/12.0/#sec-getfunctionrealm' }, GetGeneratorKind: { url: 'https://262.ecma-international.org/12.0/#sec-getgeneratorkind' }, GetGlobalObject: { url: 'https://262.ecma-international.org/12.0/#sec-getglobalobject' }, GetIdentifierReference: { url: 'https://262.ecma-international.org/12.0/#sec-getidentifierreference' }, GetIterator: { url: 'https://262.ecma-international.org/12.0/#sec-getiterator' }, GetMethod: { url: 'https://262.ecma-international.org/12.0/#sec-getmethod' }, GetModifySetValueInBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-getmodifysetvalueinbuffer' }, GetModuleNamespace: { url: 'https://262.ecma-international.org/12.0/#sec-getmodulenamespace' }, GetNewTarget: { url: 'https://262.ecma-international.org/12.0/#sec-getnewtarget' }, GetOwnPropertyKeys: { url: 'https://262.ecma-international.org/12.0/#sec-getownpropertykeys' }, GetPromiseResolve: { url: 'https://262.ecma-international.org/12.0/#sec-getpromiseresolve' }, GetPrototypeFromConstructor: { url: 'https://262.ecma-international.org/12.0/#sec-getprototypefromconstructor' }, GetSubstitution: { url: 'https://262.ecma-international.org/12.0/#sec-getsubstitution' }, GetSuperConstructor: { url: 'https://262.ecma-international.org/12.0/#sec-getsuperconstructor' }, GetTemplateObject: { url: 'https://262.ecma-international.org/12.0/#sec-gettemplateobject' }, GetThisEnvironment: { url: 'https://262.ecma-international.org/12.0/#sec-getthisenvironment' }, GetThisValue: { url: 'https://262.ecma-international.org/12.0/#sec-getthisvalue' }, GetV: { url: 'https://262.ecma-international.org/12.0/#sec-getv' }, GetValue: { url: 'https://262.ecma-international.org/12.0/#sec-getvalue' }, GetValueFromBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-getvaluefrombuffer' }, GetViewValue: { url: 'https://262.ecma-international.org/12.0/#sec-getviewvalue' }, GetWaiterList: { url: 'https://262.ecma-international.org/12.0/#sec-getwaiterlist' }, GlobalDeclarationInstantiation: { url: 'https://262.ecma-international.org/12.0/#sec-globaldeclarationinstantiation' }, 'happens-before': { url: 'https://262.ecma-international.org/12.0/#sec-happens-before' }, HasOwnProperty: { url: 'https://262.ecma-international.org/12.0/#sec-hasownproperty' }, HasProperty: { url: 'https://262.ecma-international.org/12.0/#sec-hasproperty' }, 'host-synchronizes-with': { url: 'https://262.ecma-international.org/12.0/#sec-host-synchronizes-with' }, HostCallJobCallback: { url: 'https://262.ecma-international.org/12.0/#sec-hostcalljobcallback' }, HostEnqueueFinalizationRegistryCleanupJob: { url: 'https://262.ecma-international.org/12.0/#sec-host-cleanup-finalization-registry' }, HostEnqueuePromiseJob: { url: 'https://262.ecma-international.org/12.0/#sec-hostenqueuepromisejob' }, HostEnsureCanCompileStrings: { url: 'https://262.ecma-international.org/12.0/#sec-hostensurecancompilestrings' }, HostEventSet: { url: 'https://262.ecma-international.org/12.0/#sec-hosteventset' }, HostFinalizeImportMeta: { url: 'https://262.ecma-international.org/12.0/#sec-hostfinalizeimportmeta' }, HostGetImportMetaProperties: { url: 'https://262.ecma-international.org/12.0/#sec-hostgetimportmetaproperties' }, HostHasSourceTextAvailable: { url: 'https://262.ecma-international.org/12.0/#sec-hosthassourcetextavailable' }, HostImportModuleDynamically: { url: 'https://262.ecma-international.org/12.0/#sec-hostimportmoduledynamically' }, HostMakeJobCallback: { url: 'https://262.ecma-international.org/12.0/#sec-hostmakejobcallback' }, HostPromiseRejectionTracker: { url: 'https://262.ecma-international.org/12.0/#sec-host-promise-rejection-tracker' }, HostResolveImportedModule: { url: 'https://262.ecma-international.org/12.0/#sec-hostresolveimportedmodule' }, HourFromTime: { url: 'https://262.ecma-international.org/12.0/#eqn-HourFromTime' }, IfAbruptRejectPromise: { url: 'https://262.ecma-international.org/12.0/#sec-ifabruptrejectpromise' }, ImportedLocalNames: { url: 'https://262.ecma-international.org/12.0/#sec-importedlocalnames' }, InitializeBoundName: { url: 'https://262.ecma-international.org/12.0/#sec-initializeboundname' }, InitializeEnvironment: { url: 'https://262.ecma-international.org/12.0/#sec-source-text-module-record-initialize-environment' }, InitializeHostDefinedRealm: { url: 'https://262.ecma-international.org/12.0/#sec-initializehostdefinedrealm' }, InitializeReferencedBinding: { url: 'https://262.ecma-international.org/12.0/#sec-initializereferencedbinding' }, InitializeTypedArrayFromArrayBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-initializetypedarrayfromarraybuffer' }, InitializeTypedArrayFromArrayLike: { url: 'https://262.ecma-international.org/12.0/#sec-initializetypedarrayfromarraylike' }, InitializeTypedArrayFromList: { url: 'https://262.ecma-international.org/12.0/#sec-initializetypedarrayfromlist' }, InitializeTypedArrayFromTypedArray: { url: 'https://262.ecma-international.org/12.0/#sec-initializetypedarrayfromtypedarray' }, InLeapYear: { url: 'https://262.ecma-international.org/12.0/#eqn-InLeapYear' }, InnerModuleEvaluation: { url: 'https://262.ecma-international.org/12.0/#sec-innermoduleevaluation' }, InnerModuleLinking: { url: 'https://262.ecma-international.org/12.0/#sec-InnerModuleLinking' }, InstanceofOperator: { url: 'https://262.ecma-international.org/12.0/#sec-instanceofoperator' }, IntegerIndexedElementGet: { url: 'https://262.ecma-international.org/12.0/#sec-integerindexedelementget' }, IntegerIndexedElementSet: { url: 'https://262.ecma-international.org/12.0/#sec-integerindexedelementset' }, IntegerIndexedObjectCreate: { url: 'https://262.ecma-international.org/12.0/#sec-integerindexedobjectcreate' }, InternalizeJSONProperty: { url: 'https://262.ecma-international.org/12.0/#sec-internalizejsonproperty' }, Invoke: { url: 'https://262.ecma-international.org/12.0/#sec-invoke' }, IsAccessorDescriptor: { url: 'https://262.ecma-international.org/12.0/#sec-isaccessordescriptor' }, IsAnonymousFunctionDefinition: { url: 'https://262.ecma-international.org/12.0/#sec-isanonymousfunctiondefinition' }, IsArray: { url: 'https://262.ecma-international.org/12.0/#sec-isarray' }, IsBigIntElementType: { url: 'https://262.ecma-international.org/12.0/#sec-isbigintelementtype' }, IsCallable: { url: 'https://262.ecma-international.org/12.0/#sec-iscallable' }, IsCompatiblePropertyDescriptor: { url: 'https://262.ecma-international.org/12.0/#sec-iscompatiblepropertydescriptor' }, IsConcatSpreadable: { url: 'https://262.ecma-international.org/12.0/#sec-isconcatspreadable' }, IsConstructor: { url: 'https://262.ecma-international.org/12.0/#sec-isconstructor' }, IsDataDescriptor: { url: 'https://262.ecma-international.org/12.0/#sec-isdatadescriptor' }, IsDetachedBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-isdetachedbuffer' }, IsExtensible: { url: 'https://262.ecma-international.org/12.0/#sec-isextensible-o' }, IsGenericDescriptor: { url: 'https://262.ecma-international.org/12.0/#sec-isgenericdescriptor' }, IsInTailPosition: { url: 'https://262.ecma-international.org/12.0/#sec-isintailposition' }, IsIntegralNumber: { url: 'https://262.ecma-international.org/12.0/#sec-isintegralnumber' }, IsLabelledFunction: { url: 'https://262.ecma-international.org/12.0/#sec-islabelledfunction' }, IsNoTearConfiguration: { url: 'https://262.ecma-international.org/12.0/#sec-isnotearconfiguration' }, IsPromise: { url: 'https://262.ecma-international.org/12.0/#sec-ispromise' }, IsPropertyKey: { url: 'https://262.ecma-international.org/12.0/#sec-ispropertykey' }, IsPropertyReference: { url: 'https://262.ecma-international.org/12.0/#sec-ispropertyreference' }, IsRegExp: { url: 'https://262.ecma-international.org/12.0/#sec-isregexp' }, IsSharedArrayBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-issharedarraybuffer' }, IsStringPrefix: { url: 'https://262.ecma-international.org/12.0/#sec-isstringprefix' }, IsSuperReference: { url: 'https://262.ecma-international.org/12.0/#sec-issuperreference' }, IsUnclampedIntegerElementType: { url: 'https://262.ecma-international.org/12.0/#sec-isunclampedintegerelementtype' }, IsUnresolvableReference: { url: 'https://262.ecma-international.org/12.0/#sec-isunresolvablereference' }, IsUnsignedElementType: { url: 'https://262.ecma-international.org/12.0/#sec-isunsignedelementtype' }, IsValidIntegerIndex: { url: 'https://262.ecma-international.org/12.0/#sec-isvalidintegerindex' }, IsValidRegularExpressionLiteral: { url: 'https://262.ecma-international.org/12.0/#sec-isvalidregularexpressionliteral' }, IsWordChar: { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-iswordchar-abstract-operation' }, IterableToList: { url: 'https://262.ecma-international.org/12.0/#sec-iterabletolist' }, IteratorClose: { url: 'https://262.ecma-international.org/12.0/#sec-iteratorclose' }, IteratorComplete: { url: 'https://262.ecma-international.org/12.0/#sec-iteratorcomplete' }, IteratorNext: { url: 'https://262.ecma-international.org/12.0/#sec-iteratornext' }, IteratorStep: { url: 'https://262.ecma-international.org/12.0/#sec-iteratorstep' }, IteratorValue: { url: 'https://262.ecma-international.org/12.0/#sec-iteratorvalue' }, LeaveCriticalSection: { url: 'https://262.ecma-international.org/12.0/#sec-leavecriticalsection' }, LengthOfArrayLike: { url: 'https://262.ecma-international.org/12.0/#sec-lengthofarraylike' }, LocalTime: { url: 'https://262.ecma-international.org/12.0/#sec-localtime' }, LocalTZA: { url: 'https://262.ecma-international.org/12.0/#sec-local-time-zone-adjustment' }, LoopContinues: { url: 'https://262.ecma-international.org/12.0/#sec-loopcontinues' }, MakeArgGetter: { url: 'https://262.ecma-international.org/12.0/#sec-makearggetter' }, MakeArgSetter: { url: 'https://262.ecma-international.org/12.0/#sec-makeargsetter' }, MakeBasicObject: { url: 'https://262.ecma-international.org/12.0/#sec-makebasicobject' }, MakeClassConstructor: { url: 'https://262.ecma-international.org/12.0/#sec-makeclassconstructor' }, MakeConstructor: { url: 'https://262.ecma-international.org/12.0/#sec-makeconstructor' }, MakeDate: { url: 'https://262.ecma-international.org/12.0/#sec-makedate' }, MakeDay: { url: 'https://262.ecma-international.org/12.0/#sec-makeday' }, MakeMethod: { url: 'https://262.ecma-international.org/12.0/#sec-makemethod' }, MakeSuperPropertyReference: { url: 'https://262.ecma-international.org/12.0/#sec-makesuperpropertyreference' }, MakeTime: { url: 'https://262.ecma-international.org/12.0/#sec-maketime' }, max: { url: 'https://262.ecma-international.org/12.0/#eqn-max' }, 'memory-order': { url: 'https://262.ecma-international.org/12.0/#sec-memory-order' }, min: { url: 'https://262.ecma-international.org/12.0/#eqn-min' }, MinFromTime: { url: 'https://262.ecma-international.org/12.0/#eqn-MinFromTime' }, ModuleNamespaceCreate: { url: 'https://262.ecma-international.org/12.0/#sec-modulenamespacecreate' }, modulo: { url: 'https://262.ecma-international.org/12.0/#eqn-modulo' }, MonthFromTime: { url: 'https://262.ecma-international.org/12.0/#eqn-MonthFromTime' }, msFromTime: { url: 'https://262.ecma-international.org/12.0/#eqn-msFromTime' }, NewDeclarativeEnvironment: { url: 'https://262.ecma-international.org/12.0/#sec-newdeclarativeenvironment' }, NewFunctionEnvironment: { url: 'https://262.ecma-international.org/12.0/#sec-newfunctionenvironment' }, NewGlobalEnvironment: { url: 'https://262.ecma-international.org/12.0/#sec-newglobalenvironment' }, NewModuleEnvironment: { url: 'https://262.ecma-international.org/12.0/#sec-newmoduleenvironment' }, NewObjectEnvironment: { url: 'https://262.ecma-international.org/12.0/#sec-newobjectenvironment' }, NewPromiseCapability: { url: 'https://262.ecma-international.org/12.0/#sec-newpromisecapability' }, NewPromiseReactionJob: { url: 'https://262.ecma-international.org/12.0/#sec-newpromisereactionjob' }, NewPromiseResolveThenableJob: { url: 'https://262.ecma-international.org/12.0/#sec-newpromiseresolvethenablejob' }, NormalCompletion: { url: 'https://262.ecma-international.org/12.0/#sec-normalcompletion' }, NotifyWaiter: { url: 'https://262.ecma-international.org/12.0/#sec-notifywaiter' }, 'Number::add': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-add' }, 'Number::bitwiseAND': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-bitwiseAND' }, 'Number::bitwiseNOT': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-bitwiseNOT' }, 'Number::bitwiseOR': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-bitwiseOR' }, 'Number::bitwiseXOR': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-bitwiseXOR' }, 'Number::divide': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-divide' }, 'Number::equal': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-equal' }, 'Number::exponentiate': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-exponentiate' }, 'Number::leftShift': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-leftShift' }, 'Number::lessThan': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-lessThan' }, 'Number::multiply': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-multiply' }, 'Number::remainder': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-remainder' }, 'Number::sameValue': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-sameValue' }, 'Number::sameValueZero': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-sameValueZero' }, 'Number::signedRightShift': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-signedRightShift' }, 'Number::subtract': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-subtract' }, 'Number::toString': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-tostring' }, 'Number::unaryMinus': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-unaryMinus' }, 'Number::unsignedRightShift': { url: 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-unsignedRightShift' }, NumberBitwiseOp: { url: 'https://262.ecma-international.org/12.0/#sec-numberbitwiseop' }, NumberToBigInt: { url: 'https://262.ecma-international.org/12.0/#sec-numbertobigint' }, NumericToRawBytes: { url: 'https://262.ecma-international.org/12.0/#sec-numerictorawbytes' }, ObjectDefineProperties: { url: 'https://262.ecma-international.org/12.0/#sec-objectdefineproperties' }, OrdinaryCallBindThis: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarycallbindthis' }, OrdinaryCallEvaluateBody: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarycallevaluatebody' }, OrdinaryCreateFromConstructor: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarycreatefromconstructor' }, OrdinaryDefineOwnProperty: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarydefineownproperty' }, OrdinaryDelete: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarydelete' }, OrdinaryFunctionCreate: { url: 'https://262.ecma-international.org/12.0/#sec-ordinaryfunctioncreate' }, OrdinaryGet: { url: 'https://262.ecma-international.org/12.0/#sec-ordinaryget' }, OrdinaryGetOwnProperty: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarygetownproperty' }, OrdinaryGetPrototypeOf: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarygetprototypeof' }, OrdinaryHasInstance: { url: 'https://262.ecma-international.org/12.0/#sec-ordinaryhasinstance' }, OrdinaryHasProperty: { url: 'https://262.ecma-international.org/12.0/#sec-ordinaryhasproperty' }, OrdinaryIsExtensible: { url: 'https://262.ecma-international.org/12.0/#sec-ordinaryisextensible' }, OrdinaryObjectCreate: { url: 'https://262.ecma-international.org/12.0/#sec-ordinaryobjectcreate' }, OrdinaryOwnPropertyKeys: { url: 'https://262.ecma-international.org/12.0/#sec-ordinaryownpropertykeys' }, OrdinaryPreventExtensions: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarypreventextensions' }, OrdinarySet: { url: 'https://262.ecma-international.org/12.0/#sec-ordinaryset' }, OrdinarySetPrototypeOf: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarysetprototypeof' }, OrdinarySetWithOwnDescriptor: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarysetwithowndescriptor' }, OrdinaryToPrimitive: { url: 'https://262.ecma-international.org/12.0/#sec-ordinarytoprimitive' }, ParseModule: { url: 'https://262.ecma-international.org/12.0/#sec-parsemodule' }, ParsePattern: { url: 'https://262.ecma-international.org/12.0/#sec-parsepattern' }, ParseScript: { url: 'https://262.ecma-international.org/12.0/#sec-parse-script' }, ParseText: { url: 'https://262.ecma-international.org/12.0/#sec-parsetext' }, PerformEval: { url: 'https://262.ecma-international.org/12.0/#sec-performeval' }, PerformPromiseAll: { url: 'https://262.ecma-international.org/12.0/#sec-performpromiseall' }, PerformPromiseAllSettled: { url: 'https://262.ecma-international.org/12.0/#sec-performpromiseallsettled' }, PerformPromiseAny: { url: 'https://262.ecma-international.org/12.0/#sec-performpromiseany' }, PerformPromiseRace: { url: 'https://262.ecma-international.org/12.0/#sec-performpromiserace' }, PerformPromiseThen: { url: 'https://262.ecma-international.org/12.0/#sec-performpromisethen' }, PrepareForOrdinaryCall: { url: 'https://262.ecma-international.org/12.0/#sec-prepareforordinarycall' }, PrepareForTailCall: { url: 'https://262.ecma-international.org/12.0/#sec-preparefortailcall' }, PromiseResolve: { url: 'https://262.ecma-international.org/12.0/#sec-promise-resolve' }, ProxyCreate: { url: 'https://262.ecma-international.org/12.0/#sec-proxycreate' }, PutValue: { url: 'https://262.ecma-international.org/12.0/#sec-putvalue' }, QuoteJSONString: { url: 'https://262.ecma-international.org/12.0/#sec-quotejsonstring' }, RawBytesToNumeric: { url: 'https://262.ecma-international.org/12.0/#sec-rawbytestonumeric' }, 'reads-bytes-from': { url: 'https://262.ecma-international.org/12.0/#sec-reads-bytes-from' }, 'reads-from': { url: 'https://262.ecma-international.org/12.0/#sec-reads-from' }, RegExpAlloc: { url: 'https://262.ecma-international.org/12.0/#sec-regexpalloc' }, RegExpBuiltinExec: { url: 'https://262.ecma-international.org/12.0/#sec-regexpbuiltinexec' }, RegExpCreate: { url: 'https://262.ecma-international.org/12.0/#sec-regexpcreate' }, RegExpExec: { url: 'https://262.ecma-international.org/12.0/#sec-regexpexec' }, RegExpInitialize: { url: 'https://262.ecma-international.org/12.0/#sec-regexpinitialize' }, RejectPromise: { url: 'https://262.ecma-international.org/12.0/#sec-rejectpromise' }, RemoveWaiter: { url: 'https://262.ecma-international.org/12.0/#sec-removewaiter' }, RemoveWaiters: { url: 'https://262.ecma-international.org/12.0/#sec-removewaiters' }, RepeatMatcher: { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-repeatmatcher-abstract-operation' }, RequireInternalSlot: { url: 'https://262.ecma-international.org/12.0/#sec-requireinternalslot' }, RequireObjectCoercible: { url: 'https://262.ecma-international.org/12.0/#sec-requireobjectcoercible' }, ResolveBinding: { url: 'https://262.ecma-international.org/12.0/#sec-resolvebinding' }, ResolveThisBinding: { url: 'https://262.ecma-international.org/12.0/#sec-resolvethisbinding' }, ReturnIfAbrupt: { url: 'https://262.ecma-international.org/12.0/#sec-returnifabrupt' }, SameValue: { url: 'https://262.ecma-international.org/12.0/#sec-samevalue' }, SameValueNonNumeric: { url: 'https://262.ecma-international.org/12.0/#sec-samevaluenonnumeric' }, SameValueZero: { url: 'https://262.ecma-international.org/12.0/#sec-samevaluezero' }, ScriptEvaluation: { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-scriptevaluation' }, SecFromTime: { url: 'https://262.ecma-international.org/12.0/#eqn-SecFromTime' }, SerializeJSONArray: { url: 'https://262.ecma-international.org/12.0/#sec-serializejsonarray' }, SerializeJSONObject: { url: 'https://262.ecma-international.org/12.0/#sec-serializejsonobject' }, SerializeJSONProperty: { url: 'https://262.ecma-international.org/12.0/#sec-serializejsonproperty' }, Set: { url: 'https://262.ecma-international.org/12.0/#sec-set-o-p-v-throw' }, SetDefaultGlobalBindings: { url: 'https://262.ecma-international.org/12.0/#sec-setdefaultglobalbindings' }, SetFunctionLength: { url: 'https://262.ecma-international.org/12.0/#sec-setfunctionlength' }, SetFunctionName: { url: 'https://262.ecma-international.org/12.0/#sec-setfunctionname' }, SetImmutablePrototype: { url: 'https://262.ecma-international.org/12.0/#sec-set-immutable-prototype' }, SetIntegrityLevel: { url: 'https://262.ecma-international.org/12.0/#sec-setintegritylevel' }, SetRealmGlobalObject: { url: 'https://262.ecma-international.org/12.0/#sec-setrealmglobalobject' }, SetTypedArrayFromArrayLike: { url: 'https://262.ecma-international.org/12.0/#sec-settypedarrayfromarraylike' }, SetTypedArrayFromTypedArray: { url: 'https://262.ecma-international.org/12.0/#sec-settypedarrayfromtypedarray' }, SetValueInBuffer: { url: 'https://262.ecma-international.org/12.0/#sec-setvalueinbuffer' }, SetViewValue: { url: 'https://262.ecma-international.org/12.0/#sec-setviewvalue' }, SharedDataBlockEventSet: { url: 'https://262.ecma-international.org/12.0/#sec-sharedatablockeventset' }, SortCompare: { url: 'https://262.ecma-international.org/12.0/#sec-sortcompare' }, SpeciesConstructor: { url: 'https://262.ecma-international.org/12.0/#sec-speciesconstructor' }, SplitMatch: { url: 'https://262.ecma-international.org/12.0/#sec-splitmatch' }, 'Strict Equality Comparison': { url: 'https://262.ecma-international.org/12.0/#sec-strict-equality-comparison' }, StringCreate: { url: 'https://262.ecma-international.org/12.0/#sec-stringcreate' }, StringGetOwnProperty: { url: 'https://262.ecma-international.org/12.0/#sec-stringgetownproperty' }, StringIndexOf: { url: 'https://262.ecma-international.org/12.0/#sec-stringindexof' }, StringPad: { url: 'https://262.ecma-international.org/12.0/#sec-stringpad' }, StringToBigInt: { url: 'https://262.ecma-international.org/12.0/#sec-stringtobigint' }, StringToCodePoints: { url: 'https://262.ecma-international.org/12.0/#sec-stringtocodepoints' }, substring: { url: 'https://262.ecma-international.org/12.0/#substring' }, SuspendAgent: { url: 'https://262.ecma-international.org/12.0/#sec-suspendagent' }, SymbolDescriptiveString: { url: 'https://262.ecma-international.org/12.0/#sec-symboldescriptivestring' }, 'synchronizes-with': { url: 'https://262.ecma-international.org/12.0/#sec-synchronizes-with' }, TestIntegrityLevel: { url: 'https://262.ecma-international.org/12.0/#sec-testintegritylevel' }, thisBigIntValue: { url: 'https://262.ecma-international.org/12.0/#thisbigintvalue' }, thisBooleanValue: { url: 'https://262.ecma-international.org/12.0/#thisbooleanvalue' }, thisNumberValue: { url: 'https://262.ecma-international.org/12.0/#thisnumbervalue' }, thisStringValue: { url: 'https://262.ecma-international.org/12.0/#thisstringvalue' }, thisSymbolValue: { url: 'https://262.ecma-international.org/12.0/#thissymbolvalue' }, thisTimeValue: { url: 'https://262.ecma-international.org/12.0/#thistimevalue' }, ThrowCompletion: { url: 'https://262.ecma-international.org/12.0/#sec-throwcompletion' }, TimeClip: { url: 'https://262.ecma-international.org/12.0/#sec-timeclip' }, TimeFromYear: { url: 'https://262.ecma-international.org/12.0/#eqn-TimeFromYear' }, TimeString: { url: 'https://262.ecma-international.org/12.0/#sec-timestring' }, TimeWithinDay: { url: 'https://262.ecma-international.org/12.0/#eqn-TimeWithinDay' }, TimeZoneString: { url: 'https://262.ecma-international.org/12.0/#sec-timezoneestring' }, ToBigInt: { url: 'https://262.ecma-international.org/12.0/#sec-tobigint' }, ToBigInt64: { url: 'https://262.ecma-international.org/12.0/#sec-tobigint64' }, ToBigUint64: { url: 'https://262.ecma-international.org/12.0/#sec-tobiguint64' }, ToBoolean: { url: 'https://262.ecma-international.org/12.0/#sec-toboolean' }, ToDateString: { url: 'https://262.ecma-international.org/12.0/#sec-todatestring' }, ToIndex: { url: 'https://262.ecma-international.org/12.0/#sec-toindex' }, ToInt16: { url: 'https://262.ecma-international.org/12.0/#sec-toint16' }, ToInt32: { url: 'https://262.ecma-international.org/12.0/#sec-toint32' }, ToInt8: { url: 'https://262.ecma-international.org/12.0/#sec-toint8' }, ToIntegerOrInfinity: { url: 'https://262.ecma-international.org/12.0/#sec-tointegerorinfinity' }, ToLength: { url: 'https://262.ecma-international.org/12.0/#sec-tolength' }, ToNumber: { url: 'https://262.ecma-international.org/12.0/#sec-tonumber' }, ToNumeric: { url: 'https://262.ecma-international.org/12.0/#sec-tonumeric' }, ToObject: { url: 'https://262.ecma-international.org/12.0/#sec-toobject' }, ToPrimitive: { url: 'https://262.ecma-international.org/12.0/#sec-toprimitive' }, ToPropertyDescriptor: { url: 'https://262.ecma-international.org/12.0/#sec-topropertydescriptor' }, ToPropertyKey: { url: 'https://262.ecma-international.org/12.0/#sec-topropertykey' }, ToString: { url: 'https://262.ecma-international.org/12.0/#sec-tostring' }, ToUint16: { url: 'https://262.ecma-international.org/12.0/#sec-touint16' }, ToUint32: { url: 'https://262.ecma-international.org/12.0/#sec-touint32' }, ToUint8: { url: 'https://262.ecma-international.org/12.0/#sec-touint8' }, ToUint8Clamp: { url: 'https://262.ecma-international.org/12.0/#sec-touint8clamp' }, TriggerPromiseReactions: { url: 'https://262.ecma-international.org/12.0/#sec-triggerpromisereactions' }, TrimString: { url: 'https://262.ecma-international.org/12.0/#sec-trimstring' }, Type: { url: 'https://262.ecma-international.org/12.0/#sec-ecmascript-data-types-and-values' }, TypedArrayCreate: { url: 'https://262.ecma-international.org/12.0/#typedarray-create' }, TypedArraySpeciesCreate: { url: 'https://262.ecma-international.org/12.0/#typedarray-species-create' }, UnicodeEscape: { url: 'https://262.ecma-international.org/12.0/#sec-unicodeescape' }, UnicodeMatchProperty: { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-unicodematchproperty-p' }, UnicodeMatchPropertyValue: { url: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-unicodematchpropertyvalue-p-v' }, UpdateEmpty: { url: 'https://262.ecma-international.org/12.0/#sec-updateempty' }, UTC: { url: 'https://262.ecma-international.org/12.0/#sec-utc-t' }, UTF16EncodeCodePoint: { url: 'https://262.ecma-international.org/12.0/#sec-utf16encodecodepoint' }, UTF16SurrogatePairToCodePoint: { url: 'https://262.ecma-international.org/12.0/#sec-utf16decodesurrogatepair' }, ValidateAndApplyPropertyDescriptor: { url: 'https://262.ecma-international.org/12.0/#sec-validateandapplypropertydescriptor' }, ValidateAtomicAccess: { url: 'https://262.ecma-international.org/12.0/#sec-validateatomicaccess' }, ValidateIntegerTypedArray: { url: 'https://262.ecma-international.org/12.0/#sec-validateintegertypedarray' }, ValidateTypedArray: { url: 'https://262.ecma-international.org/12.0/#sec-validatetypedarray' }, ValueOfReadEvent: { url: 'https://262.ecma-international.org/12.0/#sec-valueofreadevent' }, WeakRefDeref: { url: 'https://262.ecma-international.org/12.0/#sec-weakrefderef' }, WeekDay: { url: 'https://262.ecma-international.org/12.0/#sec-week-day' }, YearFromTime: { url: 'https://262.ecma-international.org/12.0/#eqn-YearFromTime' }, Yield: { url: 'https://262.ecma-international.org/12.0/#sec-yield' } }; es-abstract-1.20.4/operations/2022.js000066400000000000000000001335621431761430200171270ustar00rootroot00000000000000'use strict'; module.exports = { abs: { url: 'https://262.ecma-international.org/13.0/#eqn-abs' }, AddEntriesFromIterable: { url: 'https://262.ecma-international.org/13.0/#sec-add-entries-from-iterable' }, AddRestrictedFunctionProperties: { url: 'https://262.ecma-international.org/13.0/#sec-addrestrictedfunctionproperties' }, AddToKeptObjects: { url: 'https://262.ecma-international.org/13.0/#sec-addtokeptobjects' }, AddWaiter: { url: 'https://262.ecma-international.org/13.0/#sec-addwaiter' }, AdvanceStringIndex: { url: 'https://262.ecma-international.org/13.0/#sec-advancestringindex' }, 'agent-order': { url: 'https://262.ecma-international.org/13.0/#sec-agent-order' }, AgentCanSuspend: { url: 'https://262.ecma-international.org/13.0/#sec-agentcansuspend' }, AgentSignifier: { url: 'https://262.ecma-international.org/13.0/#sec-agentsignifier' }, AllocateArrayBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-allocatearraybuffer' }, AllocateSharedArrayBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-allocatesharedarraybuffer' }, AllocateTypedArray: { url: 'https://262.ecma-international.org/13.0/#sec-allocatetypedarray' }, AllocateTypedArrayBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-allocatetypedarraybuffer' }, ApplyStringOrNumericBinaryOperator: { url: 'https://262.ecma-international.org/13.0/#sec-applystringornumericbinaryoperator' }, ArrayCreate: { url: 'https://262.ecma-international.org/13.0/#sec-arraycreate' }, ArraySetLength: { url: 'https://262.ecma-international.org/13.0/#sec-arraysetlength' }, ArraySpeciesCreate: { url: 'https://262.ecma-international.org/13.0/#sec-arrayspeciescreate' }, AsyncBlockStart: { url: 'https://262.ecma-international.org/13.0/#sec-asyncblockstart' }, AsyncFromSyncIteratorContinuation: { url: 'https://262.ecma-international.org/13.0/#sec-asyncfromsynciteratorcontinuation' }, AsyncFunctionStart: { url: 'https://262.ecma-international.org/13.0/#sec-async-functions-abstract-operations-async-function-start' }, AsyncGeneratorAwaitReturn: { url: 'https://262.ecma-international.org/13.0/#sec-asyncgeneratorawaitreturn' }, AsyncGeneratorCompleteStep: { url: 'https://262.ecma-international.org/13.0/#sec-asyncgeneratorcompletestep' }, AsyncGeneratorDrainQueue: { url: 'https://262.ecma-international.org/13.0/#sec-asyncgeneratordrainqueue' }, AsyncGeneratorEnqueue: { url: 'https://262.ecma-international.org/13.0/#sec-asyncgeneratorenqueue' }, AsyncGeneratorResume: { url: 'https://262.ecma-international.org/13.0/#sec-asyncgeneratorresume' }, AsyncGeneratorStart: { url: 'https://262.ecma-international.org/13.0/#sec-asyncgeneratorstart' }, AsyncGeneratorUnwrapYieldResumption: { url: 'https://262.ecma-international.org/13.0/#sec-asyncgeneratorunwrapyieldresumption' }, AsyncGeneratorValidate: { url: 'https://262.ecma-international.org/13.0/#sec-asyncgeneratorvalidate' }, AsyncGeneratorYield: { url: 'https://262.ecma-international.org/13.0/#sec-asyncgeneratoryield' }, AsyncIteratorClose: { url: 'https://262.ecma-international.org/13.0/#sec-asynciteratorclose' }, AsyncModuleExecutionFulfilled: { url: 'https://262.ecma-international.org/13.0/#sec-async-module-execution-fulfilled' }, AsyncModuleExecutionRejected: { url: 'https://262.ecma-international.org/13.0/#sec-async-module-execution-rejected' }, AtomicReadModifyWrite: { url: 'https://262.ecma-international.org/13.0/#sec-atomicreadmodifywrite' }, Await: { url: 'https://262.ecma-international.org/13.0/#await' }, BackreferenceMatcher: { url: 'https://262.ecma-international.org/13.0/#sec-backreference-matcher' }, 'BigInt::add': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-add' }, 'BigInt::bitwiseAND': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-bitwiseAND' }, 'BigInt::bitwiseNOT': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-bitwiseNOT' }, 'BigInt::bitwiseOR': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-bitwiseOR' }, 'BigInt::bitwiseXOR': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-bitwiseXOR' }, 'BigInt::divide': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-divide' }, 'BigInt::equal': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-equal' }, 'BigInt::exponentiate': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-exponentiate' }, 'BigInt::leftShift': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-leftShift' }, 'BigInt::lessThan': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-lessThan' }, 'BigInt::multiply': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-multiply' }, 'BigInt::remainder': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-remainder' }, 'BigInt::sameValue': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-sameValue' }, 'BigInt::sameValueZero': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-sameValueZero' }, 'BigInt::signedRightShift': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-signedRightShift' }, 'BigInt::subtract': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-subtract' }, 'BigInt::toString': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-tostring' }, 'BigInt::unaryMinus': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-unaryMinus' }, 'BigInt::unsignedRightShift': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-bigint-unsignedRightShift' }, BigIntBitwiseOp: { url: 'https://262.ecma-international.org/13.0/#sec-bigintbitwiseop' }, BinaryAnd: { url: 'https://262.ecma-international.org/13.0/#sec-binaryand' }, BinaryOr: { url: 'https://262.ecma-international.org/13.0/#sec-binaryor' }, BinaryXor: { url: 'https://262.ecma-international.org/13.0/#sec-binaryxor' }, BlockDeclarationInstantiation: { url: 'https://262.ecma-international.org/13.0/#sec-blockdeclarationinstantiation' }, BoundFunctionCreate: { url: 'https://262.ecma-international.org/13.0/#sec-boundfunctioncreate' }, ByteListBitwiseOp: { url: 'https://262.ecma-international.org/13.0/#sec-bytelistbitwiseop' }, ByteListEqual: { url: 'https://262.ecma-international.org/13.0/#sec-bytelistequal' }, Call: { url: 'https://262.ecma-international.org/13.0/#sec-call' }, Canonicalize: { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-canonicalize-ch' }, CanonicalNumericIndexString: { url: 'https://262.ecma-international.org/13.0/#sec-canonicalnumericindexstring' }, CaseClauseIsSelected: { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-caseclauseisselected' }, CharacterRange: { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-characterrange-abstract-operation' }, CharacterRangeOrUnion: { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-characterrangeorunion-abstract-operation' }, CharacterSetMatcher: { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-charactersetmatcher-abstract-operation' }, clamp: { url: 'https://262.ecma-international.org/13.0/#clamping' }, CleanupFinalizationRegistry: { url: 'https://262.ecma-international.org/13.0/#sec-cleanup-finalization-registry' }, ClearKeptObjects: { url: 'https://262.ecma-international.org/13.0/#sec-clear-kept-objects' }, CloneArrayBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-clonearraybuffer' }, CodePointAt: { url: 'https://262.ecma-international.org/13.0/#sec-codepointat' }, CodePointsToString: { url: 'https://262.ecma-international.org/13.0/#sec-codepointstostring' }, CompletePropertyDescriptor: { url: 'https://262.ecma-international.org/13.0/#sec-completepropertydescriptor' }, Completion: { url: 'https://262.ecma-international.org/13.0/#sec-completion-ao' }, ComposeWriteEventBytes: { url: 'https://262.ecma-international.org/13.0/#sec-composewriteeventbytes' }, Construct: { url: 'https://262.ecma-international.org/13.0/#sec-construct' }, CopyDataBlockBytes: { url: 'https://262.ecma-international.org/13.0/#sec-copydatablockbytes' }, CopyDataProperties: { url: 'https://262.ecma-international.org/13.0/#sec-copydataproperties' }, CreateArrayFromList: { url: 'https://262.ecma-international.org/13.0/#sec-createarrayfromlist' }, CreateArrayIterator: { url: 'https://262.ecma-international.org/13.0/#sec-createarrayiterator' }, CreateAsyncFromSyncIterator: { url: 'https://262.ecma-international.org/13.0/#sec-createasyncfromsynciterator' }, CreateAsyncIteratorFromClosure: { url: 'https://262.ecma-international.org/13.0/#sec-createasynciteratorfromclosure' }, CreateBuiltinFunction: { url: 'https://262.ecma-international.org/13.0/#sec-createbuiltinfunction' }, CreateByteDataBlock: { url: 'https://262.ecma-international.org/13.0/#sec-createbytedatablock' }, CreateDataProperty: { url: 'https://262.ecma-international.org/13.0/#sec-createdataproperty' }, CreateDataPropertyOrThrow: { url: 'https://262.ecma-international.org/13.0/#sec-createdatapropertyorthrow' }, CreateDynamicFunction: { url: 'https://262.ecma-international.org/13.0/#sec-createdynamicfunction' }, CreateForInIterator: { url: 'https://262.ecma-international.org/13.0/#sec-createforiniterator' }, CreateHTML: { url: 'https://262.ecma-international.org/13.0/#sec-createhtml' }, CreateIntrinsics: { url: 'https://262.ecma-international.org/13.0/#sec-createintrinsics' }, CreateIteratorFromClosure: { url: 'https://262.ecma-international.org/13.0/#sec-createiteratorfromclosure' }, CreateIterResultObject: { url: 'https://262.ecma-international.org/13.0/#sec-createiterresultobject' }, CreateListFromArrayLike: { url: 'https://262.ecma-international.org/13.0/#sec-createlistfromarraylike' }, CreateListIteratorRecord: { url: 'https://262.ecma-international.org/13.0/#sec-createlistiteratorRecord' }, CreateMapIterator: { url: 'https://262.ecma-international.org/13.0/#sec-createmapiterator' }, CreateMappedArgumentsObject: { url: 'https://262.ecma-international.org/13.0/#sec-createmappedargumentsobject' }, CreateMethodProperty: { url: 'https://262.ecma-international.org/13.0/#sec-createmethodproperty' }, CreateNonEnumerableDataPropertyOrThrow: { url: 'https://262.ecma-international.org/13.0/#sec-createnonenumerabledatapropertyorthrow' }, CreatePerIterationEnvironment: { url: 'https://262.ecma-international.org/13.0/#sec-createperiterationenvironment' }, CreateRealm: { url: 'https://262.ecma-international.org/13.0/#sec-createrealm' }, CreateRegExpStringIterator: { url: 'https://262.ecma-international.org/13.0/#sec-createregexpstringiterator' }, CreateResolvingFunctions: { url: 'https://262.ecma-international.org/13.0/#sec-createresolvingfunctions' }, CreateSetIterator: { url: 'https://262.ecma-international.org/13.0/#sec-createsetiterator' }, CreateSharedByteDataBlock: { url: 'https://262.ecma-international.org/13.0/#sec-createsharedbytedatablock' }, CreateUnmappedArgumentsObject: { url: 'https://262.ecma-international.org/13.0/#sec-createunmappedargumentsobject' }, DateFromTime: { url: 'https://262.ecma-international.org/13.0/#sec-date-number' }, DateString: { url: 'https://262.ecma-international.org/13.0/#sec-datestring' }, Day: { url: 'https://262.ecma-international.org/13.0/#eqn-Day' }, DayFromYear: { url: 'https://262.ecma-international.org/13.0/#eqn-DaysFromYear' }, DaysInYear: { url: 'https://262.ecma-international.org/13.0/#eqn-DaysInYear' }, DayWithinYear: { url: 'https://262.ecma-international.org/13.0/#eqn-DayWithinYear' }, Decode: { url: 'https://262.ecma-international.org/13.0/#sec-decode' }, DefineField: { url: 'https://262.ecma-international.org/13.0/#sec-definefield' }, DefineMethodProperty: { url: 'https://262.ecma-international.org/13.0/#sec-definemethodproperty' }, DefinePropertyOrThrow: { url: 'https://262.ecma-international.org/13.0/#sec-definepropertyorthrow' }, DeletePropertyOrThrow: { url: 'https://262.ecma-international.org/13.0/#sec-deletepropertyorthrow' }, DetachArrayBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-detacharraybuffer' }, Encode: { url: 'https://262.ecma-international.org/13.0/#sec-encode' }, EnterCriticalSection: { url: 'https://262.ecma-international.org/13.0/#sec-entercriticalsection' }, EnumerableOwnPropertyNames: { url: 'https://262.ecma-international.org/13.0/#sec-enumerableownpropertynames' }, EnumerateObjectProperties: { url: 'https://262.ecma-international.org/13.0/#sec-enumerate-object-properties' }, EscapeRegExpPattern: { url: 'https://262.ecma-international.org/13.0/#sec-escaperegexppattern' }, EvalDeclarationInstantiation: { url: 'https://262.ecma-international.org/13.0/#sec-evaldeclarationinstantiation' }, EvaluateCall: { url: 'https://262.ecma-international.org/13.0/#sec-evaluatecall' }, EvaluateNew: { url: 'https://262.ecma-international.org/13.0/#sec-evaluatenew' }, EvaluatePropertyAccessWithExpressionKey: { url: 'https://262.ecma-international.org/13.0/#sec-evaluate-property-access-with-expression-key' }, EvaluatePropertyAccessWithIdentifierKey: { url: 'https://262.ecma-international.org/13.0/#sec-evaluate-property-access-with-identifier-key' }, EvaluateStringOrNumericBinaryExpression: { url: 'https://262.ecma-international.org/13.0/#sec-evaluatestringornumericbinaryexpression' }, EventSet: { url: 'https://262.ecma-international.org/13.0/#sec-event-set' }, ExecuteAsyncModule: { url: 'https://262.ecma-international.org/13.0/#sec-execute-async-module' }, FinishDynamicImport: { url: 'https://262.ecma-international.org/13.0/#sec-finishdynamicimport' }, FlattenIntoArray: { url: 'https://262.ecma-international.org/13.0/#sec-flattenintoarray' }, floor: { url: 'https://262.ecma-international.org/13.0/#eqn-floor' }, ForBodyEvaluation: { url: 'https://262.ecma-international.org/13.0/#sec-forbodyevaluation' }, 'ForIn/OfBodyEvaluation': { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset' }, 'ForIn/OfHeadEvaluation': { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-forinofheadevaluation' }, FromPropertyDescriptor: { url: 'https://262.ecma-international.org/13.0/#sec-frompropertydescriptor' }, FulfillPromise: { url: 'https://262.ecma-international.org/13.0/#sec-fulfillpromise' }, FunctionDeclarationInstantiation: { url: 'https://262.ecma-international.org/13.0/#sec-functiondeclarationinstantiation' }, GatherAvailableAncestors: { url: 'https://262.ecma-international.org/13.0/#sec-gather-available-ancestors' }, GeneratorResume: { url: 'https://262.ecma-international.org/13.0/#sec-generatorresume' }, GeneratorResumeAbrupt: { url: 'https://262.ecma-international.org/13.0/#sec-generatorresumeabrupt' }, GeneratorStart: { url: 'https://262.ecma-international.org/13.0/#sec-generatorstart' }, GeneratorValidate: { url: 'https://262.ecma-international.org/13.0/#sec-generatorvalidate' }, GeneratorYield: { url: 'https://262.ecma-international.org/13.0/#sec-generatoryield' }, Get: { url: 'https://262.ecma-international.org/13.0/#sec-get-o-p' }, GetActiveScriptOrModule: { url: 'https://262.ecma-international.org/13.0/#sec-getactivescriptormodule' }, GetFunctionRealm: { url: 'https://262.ecma-international.org/13.0/#sec-getfunctionrealm' }, GetGeneratorKind: { url: 'https://262.ecma-international.org/13.0/#sec-getgeneratorkind' }, GetGlobalObject: { url: 'https://262.ecma-international.org/13.0/#sec-getglobalobject' }, GetIdentifierReference: { url: 'https://262.ecma-international.org/13.0/#sec-getidentifierreference' }, GetIterator: { url: 'https://262.ecma-international.org/13.0/#sec-getiterator' }, GetMatchIndexPair: { url: 'https://262.ecma-international.org/13.0/#sec-getmatchindexpair' }, GetMatchString: { url: 'https://262.ecma-international.org/13.0/#sec-getmatchstring' }, GetMethod: { url: 'https://262.ecma-international.org/13.0/#sec-getmethod' }, GetModifySetValueInBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-getmodifysetvalueinbuffer' }, GetModuleNamespace: { url: 'https://262.ecma-international.org/13.0/#sec-getmodulenamespace' }, GetNewTarget: { url: 'https://262.ecma-international.org/13.0/#sec-getnewtarget' }, GetOwnPropertyKeys: { url: 'https://262.ecma-international.org/13.0/#sec-getownpropertykeys' }, GetPromiseResolve: { url: 'https://262.ecma-international.org/13.0/#sec-getpromiseresolve' }, GetPrototypeFromConstructor: { url: 'https://262.ecma-international.org/13.0/#sec-getprototypefromconstructor' }, GetStringIndex: { url: 'https://262.ecma-international.org/13.0/#sec-getstringindex' }, GetSubstitution: { url: 'https://262.ecma-international.org/13.0/#sec-getsubstitution' }, GetSuperConstructor: { url: 'https://262.ecma-international.org/13.0/#sec-getsuperconstructor' }, GetTemplateObject: { url: 'https://262.ecma-international.org/13.0/#sec-gettemplateobject' }, GetThisEnvironment: { url: 'https://262.ecma-international.org/13.0/#sec-getthisenvironment' }, GetThisValue: { url: 'https://262.ecma-international.org/13.0/#sec-getthisvalue' }, GetV: { url: 'https://262.ecma-international.org/13.0/#sec-getv' }, GetValue: { url: 'https://262.ecma-international.org/13.0/#sec-getvalue' }, GetValueFromBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-getvaluefrombuffer' }, GetViewValue: { url: 'https://262.ecma-international.org/13.0/#sec-getviewvalue' }, GetWaiterList: { url: 'https://262.ecma-international.org/13.0/#sec-getwaiterlist' }, GlobalDeclarationInstantiation: { url: 'https://262.ecma-international.org/13.0/#sec-globaldeclarationinstantiation' }, 'happens-before': { url: 'https://262.ecma-international.org/13.0/#sec-happens-before' }, HasOwnProperty: { url: 'https://262.ecma-international.org/13.0/#sec-hasownproperty' }, HasProperty: { url: 'https://262.ecma-international.org/13.0/#sec-hasproperty' }, 'host-synchronizes-with': { url: 'https://262.ecma-international.org/13.0/#sec-host-synchronizes-with' }, HostCallJobCallback: { url: 'https://262.ecma-international.org/13.0/#sec-hostcalljobcallback' }, HostEnqueueFinalizationRegistryCleanupJob: { url: 'https://262.ecma-international.org/13.0/#sec-host-cleanup-finalization-registry' }, HostEnqueuePromiseJob: { url: 'https://262.ecma-international.org/13.0/#sec-hostenqueuepromisejob' }, HostEnsureCanCompileStrings: { url: 'https://262.ecma-international.org/13.0/#sec-hostensurecancompilestrings' }, HostEventSet: { url: 'https://262.ecma-international.org/13.0/#sec-hosteventset' }, HostFinalizeImportMeta: { url: 'https://262.ecma-international.org/13.0/#sec-hostfinalizeimportmeta' }, HostGetImportMetaProperties: { url: 'https://262.ecma-international.org/13.0/#sec-hostgetimportmetaproperties' }, HostHasSourceTextAvailable: { url: 'https://262.ecma-international.org/13.0/#sec-hosthassourcetextavailable' }, HostImportModuleDynamically: { url: 'https://262.ecma-international.org/13.0/#sec-hostimportmoduledynamically' }, HostMakeJobCallback: { url: 'https://262.ecma-international.org/13.0/#sec-hostmakejobcallback' }, HostPromiseRejectionTracker: { url: 'https://262.ecma-international.org/13.0/#sec-host-promise-rejection-tracker' }, HostResolveImportedModule: { url: 'https://262.ecma-international.org/13.0/#sec-hostresolveimportedmodule' }, HourFromTime: { url: 'https://262.ecma-international.org/13.0/#eqn-HourFromTime' }, IfAbruptCloseIterator: { url: 'https://262.ecma-international.org/13.0/#sec-ifabruptcloseiterator' }, IfAbruptRejectPromise: { url: 'https://262.ecma-international.org/13.0/#sec-ifabruptrejectpromise' }, ImportedLocalNames: { url: 'https://262.ecma-international.org/13.0/#sec-importedlocalnames' }, InitializeBoundName: { url: 'https://262.ecma-international.org/13.0/#sec-initializeboundname' }, InitializeHostDefinedRealm: { url: 'https://262.ecma-international.org/13.0/#sec-initializehostdefinedrealm' }, InitializeInstanceElements: { url: 'https://262.ecma-international.org/13.0/#sec-initializeinstanceelements' }, InitializeReferencedBinding: { url: 'https://262.ecma-international.org/13.0/#sec-initializereferencedbinding' }, InitializeTypedArrayFromArrayBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-initializetypedarrayfromarraybuffer' }, InitializeTypedArrayFromArrayLike: { url: 'https://262.ecma-international.org/13.0/#sec-initializetypedarrayfromarraylike' }, InitializeTypedArrayFromList: { url: 'https://262.ecma-international.org/13.0/#sec-initializetypedarrayfromlist' }, InitializeTypedArrayFromTypedArray: { url: 'https://262.ecma-international.org/13.0/#sec-initializetypedarrayfromtypedarray' }, InLeapYear: { url: 'https://262.ecma-international.org/13.0/#eqn-InLeapYear' }, InnerModuleEvaluation: { url: 'https://262.ecma-international.org/13.0/#sec-innermoduleevaluation' }, InnerModuleLinking: { url: 'https://262.ecma-international.org/13.0/#sec-InnerModuleLinking' }, InstallErrorCause: { url: 'https://262.ecma-international.org/13.0/#sec-installerrorcause' }, InstanceofOperator: { url: 'https://262.ecma-international.org/13.0/#sec-instanceofoperator' }, IntegerIndexedElementGet: { url: 'https://262.ecma-international.org/13.0/#sec-integerindexedelementget' }, IntegerIndexedElementSet: { url: 'https://262.ecma-international.org/13.0/#sec-integerindexedelementset' }, IntegerIndexedObjectCreate: { url: 'https://262.ecma-international.org/13.0/#sec-integerindexedobjectcreate' }, InternalizeJSONProperty: { url: 'https://262.ecma-international.org/13.0/#sec-internalizejsonproperty' }, Invoke: { url: 'https://262.ecma-international.org/13.0/#sec-invoke' }, IsAccessorDescriptor: { url: 'https://262.ecma-international.org/13.0/#sec-isaccessordescriptor' }, IsAnonymousFunctionDefinition: { url: 'https://262.ecma-international.org/13.0/#sec-isanonymousfunctiondefinition' }, IsArray: { url: 'https://262.ecma-international.org/13.0/#sec-isarray' }, IsBigIntElementType: { url: 'https://262.ecma-international.org/13.0/#sec-isbigintelementtype' }, IsCallable: { url: 'https://262.ecma-international.org/13.0/#sec-iscallable' }, IsCompatiblePropertyDescriptor: { url: 'https://262.ecma-international.org/13.0/#sec-iscompatiblepropertydescriptor' }, IsConcatSpreadable: { url: 'https://262.ecma-international.org/13.0/#sec-isconcatspreadable' }, IsConstructor: { url: 'https://262.ecma-international.org/13.0/#sec-isconstructor' }, IsDataDescriptor: { url: 'https://262.ecma-international.org/13.0/#sec-isdatadescriptor' }, IsDetachedBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-isdetachedbuffer' }, IsExtensible: { url: 'https://262.ecma-international.org/13.0/#sec-isextensible-o' }, IsGenericDescriptor: { url: 'https://262.ecma-international.org/13.0/#sec-isgenericdescriptor' }, IsInTailPosition: { url: 'https://262.ecma-international.org/13.0/#sec-isintailposition' }, IsIntegralNumber: { url: 'https://262.ecma-international.org/13.0/#sec-isintegralnumber' }, IsLabelledFunction: { url: 'https://262.ecma-international.org/13.0/#sec-islabelledfunction' }, IsLessThan: { url: 'https://262.ecma-international.org/13.0/#sec-islessthan' }, IsLooselyEqual: { url: 'https://262.ecma-international.org/13.0/#sec-islooselyequal' }, IsNoTearConfiguration: { url: 'https://262.ecma-international.org/13.0/#sec-isnotearconfiguration' }, IsPrivateReference: { url: 'https://262.ecma-international.org/13.0/#sec-isprivatereference' }, IsPromise: { url: 'https://262.ecma-international.org/13.0/#sec-ispromise' }, IsPropertyKey: { url: 'https://262.ecma-international.org/13.0/#sec-ispropertykey' }, IsPropertyReference: { url: 'https://262.ecma-international.org/13.0/#sec-ispropertyreference' }, IsRegExp: { url: 'https://262.ecma-international.org/13.0/#sec-isregexp' }, IsSharedArrayBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-issharedarraybuffer' }, IsStrictlyEqual: { url: 'https://262.ecma-international.org/13.0/#sec-isstrictlyequal' }, IsStringPrefix: { url: 'https://262.ecma-international.org/13.0/#sec-isstringprefix' }, IsStringWellFormedUnicode: { url: 'https://262.ecma-international.org/13.0/#sec-isstringwellformedunicode' }, IsSuperReference: { url: 'https://262.ecma-international.org/13.0/#sec-issuperreference' }, IsUnclampedIntegerElementType: { url: 'https://262.ecma-international.org/13.0/#sec-isunclampedintegerelementtype' }, IsUnresolvableReference: { url: 'https://262.ecma-international.org/13.0/#sec-isunresolvablereference' }, IsUnsignedElementType: { url: 'https://262.ecma-international.org/13.0/#sec-isunsignedelementtype' }, IsValidIntegerIndex: { url: 'https://262.ecma-international.org/13.0/#sec-isvalidintegerindex' }, IsValidRegularExpressionLiteral: { url: 'https://262.ecma-international.org/13.0/#sec-isvalidregularexpressionliteral' }, IsWordChar: { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-iswordchar-abstract-operation' }, IterableToList: { url: 'https://262.ecma-international.org/13.0/#sec-iterabletolist' }, IteratorClose: { url: 'https://262.ecma-international.org/13.0/#sec-iteratorclose' }, IteratorComplete: { url: 'https://262.ecma-international.org/13.0/#sec-iteratorcomplete' }, IteratorNext: { url: 'https://262.ecma-international.org/13.0/#sec-iteratornext' }, IteratorStep: { url: 'https://262.ecma-international.org/13.0/#sec-iteratorstep' }, IteratorValue: { url: 'https://262.ecma-international.org/13.0/#sec-iteratorvalue' }, LeaveCriticalSection: { url: 'https://262.ecma-international.org/13.0/#sec-leavecriticalsection' }, LengthOfArrayLike: { url: 'https://262.ecma-international.org/13.0/#sec-lengthofarraylike' }, LocalTime: { url: 'https://262.ecma-international.org/13.0/#sec-localtime' }, LocalTZA: { url: 'https://262.ecma-international.org/13.0/#sec-local-time-zone-adjustment' }, LoopContinues: { url: 'https://262.ecma-international.org/13.0/#sec-loopcontinues' }, MakeArgGetter: { url: 'https://262.ecma-international.org/13.0/#sec-makearggetter' }, MakeArgSetter: { url: 'https://262.ecma-international.org/13.0/#sec-makeargsetter' }, MakeBasicObject: { url: 'https://262.ecma-international.org/13.0/#sec-makebasicobject' }, MakeClassConstructor: { url: 'https://262.ecma-international.org/13.0/#sec-makeclassconstructor' }, MakeConstructor: { url: 'https://262.ecma-international.org/13.0/#sec-makeconstructor' }, MakeDate: { url: 'https://262.ecma-international.org/13.0/#sec-makedate' }, MakeDay: { url: 'https://262.ecma-international.org/13.0/#sec-makeday' }, MakeMatchIndicesIndexPairArray: { url: 'https://262.ecma-international.org/13.0/#sec-makematchindicesindexpairarray' }, MakeMethod: { url: 'https://262.ecma-international.org/13.0/#sec-makemethod' }, MakePrivateReference: { url: 'https://262.ecma-international.org/13.0/#sec-makeprivatereference' }, MakeSuperPropertyReference: { url: 'https://262.ecma-international.org/13.0/#sec-makesuperpropertyreference' }, MakeTime: { url: 'https://262.ecma-international.org/13.0/#sec-maketime' }, max: { url: 'https://262.ecma-international.org/13.0/#eqn-max' }, 'memory-order': { url: 'https://262.ecma-international.org/13.0/#sec-memory-order' }, min: { url: 'https://262.ecma-international.org/13.0/#eqn-min' }, MinFromTime: { url: 'https://262.ecma-international.org/13.0/#eqn-MinFromTime' }, ModuleNamespaceCreate: { url: 'https://262.ecma-international.org/13.0/#sec-modulenamespacecreate' }, modulo: { url: 'https://262.ecma-international.org/13.0/#eqn-modulo' }, MonthFromTime: { url: 'https://262.ecma-international.org/13.0/#eqn-MonthFromTime' }, msFromTime: { url: 'https://262.ecma-international.org/13.0/#eqn-msFromTime' }, NewDeclarativeEnvironment: { url: 'https://262.ecma-international.org/13.0/#sec-newdeclarativeenvironment' }, NewFunctionEnvironment: { url: 'https://262.ecma-international.org/13.0/#sec-newfunctionenvironment' }, NewGlobalEnvironment: { url: 'https://262.ecma-international.org/13.0/#sec-newglobalenvironment' }, NewModuleEnvironment: { url: 'https://262.ecma-international.org/13.0/#sec-newmoduleenvironment' }, NewObjectEnvironment: { url: 'https://262.ecma-international.org/13.0/#sec-newobjectenvironment' }, NewPrivateEnvironment: { url: 'https://262.ecma-international.org/13.0/#sec-newprivateenvironment' }, NewPromiseCapability: { url: 'https://262.ecma-international.org/13.0/#sec-newpromisecapability' }, NewPromiseReactionJob: { url: 'https://262.ecma-international.org/13.0/#sec-newpromisereactionjob' }, NewPromiseResolveThenableJob: { url: 'https://262.ecma-international.org/13.0/#sec-newpromiseresolvethenablejob' }, NormalCompletion: { url: 'https://262.ecma-international.org/13.0/#sec-normalcompletion' }, NotifyWaiter: { url: 'https://262.ecma-international.org/13.0/#sec-notifywaiter' }, 'Number::add': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-add' }, 'Number::bitwiseAND': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-bitwiseAND' }, 'Number::bitwiseNOT': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-bitwiseNOT' }, 'Number::bitwiseOR': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-bitwiseOR' }, 'Number::bitwiseXOR': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-bitwiseXOR' }, 'Number::divide': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-divide' }, 'Number::equal': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-equal' }, 'Number::exponentiate': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-exponentiate' }, 'Number::leftShift': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-leftShift' }, 'Number::lessThan': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-lessThan' }, 'Number::multiply': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-multiply' }, 'Number::remainder': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-remainder' }, 'Number::sameValue': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-sameValue' }, 'Number::sameValueZero': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-sameValueZero' }, 'Number::signedRightShift': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-signedRightShift' }, 'Number::subtract': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-subtract' }, 'Number::toString': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-tostring' }, 'Number::unaryMinus': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-unaryMinus' }, 'Number::unsignedRightShift': { url: 'https://262.ecma-international.org/13.0/#sec-numeric-types-number-unsignedRightShift' }, NumberBitwiseOp: { url: 'https://262.ecma-international.org/13.0/#sec-numberbitwiseop' }, NumberToBigInt: { url: 'https://262.ecma-international.org/13.0/#sec-numbertobigint' }, NumericToRawBytes: { url: 'https://262.ecma-international.org/13.0/#sec-numerictorawbytes' }, ObjectDefineProperties: { url: 'https://262.ecma-international.org/13.0/#sec-objectdefineproperties' }, OrdinaryCallBindThis: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarycallbindthis' }, OrdinaryCallEvaluateBody: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarycallevaluatebody' }, OrdinaryCreateFromConstructor: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarycreatefromconstructor' }, OrdinaryDefineOwnProperty: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarydefineownproperty' }, OrdinaryDelete: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarydelete' }, OrdinaryFunctionCreate: { url: 'https://262.ecma-international.org/13.0/#sec-ordinaryfunctioncreate' }, OrdinaryGet: { url: 'https://262.ecma-international.org/13.0/#sec-ordinaryget' }, OrdinaryGetOwnProperty: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarygetownproperty' }, OrdinaryGetPrototypeOf: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarygetprototypeof' }, OrdinaryHasInstance: { url: 'https://262.ecma-international.org/13.0/#sec-ordinaryhasinstance' }, OrdinaryHasProperty: { url: 'https://262.ecma-international.org/13.0/#sec-ordinaryhasproperty' }, OrdinaryIsExtensible: { url: 'https://262.ecma-international.org/13.0/#sec-ordinaryisextensible' }, OrdinaryObjectCreate: { url: 'https://262.ecma-international.org/13.0/#sec-ordinaryobjectcreate' }, OrdinaryOwnPropertyKeys: { url: 'https://262.ecma-international.org/13.0/#sec-ordinaryownpropertykeys' }, OrdinaryPreventExtensions: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarypreventextensions' }, OrdinarySet: { url: 'https://262.ecma-international.org/13.0/#sec-ordinaryset' }, OrdinarySetPrototypeOf: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarysetprototypeof' }, OrdinarySetWithOwnDescriptor: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarysetwithowndescriptor' }, OrdinaryToPrimitive: { url: 'https://262.ecma-international.org/13.0/#sec-ordinarytoprimitive' }, ParseModule: { url: 'https://262.ecma-international.org/13.0/#sec-parsemodule' }, ParsePattern: { url: 'https://262.ecma-international.org/13.0/#sec-parsepattern' }, ParseScript: { url: 'https://262.ecma-international.org/13.0/#sec-parse-script' }, ParseText: { url: 'https://262.ecma-international.org/13.0/#sec-parsetext' }, PerformEval: { url: 'https://262.ecma-international.org/13.0/#sec-performeval' }, PerformPromiseAll: { url: 'https://262.ecma-international.org/13.0/#sec-performpromiseall' }, PerformPromiseAllSettled: { url: 'https://262.ecma-international.org/13.0/#sec-performpromiseallsettled' }, PerformPromiseAny: { url: 'https://262.ecma-international.org/13.0/#sec-performpromiseany' }, PerformPromiseRace: { url: 'https://262.ecma-international.org/13.0/#sec-performpromiserace' }, PerformPromiseThen: { url: 'https://262.ecma-international.org/13.0/#sec-performpromisethen' }, PrepareForOrdinaryCall: { url: 'https://262.ecma-international.org/13.0/#sec-prepareforordinarycall' }, PrepareForTailCall: { url: 'https://262.ecma-international.org/13.0/#sec-preparefortailcall' }, PrivateElementFind: { url: 'https://262.ecma-international.org/13.0/#sec-privateelementfind' }, PrivateFieldAdd: { url: 'https://262.ecma-international.org/13.0/#sec-privatefieldadd' }, PrivateGet: { url: 'https://262.ecma-international.org/13.0/#sec-privateget' }, PrivateMethodOrAccessorAdd: { url: 'https://262.ecma-international.org/13.0/#sec-privatemethodoraccessoradd' }, PrivateSet: { url: 'https://262.ecma-international.org/13.0/#sec-privateset' }, PromiseResolve: { url: 'https://262.ecma-international.org/13.0/#sec-promise-resolve' }, ProxyCreate: { url: 'https://262.ecma-international.org/13.0/#sec-proxycreate' }, PutValue: { url: 'https://262.ecma-international.org/13.0/#sec-putvalue' }, QuoteJSONString: { url: 'https://262.ecma-international.org/13.0/#sec-quotejsonstring' }, RawBytesToNumeric: { url: 'https://262.ecma-international.org/13.0/#sec-rawbytestonumeric' }, 'reads-bytes-from': { url: 'https://262.ecma-international.org/13.0/#sec-reads-bytes-from' }, 'reads-from': { url: 'https://262.ecma-international.org/13.0/#sec-reads-from' }, RegExpAlloc: { url: 'https://262.ecma-international.org/13.0/#sec-regexpalloc' }, RegExpBuiltinExec: { url: 'https://262.ecma-international.org/13.0/#sec-regexpbuiltinexec' }, RegExpCreate: { url: 'https://262.ecma-international.org/13.0/#sec-regexpcreate' }, RegExpExec: { url: 'https://262.ecma-international.org/13.0/#sec-regexpexec' }, RegExpHasFlag: { url: 'https://262.ecma-international.org/13.0/#sec-regexphasflag' }, RegExpInitialize: { url: 'https://262.ecma-international.org/13.0/#sec-regexpinitialize' }, RejectPromise: { url: 'https://262.ecma-international.org/13.0/#sec-rejectpromise' }, RemoveWaiter: { url: 'https://262.ecma-international.org/13.0/#sec-removewaiter' }, RemoveWaiters: { url: 'https://262.ecma-international.org/13.0/#sec-removewaiters' }, RepeatMatcher: { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-repeatmatcher-abstract-operation' }, RequireInternalSlot: { url: 'https://262.ecma-international.org/13.0/#sec-requireinternalslot' }, RequireObjectCoercible: { url: 'https://262.ecma-international.org/13.0/#sec-requireobjectcoercible' }, ResolveBinding: { url: 'https://262.ecma-international.org/13.0/#sec-resolvebinding' }, ResolvePrivateIdentifier: { url: 'https://262.ecma-international.org/13.0/#sec-resolve-private-identifier' }, ResolveThisBinding: { url: 'https://262.ecma-international.org/13.0/#sec-resolvethisbinding' }, ReturnIfAbrupt: { url: 'https://262.ecma-international.org/13.0/#sec-returnifabrupt' }, RoundMVResult: { url: 'https://262.ecma-international.org/13.0/#sec-roundmvresult' }, SameValue: { url: 'https://262.ecma-international.org/13.0/#sec-samevalue' }, SameValueNonNumeric: { url: 'https://262.ecma-international.org/13.0/#sec-samevaluenonnumeric' }, SameValueZero: { url: 'https://262.ecma-international.org/13.0/#sec-samevaluezero' }, ScriptEvaluation: { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-scriptevaluation' }, SecFromTime: { url: 'https://262.ecma-international.org/13.0/#eqn-SecFromTime' }, SerializeJSONArray: { url: 'https://262.ecma-international.org/13.0/#sec-serializejsonarray' }, SerializeJSONObject: { url: 'https://262.ecma-international.org/13.0/#sec-serializejsonobject' }, SerializeJSONProperty: { url: 'https://262.ecma-international.org/13.0/#sec-serializejsonproperty' }, Set: { url: 'https://262.ecma-international.org/13.0/#sec-set-o-p-v-throw' }, SetDefaultGlobalBindings: { url: 'https://262.ecma-international.org/13.0/#sec-setdefaultglobalbindings' }, SetFunctionLength: { url: 'https://262.ecma-international.org/13.0/#sec-setfunctionlength' }, SetFunctionName: { url: 'https://262.ecma-international.org/13.0/#sec-setfunctionname' }, SetImmutablePrototype: { url: 'https://262.ecma-international.org/13.0/#sec-set-immutable-prototype' }, SetIntegrityLevel: { url: 'https://262.ecma-international.org/13.0/#sec-setintegritylevel' }, SetRealmGlobalObject: { url: 'https://262.ecma-international.org/13.0/#sec-setrealmglobalobject' }, SetTypedArrayFromArrayLike: { url: 'https://262.ecma-international.org/13.0/#sec-settypedarrayfromarraylike' }, SetTypedArrayFromTypedArray: { url: 'https://262.ecma-international.org/13.0/#sec-settypedarrayfromtypedarray' }, SetValueInBuffer: { url: 'https://262.ecma-international.org/13.0/#sec-setvalueinbuffer' }, SetViewValue: { url: 'https://262.ecma-international.org/13.0/#sec-setviewvalue' }, SharedDataBlockEventSet: { url: 'https://262.ecma-international.org/13.0/#sec-sharedatablockeventset' }, SortIndexedProperties: { url: 'https://262.ecma-international.org/13.0/#sec-sortindexedproperties' }, SpeciesConstructor: { url: 'https://262.ecma-international.org/13.0/#sec-speciesconstructor' }, StringCreate: { url: 'https://262.ecma-international.org/13.0/#sec-stringcreate' }, StringGetOwnProperty: { url: 'https://262.ecma-international.org/13.0/#sec-stringgetownproperty' }, StringIndexOf: { url: 'https://262.ecma-international.org/13.0/#sec-stringindexof' }, StringPad: { url: 'https://262.ecma-international.org/13.0/#sec-stringpad' }, StringToBigInt: { url: 'https://262.ecma-international.org/13.0/#sec-stringtobigint' }, StringToCodePoints: { url: 'https://262.ecma-international.org/13.0/#sec-stringtocodepoints' }, StringToNumber: { url: 'https://262.ecma-international.org/13.0/#sec-stringtonumber' }, substring: { url: 'https://262.ecma-international.org/13.0/#substring' }, SuspendAgent: { url: 'https://262.ecma-international.org/13.0/#sec-suspendagent' }, SymbolDescriptiveString: { url: 'https://262.ecma-international.org/13.0/#sec-symboldescriptivestring' }, 'synchronizes-with': { url: 'https://262.ecma-international.org/13.0/#sec-synchronizes-with' }, TestIntegrityLevel: { url: 'https://262.ecma-international.org/13.0/#sec-testintegritylevel' }, thisBigIntValue: { url: 'https://262.ecma-international.org/13.0/#thisbigintvalue' }, thisBooleanValue: { url: 'https://262.ecma-international.org/13.0/#thisbooleanvalue' }, thisNumberValue: { url: 'https://262.ecma-international.org/13.0/#thisnumbervalue' }, thisStringValue: { url: 'https://262.ecma-international.org/13.0/#thisstringvalue' }, thisSymbolValue: { url: 'https://262.ecma-international.org/13.0/#thissymbolvalue' }, thisTimeValue: { url: 'https://262.ecma-international.org/13.0/#thistimevalue' }, ThrowCompletion: { url: 'https://262.ecma-international.org/13.0/#sec-throwcompletion' }, TimeClip: { url: 'https://262.ecma-international.org/13.0/#sec-timeclip' }, TimeFromYear: { url: 'https://262.ecma-international.org/13.0/#eqn-TimeFromYear' }, TimeString: { url: 'https://262.ecma-international.org/13.0/#sec-timestring' }, TimeWithinDay: { url: 'https://262.ecma-international.org/13.0/#eqn-TimeWithinDay' }, TimeZoneString: { url: 'https://262.ecma-international.org/13.0/#sec-timezoneestring' }, ToBigInt: { url: 'https://262.ecma-international.org/13.0/#sec-tobigint' }, ToBigInt64: { url: 'https://262.ecma-international.org/13.0/#sec-tobigint64' }, ToBigUint64: { url: 'https://262.ecma-international.org/13.0/#sec-tobiguint64' }, ToBoolean: { url: 'https://262.ecma-international.org/13.0/#sec-toboolean' }, ToDateString: { url: 'https://262.ecma-international.org/13.0/#sec-todatestring' }, ToIndex: { url: 'https://262.ecma-international.org/13.0/#sec-toindex' }, ToInt16: { url: 'https://262.ecma-international.org/13.0/#sec-toint16' }, ToInt32: { url: 'https://262.ecma-international.org/13.0/#sec-toint32' }, ToInt8: { url: 'https://262.ecma-international.org/13.0/#sec-toint8' }, ToIntegerOrInfinity: { url: 'https://262.ecma-international.org/13.0/#sec-tointegerorinfinity' }, ToLength: { url: 'https://262.ecma-international.org/13.0/#sec-tolength' }, ToNumber: { url: 'https://262.ecma-international.org/13.0/#sec-tonumber' }, ToNumeric: { url: 'https://262.ecma-international.org/13.0/#sec-tonumeric' }, ToObject: { url: 'https://262.ecma-international.org/13.0/#sec-toobject' }, ToPrimitive: { url: 'https://262.ecma-international.org/13.0/#sec-toprimitive' }, ToPropertyDescriptor: { url: 'https://262.ecma-international.org/13.0/#sec-topropertydescriptor' }, ToPropertyKey: { url: 'https://262.ecma-international.org/13.0/#sec-topropertykey' }, ToString: { url: 'https://262.ecma-international.org/13.0/#sec-tostring' }, ToUint16: { url: 'https://262.ecma-international.org/13.0/#sec-touint16' }, ToUint32: { url: 'https://262.ecma-international.org/13.0/#sec-touint32' }, ToUint8: { url: 'https://262.ecma-international.org/13.0/#sec-touint8' }, ToUint8Clamp: { url: 'https://262.ecma-international.org/13.0/#sec-touint8clamp' }, ToZeroPaddedDecimalString: { url: 'https://262.ecma-international.org/13.0/#sec-tozeropaddeddecimalstring' }, TriggerPromiseReactions: { url: 'https://262.ecma-international.org/13.0/#sec-triggerpromisereactions' }, TrimString: { url: 'https://262.ecma-international.org/13.0/#sec-trimstring' }, Type: { url: 'https://262.ecma-international.org/13.0/#sec-ecmascript-data-types-and-values' }, TypedArrayCreate: { url: 'https://262.ecma-international.org/13.0/#typedarray-create' }, TypedArrayElementSize: { url: 'https://262.ecma-international.org/13.0/#sec-typedarrayelementsize' }, TypedArrayElementType: { url: 'https://262.ecma-international.org/13.0/#sec-typedarrayelementtype' }, TypedArraySpeciesCreate: { url: 'https://262.ecma-international.org/13.0/#typedarray-species-create' }, UnicodeEscape: { url: 'https://262.ecma-international.org/13.0/#sec-unicodeescape' }, UnicodeMatchProperty: { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-unicodematchproperty-p' }, UnicodeMatchPropertyValue: { url: 'https://262.ecma-international.org/13.0/#sec-runtime-semantics-unicodematchpropertyvalue-p-v' }, UpdateEmpty: { url: 'https://262.ecma-international.org/13.0/#sec-updateempty' }, UTC: { url: 'https://262.ecma-international.org/13.0/#sec-utc-t' }, UTF16EncodeCodePoint: { url: 'https://262.ecma-international.org/13.0/#sec-utf16encodecodepoint' }, UTF16SurrogatePairToCodePoint: { url: 'https://262.ecma-international.org/13.0/#sec-utf16decodesurrogatepair' }, ValidateAndApplyPropertyDescriptor: { url: 'https://262.ecma-international.org/13.0/#sec-validateandapplypropertydescriptor' }, ValidateAtomicAccess: { url: 'https://262.ecma-international.org/13.0/#sec-validateatomicaccess' }, ValidateIntegerTypedArray: { url: 'https://262.ecma-international.org/13.0/#sec-validateintegertypedarray' }, ValidateTypedArray: { url: 'https://262.ecma-international.org/13.0/#sec-validatetypedarray' }, ValueOfReadEvent: { url: 'https://262.ecma-international.org/13.0/#sec-valueofreadevent' }, WeakRefDeref: { url: 'https://262.ecma-international.org/13.0/#sec-weakrefderef' }, WeekDay: { url: 'https://262.ecma-international.org/13.0/#sec-week-day' }, YearFromTime: { url: 'https://262.ecma-international.org/13.0/#eqn-YearFromTime' }, Yield: { url: 'https://262.ecma-international.org/13.0/#sec-yield' } }; es-abstract-1.20.4/operations/deltas.js000066400000000000000000000012541431761430200200060ustar00rootroot00000000000000'use strict'; const diff = require('diff'); const years = require('./years'); const keys = ['../es5'].concat(years).map((x) => [ x, Object.keys(require(`./${x}`)).sort(), // eslint-disable-line global-require ]); const results = Object.fromEntries([5].concat(years).map((y) => [ y, { added: new Set(), removed: new Set() }, ])); function parse(from, to, result) { diff.diffArrays(from, to).forEach((x) => { x.value.forEach((v) => { if (x.added) { result.added.add(v); } if (x.removed) { result.removed.add(v.replace(/ /g, '')); } }); }); } keys.reduce(([, pK], [y, k]) => { parse(pK, k, results[y]); return [y, k]; }); module.exports = results; es-abstract-1.20.4/operations/es5.js000066400000000000000000000061041431761430200172250ustar00rootroot00000000000000'use strict'; module.exports = { 'Abstract Equality Comparison': 'https://262.ecma-international.org/5.1/#sec-11.9.3', 'Abstract Relational Comparison': 'https://262.ecma-international.org/5.1/#sec-11.8.5', 'Strict Equality Comparison': 'https://262.ecma-international.org/5.1/#sec-11.9.6', abs: 'http://262.ecma-international.org/5.1/#sec-5.2', CheckObjectCoercible: 'https://262.ecma-international.org/5.1/#sec-9.10', DateFromTime: 'https://262.ecma-international.org/5.1/#sec-15.9.1.5', Day: 'https://262.ecma-international.org/5.1/#sec-15.9.1.2', DayFromYear: 'https://262.ecma-international.org/5.1/#sec-15.9.1.3', DaysInYear: 'https://262.ecma-international.org/5.1/#sec-15.9.1.3', DayWithinYear: 'https://262.ecma-international.org/5.1/#sec-15.9.1.4', floor: 'http://262.ecma-international.org/5.1/#sec-5.2', FromPropertyDescriptor: 'https://262.ecma-international.org/5.1/#sec-8.10.4', HourFromTime: 'https://262.ecma-international.org/5.1/#sec-15.9.1.10', InLeapYear: 'https://262.ecma-international.org/5.1/#sec-15.9.1.3', IsAccessorDescriptor: 'https://262.ecma-international.org/5.1/#sec-8.10.1', IsCallable: 'https://262.ecma-international.org/5.1/#sec-9.11', IsDataDescriptor: 'https://262.ecma-international.org/5.1/#sec-8.10.2', IsGenericDescriptor: 'https://262.ecma-international.org/5.1/#sec-8.10.3', IsPropertyDescriptor: 'https://262.ecma-international.org/5.1/#sec-8.10', MakeDate: 'https://262.ecma-international.org/5.1/#sec-15.9.1.13', MakeDay: 'https://262.ecma-international.org/5.1/#sec-15.9.1.12', MakeTime: 'https://262.ecma-international.org/5.1/#sec-15.9.1.11', MinFromTime: 'https://262.ecma-international.org/5.1/#sec-15.9.1.10', modulo: 'https://262.ecma-international.org/5.1/#sec-5.2', MonthFromTime: 'https://262.ecma-international.org/5.1/#sec-15.9.1.4', msFromTime: 'https://262.ecma-international.org/5.1/#sec-15.9.1.10', SameValue: 'https://262.ecma-international.org/5.1/#sec-9.12', SecFromTime: 'https://262.ecma-international.org/5.1/#sec-15.9.1.10', SplitMatch: 'https://262.ecma-international.org/5.1/#sec-15.5.4.14', TimeClip: 'https://262.ecma-international.org/5.1/#sec-15.9.1.14', TimeFromYear: 'https://262.ecma-international.org/5.1/#sec-15.9.1.3', TimeWithinDay: 'https://262.ecma-international.org/5.1/#sec-15.9.1.2', ToBoolean: 'https://262.ecma-international.org/5.1/#sec-9.2', ToInt32: 'https://262.ecma-international.org/5.1/#sec-9.5', ToInteger: 'https://262.ecma-international.org/5.1/#sec-9.4', ToNumber: 'https://262.ecma-international.org/5.1/#sec-9.3', ToObject: 'https://262.ecma-international.org/5.1/#sec-9.9', ToPrimitive: 'https://262.ecma-international.org/5.1/#sec-9.1', ToPropertyDescriptor: 'https://262.ecma-international.org/5.1/#sec-8.10.5', ToString: 'https://262.ecma-international.org/5.1/#sec-9.8', ToUint16: 'https://262.ecma-international.org/5.1/#sec-9.7', ToUint32: 'https://262.ecma-international.org/5.1/#sec-9.6', Type: 'https://262.ecma-international.org/5.1/#sec-8', WeekDay: 'https://262.ecma-international.org/5.1/#sec-15.9.1.6', YearFromTime: 'https://262.ecma-international.org/5.1/#sec-15.9.1.3' }; es-abstract-1.20.4/operations/getOps.js000077500000000000000000000204621431761430200200000ustar00rootroot00000000000000#!/usr/bin/env node 'use strict'; const fs = require('fs').promises; const path = require('path'); const { promisify } = require('util'); const exec = promisify(require('child_process').exec); const $ = require('cheerio'); const fromEntries = require('object.fromentries'); const years = require('./years'); async function getOps(year) { if (year < 2015) { throw new RangeError('ES2015+ only'); } const edition = year - 2009; const specHTMLurl = year > 2015 ? new URL(`https://raw.githubusercontent.com/tc39/ecma262/${year === 2023 ? 'HEAD' : `es${year}`}/spec.html`) : new URL('https://262.ecma-international.org/6.0/'); const cmd = `curl -q --silent ${specHTMLurl}`; console.log(year, cmd); const specHTML = String((await exec(cmd, { maxBuffer: Infinity })).stdout); const root = $(specHTML); let aOps; if (year > 2021) { aOps = $('[aoid],[type$="abstract operation"],[id^="sec-numeric-types-"]:not([aoid]):not([type="abstract operation"])', specHTML) .not('[type="sdo"]'); } else { aOps = root.filter('[aoid]') .add(root.find('[aoid]')) .add(root.find('[id^="sec-numeric-types-"]:not([aoid])')) .not('[type="sdo"]'); if (aOps.length === 0) { aOps = root.find('p:contains(" abstract operation ")').closest('section').add(root.find('#sec-reference-specification-type > section')); } } const missings = []; const entries = aOps.toArray().map((x) => { const op = $(x); let aoid = op.attr('aoid'); let id = op.attr('id'); if (!id) { id = op.closest('[id]').attr('id'); } // years other than 2016 have `id.startsWith('eqn-')` const isConstant = op.text().trim().split('\n').length === 1 && op.text().startsWith(`${aoid} = `); if (isConstant) { return null; } if (!aoid) { if ( id === 'sec-ecmascript-standard-built-in-objects' || id === 'sec-forbidden-extensions' || id === 'sec-jobs-and-job-queues' || id === 'sec-%typedarray%.prototype.sort' || (year < 2021 && id === 'sec-hostresolveimportedmodule') || id === 'sec-tostring-applied-to-the-number-type' ) { return null; } if (op.parent().attr('id') === 'sec-reference-specification-type') { ({ groups: { aoid } } = op.find('h1').text().match(/\s(?[a-zA-Z][a-z][a-zA-Z]+)\s/m)); } else if ((/^sec-numeric-types-(?:number|bigint)-/).test(op.attr('id'))) { ({ groups: { aoid } } = op.find('h1').text().match(/\s?(?[a-zA-Z][a-z][a-zA-Z]+(?:::[a-zA-Z][a-z][a-zA-Z]+)+)\s/m)); } else { const match = op.text().match(/When the (?[a-zA-Z][a-z][a-zA-Z]+) abstract operation is called/m) || op.text().match(/The (?[a-zA-Z][a-z][a-zA-Z]+) abstract operation/m) || op.text().match(/ abstract operation (?[a-zA-Z/0-9]+)/m); if (String(op.attr('type') || '').endsWith('abstract operation')) { aoid = op.find('h1').text().trim().split('\n')[0].replace(/Static Semantics: |\(.*$/g, '').trim(); } else if (match) { ({ groups: { aoid } } = match); } } } if (aoid && !id) { missings.push(aoid); } else if (!aoid) { missings.push(id); } if (!aoid || !id) { return null; } return [ aoid, `https://262.ecma-international.org/${edition}.0/#${id}`, ]; }).filter((x) => x && x[0]); if (missings.length > 0) { throw `Missing URLs: ${missings}`; } if (year === 2015) { entries.push( ['abs', 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions'], ['Abstract Equality Comparison', 'https://262.ecma-international.org/6.0/#sec-abstract-equality-comparison'], ['Abstract Relational Comparison', 'https://262.ecma-international.org/6.0/#sec-abstract-relational-comparison'], ['CreateArrayIterator', 'https://262.ecma-international.org/6.0/#sec-createarrayiterator'], ['DateFromTime', 'https://262.ecma-international.org/6.0/#sec-date-number'], ['Day', 'https://262.ecma-international.org/6.0/#sec-day-number-and-time-within-day'], ['DayFromYear', 'https://262.ecma-international.org/6.0/#sec-year-number'], ['DaysInYear', 'https://262.ecma-international.org/6.0/#sec-year-number'], ['DayWithinYear', 'https://262.ecma-international.org/6.0/#sec-month-number'], ['floor', 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions'], ['GetBase', 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues'], ['GetReferencedName', 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues'], ['HasPrimitiveBase', 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues'], ['HostResolveImportedModule', 'sec-hostresolveimportedmodule'], ['HourFromTime', 'https://262.ecma-international.org/6.0/#sec-hours-minutes-second-and-milliseconds'], ['InLeapYear', 'https://262.ecma-international.org/6.0/#sec-year-number'], ['IsPropertyReference', 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues'], ['IsStrictReference', 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues'], ['IsSuperReference', 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues'], ['IsUnresolvableReference', 'https://262.ecma-international.org/6.0/#sec-jobs-and-job-queues'], ['max', 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions'], ['min', 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions'], ['MinFromTime', 'https://262.ecma-international.org/6.0/#sec-hours-minutes-second-and-milliseconds'], ['modulo', 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions'], ['MonthFromTime', 'https://262.ecma-international.org/6.0/#sec-month-number'], ['msFromTime', 'https://262.ecma-international.org/6.0/#sec-hours-minutes-second-and-milliseconds'], ['msPerDay', 'https://262.ecma-international.org/6.0/#sec-day-number-and-time-within-day'], ['SecFromTime', 'https://262.ecma-international.org/6.0/#sec-hours-minutes-second-and-milliseconds'], ['sign', 'https://262.ecma-international.org/6.0/#sec-algorithm-conventions'], ['Strict Equality Comparison', 'https://262.ecma-international.org/6.0/#sec-strict-equality-comparison'], ['thisBooleanValue', 'https://262.ecma-international.org/6.0/#sec-properties-of-the-boolean-prototype-object'], ['thisNumberValue', 'https://262.ecma-international.org/6.0/#sec-properties-of-the-number-prototype-object'], ['thisStringValue', 'https://262.ecma-international.org/6.0/#sec-properties-of-the-string-prototype-object'], ['thisTimeValue', 'https://262.ecma-international.org/6.0/#sec-properties-of-the-date-prototype-object'], ['TimeFromYear', 'https://262.ecma-international.org/6.0/#sec-year-number'], ['TimeWithinDay', 'https://262.ecma-international.org/6.0/#sec-day-number-and-time-within-day'], ['ToDateString', 'https://262.ecma-international.org/6.0/#sec-todatestring'], ['Type', 'https://262.ecma-international.org/6.0/#sec-ecmascript-data-types-and-values'], ['WeekDay', 'https://262.ecma-international.org/6.0/#sec-week-day'], ['YearFromTime', 'https://262.ecma-international.org/6.0/#sec-year-number'], ); } else if (year === 2016) { entries.push( ['thisNumberValue', 'https://262.ecma-international.org/7.0/#sec-properties-of-the-number-prototype-object'], ['thisStringValue', 'https://262.ecma-international.org/7.0/#sec-properties-of-the-string-prototype-object'], ); } if (year >= 2015 && year <= 2017) { entries.push(['DaylightSavingTA', `https://262.ecma-international.org/${edition}.0/#sec-daylight-saving-time-adjustment`]); } if (year >= 2021) { entries.push( ['clamp', `https://262.ecma-international.org/${edition}.0/#clamping`], ['substring', `https://262.ecma-international.org/${edition}.0/#substring`], ); } entries.sort(([a], [b]) => a.localeCompare(b)); const obj = fromEntries(entries.map(([ao, url]) => [ao, typeof url === 'string' ? { url } : url])); const outputPath = path.join('operations', `${year}.js`); let output = `'use strict';\n\nmodule.exports = ${JSON.stringify(obj, null, '\t')};\n`; if ((year === 5 || year >= 2015) && year < 2018) { output = output.replace(/[=] \{\n/m, "= {\n\tIsPropertyDescriptor: 'https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type', // not actually an abstract op\n\n"); } await fs.writeFile(outputPath, output); console.log(`npx eslint --quiet --fix ${outputPath}`); return exec(`npx eslint --quiet --fix ${outputPath}`); } Promise.all(years.map((year) => getOps(year))).catch((e) => { console.error(e); process.exitCode = 1; }); es-abstract-1.20.4/operations/spackle.js000066400000000000000000000034621431761430200201570ustar00rootroot00000000000000'use strict'; const path = require('path'); const fs = require('fs'); const childProcess = require('child_process'); const deltas = require('./deltas'); const years = require('./years'); const writtenFiles = [5].concat(years).flatMap((year, i, arr) => { if ((i + 1) < arr.length) { const ops = fs.readdirSync(path.join(process.cwd(), String(year))); return ops.flatMap((opFile) => { const maybeDirPath = path.join(process.cwd(), String(year), opFile); if (fs.statSync(maybeDirPath).isDirectory()) { return fs.readdirSync(maybeDirPath).map((x) => `${opFile}::${path.basename(x, path.extname(x))}`); } return opFile; }).map((opFile) => { const op = path.basename(opFile, path.extname(opFile)); const opPath = op.replace('::', '/'); const thisFile = path.join(process.cwd(), String(year), `${opPath}.js`); const nextYear = arr[i + 1]; const nextFile = path.join(process.cwd(), String(nextYear), `${opPath}.js`); console.log('**', opFile, op, opPath, thisFile, nextFile); fs.mkdirSync(path.dirname(nextFile), { recursive: true }); if (!deltas[nextYear].removed.has(op) && fs.existsSync(thisFile) && !fs.existsSync(nextFile)) { console.log(`writing: ${nextYear}/${opPath} -> ${year}/${opPath}`); const thisSpecifier = `../${year}/${opPath}`; const reexport = `'use strict'; module.exports = require('${thisSpecifier}'); `; const replacement = fs.readFileSync(thisFile, 'utf-8'); fs.writeFileSync(nextFile, process.argv[2] ? replacement : reexport); return path.relative(process.cwd(), nextFile); } return null; }); } return []; }).filter(Boolean); fs.writeFileSync(path.join(process.cwd(), '.gitattributes'), writtenFiles.map((x) => `${x}\tspackled linguist-generated=true`).join('\n')); childProcess.execSync(`git add .gitattributes ${writtenFiles.join(' ')}`); es-abstract-1.20.4/operations/years.js000066400000000000000000000002301431761430200176460ustar00rootroot00000000000000'use strict'; function range(a, z) { return Array.from({ length: z + 1 - a }, (_, i) => i + a); } module.exports = Object.freeze(range(2015, 2022)); es-abstract-1.20.4/package.json000066400000000000000000000071731431761430200163050ustar00rootroot00000000000000{ "name": "es-abstract", "version": "1.20.4", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com", "url": "http://ljharb.codes" }, "funding": { "url": "https://github.com/sponsors/ljharb" }, "contributors": [ { "name": "Jordan Harband", "email": "ljharb@gmail.com", "url": "http://ljharb.codes" } ], "description": "ECMAScript spec abstract operations.", "license": "MIT", "main": "index.js", "type": "commonjs", "sideEffects": false, "scripts": { "prespackle": "git ls-files | xargs git check-attr spackled | grep -v 'unspecified$' | cut -d: -f1 | xargs rm || true", "spackle": "node operations/spackle 1", "postspackle": "git ls-files | xargs git check-attr spackled | grep -v 'unspecified$' | cut -d: -f1 | xargs git add", "prepack": "npmignore --auto --commentLines=autogenerated", "prepublish": "not-in-publish || npm run prepublishOnly", "prepublishOnly": "safe-publish-latest && npm run spackle", "pretest": "npm run lint", "test": "npm run tests-only && npm run test:ses", "test:ses": "node test/ses-compat", "posttest": "aud --production", "tests-only": "nyc node test", "lint": "eslint .", "eccheck": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')" }, "repository": { "type": "git", "url": "git://github.com/ljharb/es-abstract.git" }, "keywords": [ "ECMAScript", "ES", "abstract", "operation", "abstract operation", "JavaScript", "ES5", "ES6", "ES7" ], "dependencies": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "function.prototype.name": "^1.1.5", "get-intrinsic": "^1.1.3", "get-symbol-description": "^1.0.0", "has": "^1.0.3", "has-property-descriptors": "^1.0.0", "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", "is-callable": "^1.2.7", "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.2", "is-string": "^1.0.7", "is-weakref": "^1.0.2", "object-inspect": "^1.12.2", "object-keys": "^1.1.1", "object.assign": "^4.1.4", "regexp.prototype.flags": "^1.4.3", "safe-regex-test": "^1.0.0", "string.prototype.trimend": "^1.0.5", "string.prototype.trimstart": "^1.0.5", "unbox-primitive": "^1.0.2" }, "devDependencies": { "@ljharb/eslint-config": "^21.0.0", "array.prototype.filter": "^1.0.1", "array.prototype.flatmap": "^1.3.0", "array.prototype.indexof": "^1.0.4", "aud": "^2.0.1", "available-regexp-flags": "^1.0.0", "cheerio": "=1.0.0-rc.3", "diff": "^5.1.0", "eclint": "^2.8.1", "es-value-fixtures": "^1.4.2", "eslint": "=8.8.0", "for-each": "^0.3.3", "functions-have-names": "^1.2.3", "has-bigints": "^1.0.2", "has-strict-mode": "^1.0.1", "in-publish": "^2.0.1", "make-arrow-function": "^1.2.0", "make-async-function": "^1.0.0", "make-async-generator-function": "^1.0.0", "make-generator-function": "^2.0.0", "mock-property": "^1.0.0", "npmignore": "^0.3.0", "nyc": "^10.3.2", "object.fromentries": "^2.0.5", "safe-publish-latest": "^2.0.0", "ses": "^0.10.4", "tape": "^5.6.1" }, "testling": { "files": "test/index.js", "browsers": [ "iexplore/6.0..latest", "firefox/3.0..6.0", "firefox/15.0..latest", "firefox/nightly", "chrome/4.0..10.0", "chrome/20.0..latest", "chrome/canary", "opera/10.0..latest", "opera/next", "safari/4.0..latest", "ipad/6.0..latest", "iphone/6.0..latest", "android-browser/4.2" ] }, "engines": { "node": ">= 0.4" }, "publishConfig": { "ignore": [ ".github", "", "# dev scripts", "operations/*.js", "!operations/20*.js", "", "test/", "", ".gitattributes" ] } } es-abstract-1.20.4/test/000077500000000000000000000000001431761430200147665ustar00rootroot00000000000000es-abstract-1.20.4/test/GetIntrinsic.js000066400000000000000000000204731431761430200177340ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var test = require('tape'); var forEach = require('for-each'); var debug = require('object-inspect'); var generatorFns = require('make-generator-function')(); var asyncFns = require('make-async-function').list(); var asyncGenFns = require('make-async-generator-function')(); var mockProperty = require('mock-property'); var callBound = require('call-bind/callBound'); var v = require('es-value-fixtures'); var $gOPD = require('../helpers/getOwnPropertyDescriptor'); var DefinePropertyOrThrow = require('../2021/DefinePropertyOrThrow'); var $isProto = callBound('%Object.prototype.isPrototypeOf%'); test('export', function (t) { t.equal(typeof GetIntrinsic, 'function', 'it is a function'); t.equal(GetIntrinsic.length, 2, 'function has length of 2'); t.end(); }); test('throws', function (t) { t['throws']( function () { GetIntrinsic('not an intrinsic'); }, SyntaxError, 'nonexistent intrinsic throws a syntax error' ); t['throws']( function () { GetIntrinsic(''); }, TypeError, 'empty string intrinsic throws a type error' ); t['throws']( function () { GetIntrinsic('.'); }, SyntaxError, '"just a dot" intrinsic throws a syntax error' ); t['throws']( function () { GetIntrinsic('%String'); }, SyntaxError, 'Leading % without trailing % throws a syntax error' ); t['throws']( function () { GetIntrinsic('String%'); }, SyntaxError, 'Trailing % without leading % throws a syntax error' ); t['throws']( function () { GetIntrinsic("String['prototype]"); }, SyntaxError, 'Dynamic property access is disallowed for intrinsics (unterminated string)' ); t['throws']( function () { GetIntrinsic('%Proxy.prototype.undefined%'); }, TypeError, "Throws when middle part doesn't exist (%Proxy.prototype.undefined%)" ); forEach(v.nonStrings, function (nonString) { t['throws']( function () { GetIntrinsic(nonString); }, TypeError, debug(nonString) + ' is not a String' ); }); forEach(v.nonBooleans, function (nonBoolean) { t['throws']( function () { GetIntrinsic('%', nonBoolean); }, TypeError, debug(nonBoolean) + ' is not a Boolean' ); }); forEach([ 'toString', 'propertyIsEnumerable', 'hasOwnProperty' ], function (objectProtoMember) { t['throws']( function () { GetIntrinsic(objectProtoMember); }, SyntaxError, debug(objectProtoMember) + ' is not an intrinsic' ); }); t.end(); }); test('base intrinsics', function (t) { t.equal(GetIntrinsic('%Object%'), Object, '%Object% yields Object'); t.equal(GetIntrinsic('Object'), Object, 'Object yields Object'); t.equal(GetIntrinsic('%Array%'), Array, '%Array% yields Array'); t.equal(GetIntrinsic('Array'), Array, 'Array yields Array'); t.end(); }); test('dotted paths', function (t) { t.equal(GetIntrinsic('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% yields Object.prototype.toString'); t.equal(GetIntrinsic('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString yields Object.prototype.toString'); t.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push, '%Array.prototype.push% yields Array.prototype.push'); t.equal(GetIntrinsic('Array.prototype.push'), Array.prototype.push, 'Array.prototype.push yields Array.prototype.push'); test('underscore paths are aliases for dotted paths', { skip: !Object.isFrozen || Object.isFrozen(Object.prototype) }, function (st) { var original = GetIntrinsic('%ObjProto_toString%'); forEach([ '%Object.prototype.toString%', 'Object.prototype.toString', '%ObjectPrototype.toString%', 'ObjectPrototype.toString', '%ObjProto_toString%', 'ObjProto_toString' ], function (name) { DefinePropertyOrThrow(Object.prototype, 'toString', { '[[Value]]': function toString() { return original.apply(this, arguments); } }); st.equal(GetIntrinsic(name), original, name + ' yields original Object.prototype.toString'); }); DefinePropertyOrThrow(Object.prototype, 'toString', { '[[Value]]': original }); st.end(); }); test('dotted paths cache', { skip: !Object.isFrozen || Object.isFrozen(Object.prototype) }, function (st) { var original = GetIntrinsic('%Object.prototype.propertyIsEnumerable%'); forEach([ '%Object.prototype.propertyIsEnumerable%', 'Object.prototype.propertyIsEnumerable', '%ObjectPrototype.propertyIsEnumerable%', 'ObjectPrototype.propertyIsEnumerable' ], function (name) { var restore = mockProperty(Object.prototype, 'propertyIsEnumerable', { value: function propertyIsEnumerable() { return original.apply(this, arguments); } }); st.equal(GetIntrinsic(name), original, name + ' yields cached Object.prototype.propertyIsEnumerable'); restore(); }); st.end(); }); test('dotted path reports correct error', function (st) { st['throws'](function () { GetIntrinsic('%NonExistentIntrinsic.prototype.property%'); }, /%NonExistentIntrinsic%/, 'The base intrinsic of %NonExistentIntrinsic.prototype.property% is %NonExistentIntrinsic%'); st['throws'](function () { GetIntrinsic('%NonExistentIntrinsicPrototype.property%'); }, /%NonExistentIntrinsicPrototype%/, 'The base intrinsic of %NonExistentIntrinsicPrototype.property% is %NonExistentIntrinsicPrototype%'); st.end(); }); t.end(); }); test('accessors', { skip: !$gOPD || typeof Map !== 'function' }, function (t) { var actual = $gOPD(Map.prototype, 'size'); t.ok(actual, 'Map.prototype.size has a descriptor'); t.equal(typeof actual.get, 'function', 'Map.prototype.size has a getter function'); t.equal(GetIntrinsic('%Map.prototype.size%'), actual.get, '%Map.prototype.size% yields the getter for it'); t.equal(GetIntrinsic('Map.prototype.size'), actual.get, 'Map.prototype.size yields the getter for it'); t.end(); }); test('generator functions', { skip: !generatorFns.length }, function (t) { var $GeneratorFunction = GetIntrinsic('%GeneratorFunction%'); var $GeneratorFunctionPrototype = GetIntrinsic('%Generator%'); var $GeneratorPrototype = GetIntrinsic('%GeneratorPrototype%'); forEach(generatorFns, function (genFn) { var fnName = genFn.name; fnName = fnName ? "'" + fnName + "'" : 'genFn'; t.ok(genFn instanceof $GeneratorFunction, fnName + ' instanceof %GeneratorFunction%'); t.ok($isProto($GeneratorFunctionPrototype, genFn), '%Generator% is prototype of ' + fnName); t.ok($isProto($GeneratorPrototype, genFn.prototype), '%GeneratorPrototype% is prototype of ' + fnName + '.prototype'); }); t.end(); }); test('async functions', { skip: !asyncFns.length }, function (t) { var $AsyncFunction = GetIntrinsic('%AsyncFunction%'); var $AsyncFunctionPrototype = GetIntrinsic('%AsyncFunctionPrototype%'); forEach(asyncFns, function (asyncFn) { var fnName = asyncFn.name; fnName = fnName ? "'" + fnName + "'" : 'asyncFn'; t.ok(asyncFn instanceof $AsyncFunction, fnName + ' instanceof %AsyncFunction%'); t.ok($isProto($AsyncFunctionPrototype, asyncFn), '%AsyncFunctionPrototype% is prototype of ' + fnName); }); t.end(); }); test('async generator functions', { skip: asyncGenFns.length === 0 }, function (t) { var $AsyncGeneratorFunction = GetIntrinsic('%AsyncGeneratorFunction%'); var $AsyncGeneratorFunctionPrototype = GetIntrinsic('%AsyncGenerator%'); var $AsyncGeneratorPrototype = GetIntrinsic('%AsyncGeneratorPrototype%'); forEach(asyncGenFns, function (asyncGenFn) { var fnName = asyncGenFn.name; fnName = fnName ? "'" + fnName + "'" : 'asyncGenFn'; t.ok(asyncGenFn instanceof $AsyncGeneratorFunction, fnName + ' instanceof %AsyncGeneratorFunction%'); t.ok($isProto($AsyncGeneratorFunctionPrototype, asyncGenFn), '%AsyncGenerator% is prototype of ' + fnName); t.ok($isProto($AsyncGeneratorPrototype, asyncGenFn.prototype), '%AsyncGeneratorPrototype% is prototype of ' + fnName + '.prototype'); }); t.end(); }); test('%ThrowTypeError%', function (t) { var $ThrowTypeError = GetIntrinsic('%ThrowTypeError%'); t.equal(typeof $ThrowTypeError, 'function', 'is a function'); t['throws']( $ThrowTypeError, TypeError, '%ThrowTypeError% throws a TypeError' ); t.end(); }); test('allowMissing', { skip: asyncGenFns.length > 0 }, function (t) { t['throws']( function () { GetIntrinsic('%AsyncGeneratorPrototype%'); }, TypeError, 'throws when missing' ); t.equal( GetIntrinsic('%AsyncGeneratorPrototype%', true), undefined, 'does not throw when allowMissing' ); t.end(); }); es-abstract-1.20.4/test/diffOps.js000066400000000000000000000030571431761430200167230ustar00rootroot00000000000000'use strict'; var keys = require('object-keys'); var forEach = require('for-each'); var indexOf = require('array.prototype.indexof'); var has = require('has'); module.exports = function diffOperations(actual, expected, expectedMissing) { var actualKeys = keys(actual); var expectedKeys = keys(expected); var extra = []; var missing = []; var extraMissing = []; forEach(actualKeys, function (op) { if (!(op in expected)) { if (actual[op] && typeof actual[op] === 'object') { forEach(keys(actual[op]), function (nestedOp) { var fullNestedOp = op + '::' + nestedOp; if (!(fullNestedOp in expected)) { extra.push(fullNestedOp); } else if (indexOf(expectedMissing, fullNestedOp) !== -1) { extra.push(fullNestedOp); } }); } else { extra.push(op); } } else if (indexOf(expectedMissing, op) !== -1) { extra.push(op); } }); var checkMissing = function checkMissing(op, actualValue) { if (typeof actualValue !== 'function' && indexOf(expectedMissing, op) === -1) { missing.push(op); } }; forEach(expectedKeys, function (op) { if (op.indexOf('::') > -1) { var parts = op.split('::'); var value = actual[parts[0]]; if (value && typeof value === 'object' && typeof value[parts[1]] === 'function') { checkMissing(op, value[parts[1]]); } } else { checkMissing(op, actual[op]); } }); forEach(expectedMissing, function (expectedOp) { if (!has(expected, expectedOp)) { extraMissing.push(expectedOp); } }); return { missing: missing, extra: extra, extraMissing: extraMissing }; }; es-abstract-1.20.4/test/es2015.js000066400000000000000000000064661431761430200162570ustar00rootroot00000000000000'use strict'; var ES = require('../').ES2015; var boundES = require('./helpers/createBoundESNamespace')(ES); var ops = require('../operations/2015'); var expectedMissing = [ 'AddRestrictedFunctionProperties', 'AllocateArrayBuffer', 'AllocateTypedArray', 'BoundFunctionCreate', 'Canonicalize', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateListIterator', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateSetIterator', 'CreateUnmappedArgumentsObject', 'DaylightSavingTA', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnqueueJob', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateDirectCall', 'EvaluateNew', 'ForBodyEvaluation', 'ForIn/OfBodyEvaluation', 'ForIn/OfHeadEvaluation', 'FulfillPromise', 'FunctionAllocate', 'FunctionCreate', 'FunctionInitialize', 'GeneratorFunctionCreate', 'GeneratorResume', 'GeneratorResumeAbrupt', 'GeneratorStart', 'GeneratorValidate', 'GeneratorYield', 'GetBase', 'GetFunctionRealm', 'GetGlobalObject', 'GetIdentifierReference', 'GetModuleNamespace', 'GetNewTarget', 'GetReferencedName', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'HasPrimitiveBase', 'HostResolveImportedModule', 'ImportedLocalNames', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsWordChar', 'LocalTime', 'LoopContinues', // completion records 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'max', 'min', 'ModuleNamespaceCreate', 'msPerDay', // constant 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NormalCompletion', // completion records 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'ParseModule', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'ProxyCreate', 'PutValue', // takes a Reference 'RegExpAlloc', // creates a regex with uninitialized internal lots 'RegExpBuiltinExec', 'RegExpInitialize', // initializes allocated regex's internal slots 'RejectPromise', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'sign', 'SortCompare', // mystery access to `comparefn` arg 'TriggerPromiseReactions', 'TypedArrayFrom', 'UpdateEmpty', // completion records 'UTC' // depends on LocalTZA, DaylightSavingTA ]; require('./tests').es2015(boundES, ops, expectedMissing); require('./helpers/runManifestTest')(require('tape'), ES, 2015); es-abstract-1.20.4/test/es2016.js000066400000000000000000000076121431761430200162520ustar00rootroot00000000000000'use strict'; var ES = require('../').ES2016; var boundES = require('./helpers/createBoundESNamespace')(ES); var ops = require('../operations/2016'); var expectedMissing = [ 'AddRestrictedFunctionProperties', 'AllocateArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateListIterator', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'DaylightSavingTA', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnqueueJob', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateDirectCall', 'EvaluateNew', 'ForBodyEvaluation', 'ForIn/OfBodyEvaluation', 'ForIn/OfHeadEvaluation', 'FulfillPromise', 'FunctionAllocate', 'FunctionCreate', 'FunctionDeclarationInstantiation', 'FunctionInitialize', 'GeneratorFunctionCreate', 'GeneratorResume', 'GeneratorResumeAbrupt', 'GeneratorStart', 'GeneratorValidate', 'GeneratorYield', 'GetActiveScriptOrModule', 'GetFunctionRealm', 'GetGlobalObject', 'GetIdentifierReference', 'GetModuleNamespace', 'GetNewTarget', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GlobalDeclarationInstantiation', 'HostPromiseRejectionTracker', 'HostReportErrors', 'HostResolveImportedModule', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsWordChar', 'LocalTime', 'LoopContinues', // completion records 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'max', 'min', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NextJob', 'NormalCompletion', // completion records 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', // takes a Reference 'RegExpAlloc', // creates a regex with uninitialized internal lots 'RegExpBuiltinExec', 'RegExpInitialize', // initializes allocated regex's internal slots 'RejectPromise', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SortCompare', // mystery access to `comparefn` arg 'TopLevelModuleEvaluationJob', 'ToString Applied to the Number Type', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UpdateEmpty', // completion records 'UTC', // depends on LocalTZA, DaylightSavingTA 'ValidateTypedArray' ]; require('./tests').es2016(boundES, ops, expectedMissing); require('./helpers/runManifestTest')(require('tape'), ES, 2016); es-abstract-1.20.4/test/es2017.js000066400000000000000000000115421431761430200162500ustar00rootroot00000000000000'use strict'; var ES = require('../').ES2017; var boundES = require('./helpers/createBoundESNamespace')(ES); var ops = require('../operations/2017'); var expectedMissing = [ 'AddWaiter', 'agent-order', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFunctionAwait', 'AsyncFunctionCreate', 'AsyncFunctionStart', 'AtomicLoad', 'AtomicReadModifyWrite', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateListIterator', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'DaylightSavingTA', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnqueueJob', 'EnterCriticalSection', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateDirectCall', 'EvaluateNew', 'EventSet', 'ForBodyEvaluation', 'ForIn/OfBodyEvaluation', 'ForIn/OfHeadEvaluation', 'FulfillPromise', 'FunctionAllocate', 'FunctionCreate', 'FunctionDeclarationInstantiation', 'FunctionInitialize', 'GeneratorFunctionCreate', 'GeneratorResume', 'GeneratorResumeAbrupt', 'GeneratorStart', 'GeneratorValidate', 'GeneratorYield', 'GetActiveScriptOrModule', 'GetBase', 'GetFunctionRealm', 'GetGlobalObject', 'GetIdentifierReference', 'GetModifySetValueInBuffer', 'GetModuleNamespace', 'GetNewTarget', 'GetReferencedName', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GetWaiterList', 'GlobalDeclarationInstantiation', 'happens-before', 'HasPrimitiveBase', 'host-synchronizes-with', 'HostEnsureCanCompileStrings', 'HostEventSet', 'HostPromiseRejectionTracker', 'HostReportErrors', 'HostResolveImportedModule', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LoopContinues', // completion records 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'max', 'memory-order', 'min', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NormalCompletion', // completion records 'NumberToRawBytes', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', // takes a Reference 'RawBytesToNumber', 'reads-bytes-from', 'reads-from', 'RegExpAlloc', // creates a regex with uninitialized internal lots 'RegExpBuiltinExec', 'RegExpInitialize', // initializes allocated regex's internal slots 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'RunJobs', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', // mystery access to `comparefn` arg 'Suspend', 'TopLevelModuleEvaluationJob', 'ToString Applied to the Number Type', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UpdateEmpty', // completion records 'UTC', // depends on LocalTZA, DaylightSavingTA 'ValidateAtomicAccess', 'ValidateSharedIntegerTypedArray', 'ValidateTypedArray', 'ValueOfReadEvent', 'WakeWaiter', 'WordCharacters', // depends on Canonicalize 'AddRestrictedFunctionProperties', 'synchronizes-with' ]; require('./tests').es2017(boundES, ops, expectedMissing); require('./helpers/runManifestTest')(require('tape'), ES, 2017); es-abstract-1.20.4/test/es2018.js000066400000000000000000000124761431761430200162600ustar00rootroot00000000000000'use strict'; var ES = require('../').ES2018; var boundES = require('./helpers/createBoundESNamespace')(ES); var ops = require('../operations/2018'); var expectedMissing = [ 'AddRestrictedFunctionProperties', 'AddWaiter', 'agent-order', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFunctionCreate', 'AsyncFunctionStart', 'AsyncGeneratorEnqueue', 'AsyncGeneratorFunctionCreate', 'AsyncGeneratorReject', 'AsyncGeneratorResolve', 'AsyncGeneratorResumeNext', 'AsyncGeneratorStart', 'AsyncGeneratorYield', 'AsyncIteratorClose', 'AtomicLoad', 'AtomicReadModifyWrite', 'Await', // macro 'BackreferenceMatcher', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CaseClauseIsSelected', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateAsyncFromSyncIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateListIteratorRecord', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnqueueJob', 'EnterCriticalSection', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateNew', 'EventSet', 'ForBodyEvaluation', 'ForIn/OfBodyEvaluation', 'ForIn/OfHeadEvaluation', 'FulfillPromise', 'FunctionAllocate', 'FunctionCreate', 'FunctionDeclarationInstantiation', 'FunctionInitialize', 'GeneratorFunctionCreate', 'GeneratorResume', 'GeneratorResumeAbrupt', 'GeneratorStart', 'GeneratorValidate', 'GeneratorYield', 'GetActiveScriptOrModule', 'GetBase', 'GetFunctionRealm', 'GetGeneratorKind', 'GetGlobalObject', 'GetIdentifierReference', 'GetModifySetValueInBuffer', 'GetModuleNamespace', 'GetNewTarget', 'GetReferencedName', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GetWaiterList', 'GlobalDeclarationInstantiation', 'happens-before', 'HasPrimitiveBase', 'host-synchronizes-with', 'HostEnsureCanCompileStrings', 'HostEventSet', 'HostPromiseRejectionTracker', 'HostReportErrors', 'HostResolveImportedModule', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'InnerModuleEvaluation', 'InnerModuleInstantiation', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LoopContinues', // completion records 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'max', 'memory-order', 'min', 'ModuleDeclarationEnvironmentSetup', 'ModuleExecution', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NormalCompletion', // completion records 'NumberToRawBytes', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'OrdinarySetWithOwnDescriptor', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', // takes a Reference 'RawBytesToNumber', 'reads-bytes-from', 'reads-from', 'RegExpAlloc', // creates a regex with uninitialized internal lots 'RegExpBuiltinExec', 'RegExpInitialize', // initializes allocated regex's internal slots 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'RunJobs', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', // mystery access to `comparefn` arg 'Suspend', 'synchronizes-with', 'ThrowCompletion', 'TimeZoneString', // depends on LocalTZA 'TopLevelModuleEvaluationJob', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UnicodeMatchProperty', 'UnicodeMatchPropertyValue', 'UpdateEmpty', // completion records 'UTC', // depends on LocalTZA 'ValidateAtomicAccess', 'ValidateSharedIntegerTypedArray', 'ValidateTypedArray', 'ValueOfReadEvent', 'WakeWaiter', 'WordCharacters' // depends on Canonicalize ]; require('./tests').es2018(boundES, ops, expectedMissing); require('./helpers/runManifestTest')(require('tape'), ES, 2018); es-abstract-1.20.4/test/es2019.js000066400000000000000000000125601431761430200162530ustar00rootroot00000000000000'use strict'; var ES = require('../').ES2019; var boundES = require('./helpers/createBoundESNamespace')(ES); var ops = require('../operations/2019'); var expectedMissing = [ 'AddRestrictedFunctionProperties', 'AddWaiter', 'agent-order', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFromSyncIteratorContinuation', 'AsyncFunctionCreate', 'AsyncFunctionStart', 'AsyncGeneratorEnqueue', 'AsyncGeneratorFunctionCreate', 'AsyncGeneratorReject', 'AsyncGeneratorResolve', 'AsyncGeneratorResumeNext', 'AsyncGeneratorStart', 'AsyncGeneratorYield', 'AsyncIteratorClose', 'AtomicLoad', 'AtomicReadModifyWrite', 'Await', // macro 'BackreferenceMatcher', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CaseClauseIsSelected', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateAsyncFromSyncIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateListIteratorRecord', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnqueueJob', 'EnterCriticalSection', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateNew', 'EventSet', 'ExecuteModule', 'ForBodyEvaluation', 'ForIn/OfBodyEvaluation', 'ForIn/OfHeadEvaluation', 'FulfillPromise', 'FunctionAllocate', 'FunctionCreate', 'FunctionDeclarationInstantiation', 'FunctionInitialize', 'GeneratorFunctionCreate', 'GeneratorResume', 'GeneratorResumeAbrupt', 'GeneratorStart', 'GeneratorValidate', 'GeneratorYield', 'GetActiveScriptOrModule', 'GetBase', 'GetFunctionRealm', 'GetGeneratorKind', 'GetGlobalObject', 'GetIdentifierReference', 'GetModifySetValueInBuffer', 'GetModuleNamespace', 'GetNewTarget', 'GetReferencedName', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GetWaiterList', 'GlobalDeclarationInstantiation', 'happens-before', 'HasPrimitiveBase', 'host-synchronizes-with', 'HostEnsureCanCompileStrings', 'HostEventSet', 'HostPromiseRejectionTracker', 'HostReportErrors', 'HostResolveImportedModule', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeEnvironment', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'InnerModuleEvaluation', 'InnerModuleInstantiation', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LoopContinues', // completion records 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'max', 'memory-order', 'min', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NormalCompletion', // completion records 'NotifyWaiter', 'NumberToRawBytes', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'OrdinarySetWithOwnDescriptor', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', // takes a Reference 'RawBytesToNumber', 'reads-bytes-from', 'reads-from', 'RegExpAlloc', // creates a regex with uninitialized internal lots 'RegExpBuiltinExec', 'RegExpInitialize', // initializes allocated regex's internal slots 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'RunJobs', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', // mystery access to `comparefn` arg 'Suspend', 'SynchronizeEventSet', 'synchronizes-with', 'ThrowCompletion', 'TimeZoneString', // depends on LocalTZA 'TopLevelModuleEvaluationJob', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UnicodeMatchProperty', 'UnicodeMatchPropertyValue', 'UpdateEmpty', // completion records 'UTC', // depends on LocalTZA 'ValidateAtomicAccess', 'ValidateSharedIntegerTypedArray', 'ValidateTypedArray', 'ValueOfReadEvent', 'WordCharacters' // depends on Canonicalize ]; require('./tests').es2019(boundES, ops, expectedMissing); require('./helpers/runManifestTest')(require('tape'), ES, 2019); es-abstract-1.20.4/test/es2020.js000066400000000000000000000130301431761430200162340ustar00rootroot00000000000000'use strict'; var ES = require('../').ES2020; var boundES = require('./helpers/createBoundESNamespace')(ES); var ops = require('../operations/2020'); var expectedMissing = [ 'AddRestrictedFunctionProperties', 'AddWaiter', 'agent-order', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFromSyncIteratorContinuation', 'AsyncFunctionStart', 'AsyncGeneratorEnqueue', 'AsyncGeneratorReject', 'AsyncGeneratorResolve', 'AsyncGeneratorResumeNext', 'AsyncGeneratorStart', 'AsyncGeneratorYield', 'AsyncIteratorClose', 'AtomicLoad', 'AtomicReadModifyWrite', 'Await', // macro 'BackreferenceMatcher', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CaseClauseIsSelected', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateAsyncFromSyncIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateForInIterator', 'CreateIntrinsics', 'CreateListIteratorRecord', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnterCriticalSection', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateNew', 'EvaluatePropertyAccessWithExpressionKey', 'EvaluatePropertyAccessWithIdentifierKey', 'EventSet', 'ExecuteModule', 'FinishDynamicImport', 'ForBodyEvaluation', 'ForIn/OfBodyEvaluation', 'ForIn/OfHeadEvaluation', 'FulfillPromise', 'FunctionDeclarationInstantiation', 'GeneratorResume', 'GeneratorResumeAbrupt', 'GeneratorStart', 'GeneratorValidate', 'GeneratorYield', 'GetActiveScriptOrModule', 'GetBase', 'GetFunctionRealm', 'GetGeneratorKind', 'GetGlobalObject', 'GetIdentifierReference', 'GetModifySetValueInBuffer', 'GetModuleNamespace', 'GetNewTarget', 'GetReferencedName', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GetWaiterList', 'GlobalDeclarationInstantiation', 'happens-before', 'HasPrimitiveBase', 'host-synchronizes-with', 'HostEnqueuePromiseJob', 'HostEnsureCanCompileStrings', 'HostEventSet', 'HostFinalizeImportMeta', 'HostGetImportMetaProperties', 'HostImportModuleDynamically', 'HostPromiseRejectionTracker', 'HostResolveImportedModule', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeEnvironment', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'InnerModuleEvaluation', 'InnerModuleLinking', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsValidIntegerIndex', 'IsValidRegularExpressionLiteral', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LocalTZA', 'LoopContinues', // completion records 'MakeArgGetter', 'MakeArgSetter', 'MakeBasicObject', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'max', 'memory-order', 'min', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NewPromiseReactionJob', 'NewPromiseResolveThenableJob', 'NormalCompletion', // completion records 'NotifyWaiter', 'NumericToRawBytes', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryDelete', 'OrdinaryFunctionCreate', 'OrdinaryGet', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'OrdinarySetWithOwnDescriptor', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseAllSettled', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'ProxyCreate', 'PutValue', // takes a Reference 'RawBytesToNumeric', 'reads-bytes-from', 'reads-from', 'RegExpAlloc', // creates a regex with uninitialized internal lots 'RegExpBuiltinExec', 'RegExpInitialize', // initializes allocated regex's internal slots 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'RequireInternalSlot', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'ScriptEvaluation', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', // mystery access to `comparefn` arg 'Suspend', 'synchronizes-with', 'ThrowCompletion', 'TimeZoneString', // depends on LocalTZA 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UnicodeMatchProperty', 'UnicodeMatchPropertyValue', 'UpdateEmpty', // completion records 'UTC', // depends on LocalTZA 'UTF16Encode', 'ValidateAtomicAccess', 'ValidateSharedIntegerTypedArray', 'ValidateTypedArray', 'ValueOfReadEvent', 'WordCharacters' // depends on Canonicalize ]; require('./tests').es2020(boundES, ops, expectedMissing); require('./helpers/runManifestTest')(require('tape'), ES, 2020); es-abstract-1.20.4/test/es2021.js000066400000000000000000000141251431761430200162430ustar00rootroot00000000000000'use strict'; var ES = require('../').ES2021; var boundES = require('./helpers/createBoundESNamespace')(ES); var ops = require('../operations/2021'); var expectedMissing = [ 'AddRestrictedFunctionProperties', 'AddWaiter', 'agent-order', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFromSyncIteratorContinuation', 'AsyncFunctionStart', 'AsyncGeneratorEnqueue', 'AsyncGeneratorReject', 'AsyncGeneratorResolve', 'AsyncGeneratorResumeNext', 'AsyncGeneratorStart', 'AsyncGeneratorValidate', 'AsyncGeneratorYield', 'AsyncIteratorClose', 'AtomicReadModifyWrite', 'Await', // macro 'BackreferenceMatcher', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CaseClauseIsSelected', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CleanupFinalizationRegistry', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateAsyncFromSyncIterator', 'CreateAsyncIteratorFromClosure', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateForInIterator', 'CreateIntrinsics', 'CreateIteratorFromClosure', 'CreateListIteratorRecord', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateUnmappedArgumentsObject', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnterCriticalSection', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateNew', 'EvaluatePropertyAccessWithExpressionKey', 'EvaluatePropertyAccessWithIdentifierKey', 'EvaluateStringOrNumericBinaryExpression', // takes Parse Nodes 'EventSet', 'ExecuteModule', 'FinishDynamicImport', 'ForBodyEvaluation', 'ForIn/OfBodyEvaluation', 'ForIn/OfHeadEvaluation', 'FulfillPromise', 'FunctionDeclarationInstantiation', 'GeneratorResume', 'GeneratorResumeAbrupt', 'GeneratorStart', 'GeneratorValidate', 'GeneratorYield', 'GetActiveScriptOrModule', 'GetFunctionRealm', 'GetGeneratorKind', 'GetGlobalObject', 'GetIdentifierReference', 'GetModifySetValueInBuffer', 'GetModuleNamespace', 'GetNewTarget', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GetWaiterList', 'GlobalDeclarationInstantiation', 'happens-before', 'host-synchronizes-with', 'HostCallJobCallback', 'HostEnqueueFinalizationRegistryCleanupJob', 'HostEnqueuePromiseJob', 'HostEnsureCanCompileStrings', 'HostEventSet', 'HostFinalizeImportMeta', 'HostGetImportMetaProperties', 'HostHasSourceTextAvailable', 'HostImportModuleDynamically', 'HostMakeJobCallback', 'HostPromiseRejectionTracker', 'HostResolveImportedModule', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeEnvironment', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'InitializeTypedArrayFromArrayBuffer', // TypedArray initialization 'InitializeTypedArrayFromArrayLike', // TypedArray initialization 'InitializeTypedArrayFromList', // TypedArray initialization 'InitializeTypedArrayFromTypedArray', // TypedArray initialization 'InnerModuleEvaluation', 'InnerModuleLinking', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsValidIntegerIndex', 'IsValidRegularExpressionLiteral', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LocalTZA', 'LoopContinues', // completion records 'MakeArgGetter', 'MakeArgSetter', 'MakeBasicObject', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'max', 'memory-order', 'min', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NewPromiseReactionJob', 'NewPromiseResolveThenableJob', 'NormalCompletion', // completion records 'NotifyWaiter', 'NumericToRawBytes', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryDelete', 'OrdinaryFunctionCreate', 'OrdinaryGet', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'OrdinarySetWithOwnDescriptor', 'ParseModule', 'ParsePattern', // depends on ParseText, returns a Parse Node 'ParseScript', 'ParseText', // returns a Parse Node 'PerformEval', 'PerformPromiseAll', 'PerformPromiseAllSettled', 'PerformPromiseAny', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'ProxyCreate', 'PutValue', 'RawBytesToNumeric', 'reads-bytes-from', 'reads-from', 'RegExpAlloc', 'RegExpBuiltinExec', 'RegExpInitialize', 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'RequireInternalSlot', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'ScriptEvaluation', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetTypedArrayFromArrayLike', // TypedArray.prototype.set 'SetTypedArrayFromTypedArray', // TypedArray.prototype.set 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', // mystery access to `comparefn` arg 'SuspendAgent', 'synchronizes-with', 'ThrowCompletion', 'TimeZoneString', // depends on LocalTZA 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UnicodeMatchProperty', 'UnicodeMatchPropertyValue', 'UpdateEmpty', // completion records 'UTC', // depends on LocalTZA 'ValidateAtomicAccess', 'ValidateIntegerTypedArray', // depends on ValidateTypedArray 'ValidateTypedArray', 'ValueOfReadEvent', 'Yield' // macro ]; require('./tests').es2021(boundES, ops, expectedMissing); require('./helpers/runManifestTest')(require('tape'), ES, 2021); es-abstract-1.20.4/test/es2022.js000066400000000000000000000152301431761430200162420ustar00rootroot00000000000000'use strict'; var ES = require('../').ES2022; var boundES = require('./helpers/createBoundESNamespace')(ES); var ops = require('../operations/2022'); var expectedMissing = [ 'AddRestrictedFunctionProperties', 'AddWaiter', 'agent-order', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFromSyncIteratorContinuation', 'AsyncFunctionStart', 'AsyncGeneratorEnqueue', 'AsyncGeneratorStart', 'AsyncGeneratorValidate', 'AsyncGeneratorYield', 'AsyncIteratorClose', 'AtomicReadModifyWrite', 'Await', // macro 'BackreferenceMatcher', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CaseClauseIsSelected', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CleanupFinalizationRegistry', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateAsyncFromSyncIterator', 'CreateAsyncIteratorFromClosure', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateForInIterator', 'CreateIntrinsics', 'CreateIteratorFromClosure', 'CreateListIteratorRecord', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateUnmappedArgumentsObject', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnterCriticalSection', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateNew', 'EvaluatePropertyAccessWithExpressionKey', 'EvaluatePropertyAccessWithIdentifierKey', 'EvaluateStringOrNumericBinaryExpression', // takes Parse Nodes 'EventSet', 'FinishDynamicImport', 'ForBodyEvaluation', 'ForIn/OfBodyEvaluation', 'ForIn/OfHeadEvaluation', 'FulfillPromise', 'FunctionDeclarationInstantiation', 'GeneratorResume', 'GeneratorResumeAbrupt', 'GeneratorStart', 'GeneratorValidate', 'GeneratorYield', 'GetActiveScriptOrModule', 'GetFunctionRealm', 'GetGeneratorKind', 'GetGlobalObject', 'GetIdentifierReference', 'GetModifySetValueInBuffer', 'GetModuleNamespace', 'GetNewTarget', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GetWaiterList', 'GlobalDeclarationInstantiation', 'happens-before', 'host-synchronizes-with', 'HostCallJobCallback', 'HostEnqueueFinalizationRegistryCleanupJob', 'HostEnqueuePromiseJob', 'HostEnsureCanCompileStrings', 'HostEventSet', 'HostFinalizeImportMeta', 'HostGetImportMetaProperties', 'HostHasSourceTextAvailable', 'HostImportModuleDynamically', 'HostMakeJobCallback', 'HostPromiseRejectionTracker', 'HostResolveImportedModule', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'InitializeTypedArrayFromArrayBuffer', // TypedArray initialization 'InitializeTypedArrayFromArrayLike', // TypedArray initialization 'InitializeTypedArrayFromList', // TypedArray initialization 'InitializeTypedArrayFromTypedArray', // TypedArray initialization 'InnerModuleEvaluation', 'InnerModuleLinking', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsValidIntegerIndex', 'IsValidRegularExpressionLiteral', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LocalTZA', 'LoopContinues', 'MakeArgGetter', 'MakeArgSetter', 'MakeBasicObject', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'max', 'memory-order', 'min', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NewPromiseReactionJob', 'NewPromiseResolveThenableJob', 'NormalCompletion', 'NotifyWaiter', 'NumericToRawBytes', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryDelete', 'OrdinaryFunctionCreate', 'OrdinaryGet', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'OrdinarySetWithOwnDescriptor', 'ParseModule', 'ParsePattern', // depends on ParseText, returns a Parse Node 'ParseScript', 'ParseText', // returns a Parse Node 'PerformEval', 'PerformPromiseAll', 'PerformPromiseAllSettled', 'PerformPromiseAny', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'ProxyCreate', 'PutValue', 'RawBytesToNumeric', 'reads-bytes-from', 'reads-from', 'RegExpAlloc', 'RegExpBuiltinExec', 'RegExpInitialize', 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'RequireInternalSlot', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'ScriptEvaluation', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetTypedArrayFromArrayLike', // TypedArray.prototype.set 'SetTypedArrayFromTypedArray', // TypedArray.prototype.set 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SuspendAgent', 'synchronizes-with', 'ThrowCompletion', 'TimeZoneString', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'TypedArrayElementSize', // TODO, 'TypedArrayElementType', // TODO 'UnicodeMatchProperty', 'UnicodeMatchPropertyValue', 'UpdateEmpty', 'UTC', // depends on LocalTZA 'ValidateAtomicAccess', 'ValidateIntegerTypedArray', // depends on ValidateTypedArray 'ValidateTypedArray', 'ValueOfReadEvent', 'Yield', // macro // new missings 'AsyncBlockStart', 'AsyncGeneratorAwaitReturn', 'AsyncGeneratorCompleteStep', 'AsyncGeneratorDrainQueue', 'AsyncGeneratorResume', 'AsyncGeneratorUnwrapYieldResumption', 'AsyncModuleExecutionFulfilled', 'AsyncModuleExecutionRejected', 'DefineField', // used by class syntax to make fields 'DefineMethodProperty', // used by class syntax to make class methods 'ExecuteAsyncModule', // module stuff 'GatherAvailableAncestors', // module stuff 'IfAbruptCloseIterator', 'InitializeInstanceElements', // used by class syntax 'IsPrivateReference', 'MakePrivateReference', 'NewPrivateEnvironment', 'PrivateElementFind', 'PrivateFieldAdd', 'PrivateGet', 'PrivateMethodOrAccessorAdd', 'PrivateSet', 'ResolvePrivateIdentifier', 'RoundMVResult' ]; require('./tests').es2022(boundES, ops, expectedMissing); require('./helpers/runManifestTest')(require('tape'), ES, 2022); es-abstract-1.20.4/test/es5.js000066400000000000000000000004651431761430200160250ustar00rootroot00000000000000'use strict'; var ES = require('../').ES5; var boundES = require('./helpers/createBoundESNamespace')(ES); var ops = require('../operations/es5'); var expectedMissing = [ 'SplitMatch' ]; require('./tests').es5(boundES, ops, expectedMissing); require('./helpers/runManifestTest')(require('tape'), ES, 5); es-abstract-1.20.4/test/es6.js000066400000000000000000000005621431761430200160240ustar00rootroot00000000000000'use strict'; var test = require('tape'); var ES = require('../'); var ES6 = ES.ES6; var ES2015 = ES.ES2015; var ES6entry = require('../es6'); test('legacy es6 export', function (t) { t.equal(ES6, ES2015, 'main ES6 === main ES2015'); t.end(); }); test('legacy es6 entry point', function (t) { t.equal(ES6, ES6entry, 'main ES6 === ES6 entry point'); t.end(); }); es-abstract-1.20.4/test/es7.js000066400000000000000000000005621431761430200160250ustar00rootroot00000000000000'use strict'; var test = require('tape'); var ES = require('../'); var ES7 = ES.ES7; var ES2016 = ES.ES2016; var ES7entry = require('../es7'); test('legacy es7 export', function (t) { t.equal(ES7, ES2016, 'main ES7 === main ES2016'); t.end(); }); test('legacy es7 entry point', function (t) { t.equal(ES7, ES7entry, 'main ES7 === ES7 entry point'); t.end(); }); es-abstract-1.20.4/test/helpers/000077500000000000000000000000001431761430200164305ustar00rootroot00000000000000es-abstract-1.20.4/test/helpers/OwnPropertyKeys.js000066400000000000000000000023111431761430200221270ustar00rootroot00000000000000'use strict'; var test = require('tape'); var hasSymbols = require('has-symbols')(); var OwnPropertyKeys = require('../../helpers/OwnPropertyKeys'); var defineProperty = require('./defineProperty'); test('OwnPropertyKeys', function (t) { t.deepEqual(OwnPropertyKeys({ a: 1, b: 2 }).sort(), ['a', 'b'].sort(), 'returns own string keys'); t.test('Symbols', { skip: !hasSymbols }, function (st) { var o = { a: 1 }; var sym = Symbol(); o[sym] = 2; st.deepEqual(OwnPropertyKeys(o), ['a', sym], 'returns own string and symbol keys'); st.end(); }); t.test('non-enumerables', { skip: !defineProperty.oDP }, function (st) { var o = { a: 1, b: 42, c: NaN }; defineProperty(o, 'b', { enumerable: false, value: 42 }); defineProperty(o, 'c', { enumerable: false, get: function () { return NaN; } }); if (hasSymbols) { defineProperty(o, 'd', { enumerable: false, value: true }); defineProperty(o, 'e', { enumerable: false, get: function () { return true; } }); } st.deepEqual( OwnPropertyKeys(o).sort(), (hasSymbols ? ['a', 'b', 'c', 'd', 'e'] : ['a', 'b', 'c']).sort(), 'returns non-enumerable own keys, including accessors and symbols if available' ); st.end(); }); t.end(); }); es-abstract-1.20.4/test/helpers/assertRecord.js000066400000000000000000000032231431761430200214260ustar00rootroot00000000000000'use strict'; var forEach = require('for-each'); var debug = require('object-inspect'); var assertRecord = require('../../helpers/assertRecord'); var v = require('es-value-fixtures'); module.exports = function assertRecordTests(ES, test) { test('Property Descriptor', function (t) { var record = 'Property Descriptor'; forEach(v.nonUndefinedPrimitives, function (primitive) { t['throws']( function () { assertRecord(ES.Type, record, 'arg', primitive); }, TypeError, debug(primitive) + ' is not a Property Descriptor' ); }); t['throws']( function () { assertRecord(ES.Type, record, 'arg', { invalid: true }); }, TypeError, 'invalid keys not allowed on a Property Descriptor' ); t.doesNotThrow( function () { assertRecord(ES.Type, record, 'arg', {}); }, 'empty object is an incomplete Property Descriptor' ); t.doesNotThrow( function () { assertRecord(ES.Type, record, 'arg', v.accessorDescriptor()); }, 'accessor descriptor is a Property Descriptor' ); t.doesNotThrow( function () { assertRecord(ES.Type, record, 'arg', v.mutatorDescriptor()); }, 'mutator descriptor is a Property Descriptor' ); t.doesNotThrow( function () { assertRecord(ES.Type, record, 'arg', v.dataDescriptor()); }, 'data descriptor is a Property Descriptor' ); t.doesNotThrow( function () { assertRecord(ES.Type, record, 'arg', v.genericDescriptor()); }, 'generic descriptor is a Property Descriptor' ); t['throws']( function () { assertRecord(ES.Type, record, 'arg', v.bothDescriptor()); }, TypeError, 'a Property Descriptor can not be both a Data and an Accessor Descriptor' ); t.end(); }); }; es-abstract-1.20.4/test/helpers/createBoundESNamespace.js000066400000000000000000000010111431761430200232570ustar00rootroot00000000000000'use strict'; var bind = require('function-bind'); var OwnPropertyKeys = require('../../helpers/OwnPropertyKeys'); module.exports = function createBoundESNamespace(ES) { var keys = OwnPropertyKeys(ES); var result = {}; for (var i = 0; i < keys.length; i++) { var key = keys[i]; var prop = ES[key]; if (typeof prop === 'function') { prop = bind.call(prop, undefined); } else if (prop && typeof prop === 'object') { prop = createBoundESNamespace(prop); } result[key] = prop; } return result; }; es-abstract-1.20.4/test/helpers/defineProperty.js000066400000000000000000000012531431761430200217660ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('../../GetIntrinsic'); var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); if ($defineProperty) { try { $defineProperty({}, 'a', { value: 1 }); } catch (e) { // IE 8 has a broken defineProperty $defineProperty = null; } } module.exports = function defineProperty(O, P, Desc) { if ($defineProperty) { return $defineProperty(O, P, Desc); } if ((Desc.enumerable && Desc.configurable && Desc.writable) || !(P in O)) { O[P] = Desc.value; // eslint-disable-line no-param-reassign return O; } throw new SyntaxError('helper does not yet support this configuration'); }; module.exports.oDP = $defineProperty; es-abstract-1.20.4/test/helpers/fromPropertyDescriptor.js000066400000000000000000000015651431761430200235440ustar00rootroot00000000000000'use strict'; var test = require('tape'); var fromPropertyDescriptor = require('../../helpers/fromPropertyDescriptor'); test('fromPropertyDescriptor', function (t) { t.deepEqual( fromPropertyDescriptor({}), {}, 'empty obj -> empty obj' ); t.deepEqual( fromPropertyDescriptor({ '[[Value]]': undefined }), { value: undefined }, 'undefined [[Value]] Property Descriptor -> obj with value' ); t.deepEqual( fromPropertyDescriptor({ enumerable: false }), {}, 'descriptor obj -> empty obj' ); t.deepEqual( fromPropertyDescriptor({ '[[Configurable]]': 'true', '[[Enumerable]]': 'false', '[[Get]]': NaN, '[[Set]]': -0, '[[Value]]': 42, '[[Writable]]': 0 }), { // order is important value: 42, writable: false, get: NaN, set: -0, enumerable: true, configurable: true }, 'Property Descriptor -> obj' ); t.end(); }); es-abstract-1.20.4/test/helpers/getIteratorMethod.js000066400000000000000000000021541431761430200224220ustar00rootroot00000000000000'use strict'; var test = require('tape'); var getIteratorMethod = require('../../helpers/getIteratorMethod'); var ES = require('../../es2021'); var testIterator = function (t, iterator) { var result = iterator.next(); var values = []; if (!result.done) { values.push(result.value); values = values.concat(testIterator(t, iterator)); } return values; }; test('getIteratorMethod', function (t) { t.equal(typeof getIteratorMethod, 'function', 'is a function'); var arr = [1, 2, 3]; var arrayIt = getIteratorMethod(ES, arr).call(arr); t.deepEqual( testIterator(t, arrayIt), [1, 2, 3], 'array iterator' ); var withHamburger = 'foo\uD834\uDF06bar'; var stringIt = getIteratorMethod(ES, withHamburger).call(withHamburger); t.deepEqual( testIterator(t, stringIt), ['f', 'o', 'o', '\uD834\uDF06', 'b', 'a', 'r'], 'string iterator' ); var boxedHamburger = Object(withHamburger); var boxedStringIt = getIteratorMethod(ES, boxedHamburger).call(boxedHamburger); t.deepEqual( testIterator(t, boxedStringIt), ['f', 'o', 'o', '\uD834\uDF06', 'b', 'a', 'r'], 'boxed string iterator' ); t.end(); }); es-abstract-1.20.4/test/helpers/getSymbolDescription.js000066400000000000000000000034431431761430200231430ustar00rootroot00000000000000'use strict'; var test = require('tape'); var debug = require('object-inspect'); var forEach = require('for-each'); var has = require('has'); var v = require('es-value-fixtures'); var getSymbolDescription = require('get-symbol-description'); var getInferredName = require('get-symbol-description/getInferredName'); test('getSymbolDescription', function (t) { t.test('no symbols', { skip: v.hasSymbols }, function (st) { st['throws']( getSymbolDescription, SyntaxError, 'requires Symbol support' ); st.end(); }); forEach(v.nonSymbolPrimitives.concat(v.objects), function (nonSymbol) { t['throws']( function () { getSymbolDescription(nonSymbol); }, v.hasSymbols ? TypeError : SyntaxError, debug(nonSymbol) + ' is not a Symbol' ); }); t.test('with symbols', { skip: !v.hasSymbols }, function (st) { forEach( [ [Symbol(), undefined], [Symbol(undefined), undefined], [Symbol(null), 'null'], [Symbol.iterator, 'Symbol.iterator'], [Symbol('foo'), 'foo'] ], function (pair) { var sym = pair[0]; var desc = pair[1]; st.equal(getSymbolDescription(sym), desc, debug(sym) + ' description is ' + debug(desc)); } ); st.test('only possible when inference or native `Symbol.prototype.description` is supported', { skip: !getInferredName && !has(Symbol.prototype, 'description') }, function (s2t) { s2t.equal(getSymbolDescription(Symbol('')), '', 'Symbol("") description is ""'); s2t.end(); }); st.test('only possible when global symbols are supported', { skip: !has(Symbol, 'for') || !has(Symbol, 'keyFor') }, function (s2t) { // eslint-disable-next-line no-restricted-properties s2t.equal(getSymbolDescription(Symbol['for']('')), '', 'Symbol.for("") description is ""'); s2t.end(); }); st.end(); }); t.end(); }); es-abstract-1.20.4/test/helpers/index.js000066400000000000000000000002041431761430200200710ustar00rootroot00000000000000'use strict'; require('./getSymbolDescription'); require('./isByteValue'); require('./isCodePoint'); require('./OwnPropertyKeys'); es-abstract-1.20.4/test/helpers/isByteValue.js000066400000000000000000000012211431761430200212160ustar00rootroot00000000000000'use strict'; var test = require('tape'); var forEach = require('for-each'); var debug = require('object-inspect'); var isByteValue = require('../../helpers/isByteValue'); var v = require('es-value-fixtures'); test('isByteValue', function (t) { forEach([].concat( v.notNonNegativeIntegers, -1, -42, -Infinity, Infinity, v.nonIntegerNumbers ), function (nonByteValue) { t.equal(isByteValue(nonByteValue), false, debug(nonByteValue) + ' is not a byte value'); }); for (var i = 0; i <= 255; i += 1) { t.equal(isByteValue(i), true, i + ' is a byte value'); } t.equal(isByteValue(256), false, '256 is not a byte value'); t.end(); }); es-abstract-1.20.4/test/helpers/isCodePoint.js000066400000000000000000000011171431761430200212060ustar00rootroot00000000000000'use strict'; var test = require('tape'); var forEach = require('for-each'); var debug = require('object-inspect'); var isCodePoint = require('../../helpers/isCodePoint'); var v = require('es-value-fixtures'); test('isCodePoint', function (t) { forEach(v.notNonNegativeIntegers.concat(0x10FFFF + 1), function (nonCodePoints) { t.equal(isCodePoint(nonCodePoints), false, debug(nonCodePoints) + ' is not a Code Point'); }); forEach([-0, 0, 1, 7, 42, 0x10FFFF], function (codePoint) { t.equal(isCodePoint(codePoint), true, debug(codePoint) + ' is a Code Point'); }); t.end(); }); es-abstract-1.20.4/test/helpers/runManifestTest.js000066400000000000000000000022131431761430200221170ustar00rootroot00000000000000'use strict'; var path = require('path'); var fs = require('fs'); var filter = require('array.prototype.filter'); var forEach = require('for-each'); var keys = require('object-keys'); module.exports = function runManifestTest(test, ES, edition) { test('ES' + edition + ' manifest', { skip: !fs.readdirSync }, function (t) { var files = filter( fs.readdirSync(path.join(__dirname, '../../' + edition), 'utf-8'), function rejectDotFile(file) { return file[0] !== '.'; } ); var map = { AbstractEqualityComparison: 'Abstract Equality Comparison', AbstractRelationalComparison: 'Abstract Relational Comparison', StrictEqualityComparison: 'Strict Equality Comparison' }; forEach(files, function (file) { var name = path.basename(file, path.extname(file)); var actual = ES[map[name] || name]; var expected = require(path.join(__dirname, '../../' + edition + '/', file)); // eslint-disable-line global-require t.equal(actual, expected, 'ES["' + name + '"] === ' + file); }); var actualCount = keys(ES).length; t.equal(actualCount, files.length, 'expected ' + files.length + ' files, got ' + actualCount); t.end(); }); }; es-abstract-1.20.4/test/index.js000066400000000000000000000016351431761430200164400ustar00rootroot00000000000000'use strict'; var ES = require('../'); var test = require('tape'); var keys = require('object-keys'); var forEach = require('for-each'); var ESkeys = keys(ES).sort(); var ES6keys = keys(ES.ES6).sort(); test('exposed properties', function (t) { t.deepEqual(ESkeys, ES6keys.concat([ 'ES2022', 'ES2021', 'ES2020', 'ES2019', 'ES2018', 'ES2017', 'ES7', 'ES2016', 'ES6', 'ES2015', 'ES5' ]).sort(), 'main ES object keys match ES6 keys'); t.end(); }); test('methods match', function (t) { forEach(ES6keys, function (key) { t.equal(ES.ES6[key], ES[key], 'method ' + key + ' on main ES object is ES6 method'); }); t.end(); }); require('./GetIntrinsic'); require('./helpers'); require('./es5'); require('./es6'); require('./es2015'); require('./es7'); require('./es2016'); require('./es2017'); require('./es2018'); require('./es2019'); require('./es2020'); require('./es2021'); require('./es2022'); es-abstract-1.20.4/test/ses-compat.js000066400000000000000000000001531431761430200173760ustar00rootroot00000000000000'use strict'; /* globals lockdown */ require('ses'); lockdown({ errorTaming: 'unsafe' }); require('.'); es-abstract-1.20.4/test/tests.js000066400000000000000000010550041431761430200164730ustar00rootroot00000000000000'use strict'; var tape = require('tape'); var forEach = require('for-each'); var debug = require('object-inspect'); var assign = require('object.assign'); var keys = require('object-keys'); var flatMap = require('array.prototype.flatmap'); var has = require('has'); var arrowFns = require('make-arrow-function').list(); var hasStrictMode = require('has-strict-mode')(); var functionsHaveNames = require('functions-have-names')(); var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames(); var boundFunctionsHaveNames = require('functions-have-names').boundFunctionsHaveNames(); var hasBigInts = require('has-bigints')(); var $getProto = require('../helpers/getProto'); var $setProto = require('../helpers/setProto'); var defineProperty = require('./helpers/defineProperty'); var getInferredName = require('../helpers/getInferredName'); var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor'); var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor'); var assertRecordTests = require('./helpers/assertRecord'); var v = require('es-value-fixtures'); var diffOps = require('./diffOps'); var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; var $BigInt = hasBigInts ? BigInt : null; var supportedRegexFlags = require('available-regexp-flags'); var thisTimeValue = require('../2015/thisTimeValue'); // node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER var needsBigIntHack = false; if (hasBigInts) { try { $BigInt(Math.pow(2, 64)); } catch (e) { needsBigIntHack = true; } } var safeBigInt = needsBigIntHack ? function (int) { if (int > MAX_SAFE_INTEGER || -int > MAX_SAFE_INTEGER) { // construct a maximum-precision string of digits // from a native serialization like . or .e+ var preciseParts = Number(int).toPrecision(100).split('e'); var significand = preciseParts[0].replace(/(\.[0-9]*?)0*$/, '$1'); var baseTenExponent = Number(preciseParts[1] || 0); if (baseTenExponent > 0) { var significandScale = (significand + '.').indexOf('.'); baseTenExponent -= significand.length - 1 - significandScale; } var digits = significand.replace('.', '') + Array(baseTenExponent + 1).join('0'); return eval(digits + 'n'); // eslint-disable-line no-eval } return $BigInt(int); } : $BigInt; var twoSixtyFour = hasBigInts && safeBigInt(Math.pow(2, 64)); var twoSixtyThree = hasBigInts && safeBigInt(Math.pow(2, 63)); var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false // IE 9 does not throw in strict mode when writability/configurability/extensibility is violated var noThrowOnStrictViolation = (function () { try { delete [].length; return true; } catch (e) { } return false; }()); var nameExceptions = { IsArray: true, IsCallable: true, RequireObjectCoercible: true }; var makeTest = function makeTest(ES, skips) { return function test(opName, maybeOpts, maybeCb) { var origOpts = arguments.length > 2 ? maybeOpts : {}; var opts = assign( {}, origOpts, { skip: (skips && skips[opName]) || origOpts.skip } ); var cb = arguments.length > 2 ? maybeCb : maybeOpts; return tape( opName, opts, ES[opName] ? function (t) { var expectedName = opName.replace(/ /g, ''); t.match( ES[opName].name, new RegExp('^(?:bound )' + expectedName + '$'), 'ES.' + opName + '.name === ' + expectedName, { // node v4.0.0 has a weird bug where sometimes bound functions' names are `bound ` skip: !functionsHaveNames || !boundFunctionsHaveNames || process.version === 'v4.0.0', todo: nameExceptions[opName] } ); var origPlan = t.plan; t.plan = function (n) { // eslint-disable-line no-param-reassign origPlan.call(t, n + 1); }; return cb.apply(null, arguments); } : cb ); }; }; var leadingPoo = '\uD83D'; var trailingPoo = '\uDCA9'; var wholePoo = leadingPoo + trailingPoo; var getArraySubclassWithSpeciesConstructor = function getArraySubclass(speciesConstructor) { var Bar = function Bar() { var inst = []; Object.setPrototypeOf(inst, Bar.prototype); defineProperty(inst, 'constructor', { value: Bar }); return inst; }; Bar.prototype = Object.create(Array.prototype); Object.setPrototypeOf(Bar, Array); defineProperty(Bar, Symbol.species, { value: speciesConstructor }); return Bar; }; var testIterator = function (t, iterator, expected) { var resultCount = 0; var result; while (result = iterator.next(), !result.done && resultCount < expected.length + 1) { // eslint-disable-line no-sequences t.deepEqual(result, { done: false, value: expected[resultCount] }, 'result ' + resultCount); resultCount += 1; } t.equal(resultCount, expected.length, 'expected ' + expected.length + ', got ' + (result.done ? '' : 'more than ') + resultCount); }; // eslint-disable-next-line max-params var testRESIterator = function testRegExpStringIterator(ES, t, regex, str, global, unicode, expected) { var iterator = ES.CreateRegExpStringIterator(regex, str, global, unicode); t.equal(typeof iterator, 'object', 'iterator is an object'); t.equal(typeof iterator.next, 'function', '`.next` is a function'); t.test('has symbols', { skip: !v.hasSymbols }, function (st) { st.equal(typeof iterator[Symbol.iterator], 'function', '[`Symbol.iterator`] is a function'); st.end(); }); testIterator(t, iterator, expected); }; var hasSpecies = v.hasSymbols && Symbol.species; var hasLastIndex = 'lastIndex' in (/a/).exec('a'); // IE 8 var hasGroups = 'groups' in (/a/).exec('a'); // modern engines var kludgeMatch = function kludgeMatch(R, matchObject) { if (hasGroups) { assign(matchObject, { groups: matchObject.groups }); } if (hasLastIndex) { assign(matchObject, { lastIndex: matchObject.lastIndex || R.lastIndex }); } else { delete matchObject.lastIndex; // eslint-disable-line no-param-reassign } return matchObject; }; var testEnumerableOwnNames = function (t, enumerableOwnNames) { forEach(v.primitives, function (nonObject) { t['throws']( function () { enumerableOwnNames(nonObject); }, debug(nonObject) + ' is not an Object' ); }); var Child = function Child() { this.own = {}; }; Child.prototype = { inherited: {} }; var obj = new Child(); t.equal('own' in obj, true, 'has "own"'); t.equal(has(obj, 'own'), true, 'has own "own"'); t.equal(Object.prototype.propertyIsEnumerable.call(obj, 'own'), true, 'has enumerable "own"'); t.equal('inherited' in obj, true, 'has "inherited"'); t.equal(has(obj, 'inherited'), false, 'has non-own "inherited"'); t.equal(has(Child.prototype, 'inherited'), true, 'Child.prototype has own "inherited"'); t.equal(Child.prototype.inherited, obj.inherited, 'Child.prototype.inherited === obj.inherited'); t.equal(Object.prototype.propertyIsEnumerable.call(Child.prototype, 'inherited'), true, 'has enumerable "inherited"'); t.equal('toString' in obj, true, 'has "toString"'); t.equal(has(obj, 'toString'), false, 'has non-own "toString"'); t.equal(has(Object.prototype, 'toString'), true, 'Object.prototype has own "toString"'); t.equal(Object.prototype.toString, obj.toString, 'Object.prototype.toString === obj.toString'); // eslint-disable-next-line no-useless-call t.equal(Object.prototype.propertyIsEnumerable.call(Object.prototype, 'toString'), false, 'has non-enumerable "toString"'); return obj; }; var testStringToNumber = function (t, ES, StringToNumber) { // TODO: check if this applies to ES5 t.test('trimming of whitespace and non-whitespace characters', function (st) { var whitespace = ' \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'; st.equal(0, StringToNumber(whitespace + 0 + whitespace), 'whitespace is trimmed'); // Zero-width space (zws), next line character (nel), and non-character (bom) are not whitespace. var nonWhitespaces = { '\\u0085': '\u0085', '\\u200b': '\u200b', '\\ufffe': '\ufffe' }; forEach(nonWhitespaces, function (desc, nonWS) { st.equal(StringToNumber(nonWS + 0 + nonWS), NaN, 'non-whitespace ' + desc + ' not trimmed'); }); st.end(); }); t.test('stringified numbers', function (st) { forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) { st.equal(+numString, StringToNumber(numString), '"' + numString + '" coerces to ' + Number(numString)); }); forEach(v.numbers, function (number) { var str = number === 0 ? debug(number) : String(number); st.equal(StringToNumber(str), number, debug(number) + ' stringified, coerces to itself'); }); st.end(); }); }; var testToNumber = function (t, ES, ToNumber) { t.equal(NaN, ToNumber(undefined), 'undefined coerces to NaN'); t.equal(ToNumber(null), 0, 'null coerces to +0'); t.equal(ToNumber(false), 0, 'false coerces to +0'); t.equal(1, ToNumber(true), 'true coerces to 1'); t.test('numbers', function (st) { st.equal(NaN, ToNumber(NaN), 'NaN returns itself'); forEach(v.zeroes.concat(v.infinities, 42), function (num) { st.equal(num, ToNumber(num), num + ' returns itself'); }); st.end(); }); t.test('objects', function (st) { forEach(v.objects, function (object) { st.equal(ToNumber(object), ToNumber(ES.ToPrimitive(object)), 'object ' + object + ' coerces to same as ToPrimitive of object does'); }); st['throws'](function () { return ToNumber(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); st.end(); }); // TODO: check if this applies to ES5 t.test('binary literals', function (st) { st.equal(ToNumber('0b10'), 2, '0b10 is 2'); st.equal(ToNumber({ toString: function () { return '0b11'; } }), 3, 'Object that toStrings to 0b11 is 3'); st.equal(ToNumber('0b12'), NaN, '0b12 is NaN'); st.equal(ToNumber({ toString: function () { return '0b112'; } }), NaN, 'Object that toStrings to 0b112 is NaN'); st.end(); }); // TODO: check if this applies to ES5 t.test('octal literals', function (st) { st.equal(ToNumber('0o10'), 8, '0o10 is 8'); st.equal(ToNumber({ toString: function () { return '0o11'; } }), 9, 'Object that toStrings to 0o11 is 9'); st.equal(ToNumber('0o18'), NaN, '0o18 is NaN'); st.equal(ToNumber({ toString: function () { return '0o118'; } }), NaN, 'Object that toStrings to 0o118 is NaN'); st.end(); }); // TODO: check if this applies to ES5 t.test('signed hex numbers', function (st) { st.equal(ToNumber('-0xF'), NaN, '-0xF is NaN'); st.equal(ToNumber(' -0xF '), NaN, 'space-padded -0xF is NaN'); st.equal(ToNumber('+0xF'), NaN, '+0xF is NaN'); st.equal(ToNumber(' +0xF '), NaN, 'space-padded +0xF is NaN'); st.end(); }); testStringToNumber(t, ES, ToNumber); // TODO: skip for ES5 forEach(v.symbols, function (symbol) { t['throws']( function () { ToNumber(symbol); }, TypeError, 'Symbols can’t be converted to a Number: ' + debug(symbol) ); var boxed = Object(symbol); t['throws']( function () { ToNumber(boxed); }, TypeError, 'boxed Symbols can’t be converted to a Number: ' + debug(boxed) ); }); // TODO: check if this applies to ES5 t.test('dates', function (st) { var invalid = new Date(NaN); st.equal(ToNumber(invalid), NaN, 'invalid Date coerces to NaN'); var now = +new Date(); st.equal(ToNumber(new Date(now)), now, 'Date coerces to timestamp'); st.end(); }); }; var es5 = function ES5(ES, ops, expectedMissing, skips) { var test = makeTest(ES, skips); test('has expected operations', function (t) { var diff = diffOps(ES, ops, expectedMissing); t.deepEqual(diff.extra, [], 'no extra ops'); t.deepEqual(diff.missing, [], 'no unexpected missing ops'); t.deepEqual(diff.extraMissing, [], 'no unexpected "expected missing" ops'); t.end(); }); test('ToPrimitive', function (t) { t.test('primitives', function (st) { var testPrimitive = function (primitive) { st.equal(ES.ToPrimitive(primitive), primitive, debug(primitive) + ' is returned correctly'); }; forEach(v.primitives, testPrimitive); st.end(); }); t.test('objects', function (st) { st.equal(ES.ToPrimitive(v.coercibleObject), 3, 'coercibleObject with no hint coerces to valueOf'); st.equal(ES.ToPrimitive({}), '[object Object]', '{} with no hint coerces to Object#toString'); st.equal(ES.ToPrimitive(v.coercibleObject, Number), 3, 'coercibleObject with hint Number coerces to valueOf'); st.equal(ES.ToPrimitive({}, Number), '[object Object]', '{} with hint Number coerces to NaN'); st.equal(ES.ToPrimitive(v.coercibleObject, String), 42, 'coercibleObject with hint String coerces to nonstringified toString'); st.equal(ES.ToPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString'); st.equal(ES.ToPrimitive(v.coercibleFnObject), v.coercibleFnObject.toString(), 'coercibleFnObject coerces to toString'); st.equal(ES.ToPrimitive(v.toStringOnlyObject), 7, 'toStringOnlyObject returns non-stringified toString'); st.equal(ES.ToPrimitive(v.valueOfOnlyObject), 4, 'valueOfOnlyObject returns valueOf'); st['throws'](function () { return ES.ToPrimitive(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError'); st['throws'](function () { return ES.ToPrimitive(v.uncoercibleFnObject); }, TypeError, 'uncoercibleFnObject throws a TypeError'); st.end(); }); t.test('dates', function (st) { var invalid = new Date(NaN); st.equal(ES.ToPrimitive(invalid), Date.prototype.toString.call(invalid), 'invalid Date coerces to Date#toString'); var now = new Date(); st.equal(ES.ToPrimitive(now), Date.prototype.toString.call(now), 'Date coerces to Date#toString'); st.end(); }); t.end(); }); test('ToBoolean', function (t) { t.equal(false, ES.ToBoolean(undefined), 'undefined coerces to false'); t.equal(false, ES.ToBoolean(null), 'null coerces to false'); t.equal(false, ES.ToBoolean(false), 'false returns false'); t.equal(true, ES.ToBoolean(true), 'true returns true'); t.test('numbers', function (st) { forEach(v.zeroes.concat(NaN), function (falsyNumber) { st.equal(false, ES.ToBoolean(falsyNumber), 'falsy number ' + falsyNumber + ' coerces to false'); }); forEach(v.infinities.concat([42, 1]), function (truthyNumber) { st.equal(true, ES.ToBoolean(truthyNumber), 'truthy number ' + truthyNumber + ' coerces to true'); }); st.end(); }); t.equal(false, ES.ToBoolean(''), 'empty string coerces to false'); t.equal(true, ES.ToBoolean('foo'), 'nonempty string coerces to true'); t.test('objects', function (st) { forEach(v.objects, function (obj) { st.equal(true, ES.ToBoolean(obj), 'object coerces to true'); }); st.equal(true, ES.ToBoolean(v.uncoercibleObject), 'uncoercibleObject coerces to true'); st.end(); }); t.end(); }); test('ToNumber', function (t) { t.equal(NaN, ES.ToNumber(undefined), 'undefined coerces to NaN'); t.equal(ES.ToNumber(null), 0, 'null coerces to +0'); t.equal(ES.ToNumber(false), 0, 'false coerces to +0'); t.equal(1, ES.ToNumber(true), 'true coerces to 1'); t.test('numbers', function (st) { st.equal(NaN, ES.ToNumber(NaN), 'NaN returns itself'); forEach(v.zeroes.concat(v.infinities, 42), function (num) { st.equal(num, ES.ToNumber(num), num + ' returns itself'); }); forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) { st.equal(+numString, ES.ToNumber(numString), '"' + numString + '" coerces to ' + Number(numString)); }); st.end(); }); t.test('objects', function (st) { forEach(v.objects, function (object) { st.equal(ES.ToNumber(object), ES.ToNumber(ES.ToPrimitive(object)), 'object ' + object + ' coerces to same as ToPrimitive of object does'); }); st['throws'](function () { return ES.ToNumber(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); st.end(); }); t.test('binary literals', function (st) { st.equal(ES.ToNumber('0b10'), NaN, '0b10 is NaN'); st.equal(ES.ToNumber({ toString: function () { return '0b11'; } }), NaN, 'Object that toStrings to 0b11 is NaN'); st.equal(ES.ToNumber('0b12'), NaN, '0b12 is NaN'); st.equal(ES.ToNumber({ toString: function () { return '0b112'; } }), NaN, 'Object that toStrings to 0b112 is NaN'); st.end(); }); t.test('octal literals', function (st) { st.equal(ES.ToNumber('0o10'), NaN, '0o10 is NaN'); st.equal(ES.ToNumber({ toString: function () { return '0o11'; } }), NaN, 'Object that toStrings to 0o11 is NaN'); st.equal(ES.ToNumber('0o18'), NaN, '0o18 is NaN'); st.equal(ES.ToNumber({ toString: function () { return '0o118'; } }), NaN, 'Object that toStrings to 0o118 is NaN'); st.end(); }); t.test('signed hex numbers', function (st) { st.equal(ES.ToNumber('-0xF'), NaN, '-0xF is NaN'); st.equal(ES.ToNumber(' -0xF '), NaN, 'space-padded -0xF is NaN'); st.equal(ES.ToNumber('+0xF'), NaN, '+0xF is NaN'); st.equal(ES.ToNumber(' +0xF '), NaN, 'space-padded +0xF is NaN'); st.end(); }); // TODO: check if this applies to ES5 t.test('trimming of whitespace and non-whitespace characters', function (st) { var whitespace = ' \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u0085'; st.equal(ES.ToNumber(whitespace + 0 + whitespace), 0, 'whitespace is trimmed'); // Zero-width space (zws), next line character (nel), and non-character (bom) are not whitespace. var nonWhitespaces = { '\\u200b': '\u200b', '\\ufffe': '\ufffe' }; forEach(nonWhitespaces, function (desc, nonWS) { st.equal(ES.ToNumber(nonWS + 0 + nonWS), NaN, 'non-whitespace ' + desc + ' not trimmed'); }); st.end(); }); t.test('dates', function (st) { var invalid = new Date(NaN); st.equal(ES.ToNumber(invalid), NaN, 'invalid Date coerces to NaN'); var now = +new Date(); st.equal(ES.ToNumber(new Date(now)), now, 'Date coerces to timestamp'); st.end(); }); t.end(); }); test('ToInteger', function (t) { forEach([NaN], function (num) { t.equal(0, ES.ToInteger(num), debug(num) + ' returns +0'); }); forEach(v.zeroes.concat(v.infinities, 42), function (num) { t.equal(num, ES.ToInteger(num), debug(num) + ' returns itself'); t.equal(-num, ES.ToInteger(-num), '-' + debug(num) + ' returns itself'); }); t.equal(3, ES.ToInteger(Math.PI), 'pi returns 3'); t['throws'](function () { return ES.ToInteger(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); t.end(); }); test('ToInt32', function (t) { t.equal(ES.ToInt32(NaN), 0, 'NaN coerces to +0'); forEach(v.zeroes.concat(v.infinities), function (num) { t.equal(ES.ToInt32(num), 0, num + ' returns +0'); t.equal(ES.ToInt32(-num), 0, '-' + num + ' returns +0'); }); t['throws'](function () { return ES.ToInt32(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); t.equal(ES.ToInt32(0x100000000), 0, '2^32 returns +0'); t.equal(ES.ToInt32(0x100000000 - 1), -1, '2^32 - 1 returns -1'); t.equal(ES.ToInt32(0x80000000), -0x80000000, '2^31 returns -2^31'); t.equal(ES.ToInt32(0x80000000 - 1), 0x80000000 - 1, '2^31 - 1 returns 2^31 - 1'); forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) { t.equal(ES.ToInt32(num), ES.ToInt32(ES.ToUint32(num)), 'ToInt32(x) === ToInt32(ToUint32(x)) for 0x' + num.toString(16)); t.equal(ES.ToInt32(-num), ES.ToInt32(ES.ToUint32(-num)), 'ToInt32(x) === ToInt32(ToUint32(x)) for -0x' + num.toString(16)); }); t.end(); }); test('ToUint32', function (t) { t.equal(0, ES.ToUint32(NaN), 'NaN coerces to +0'); forEach([0, Infinity], function (num) { t.equal(0, ES.ToUint32(num), num + ' returns +0'); t.equal(0, ES.ToUint32(-num), '-' + num + ' returns +0'); }); t['throws'](function () { return ES.ToUint32(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); t.equal(ES.ToUint32(0x100000000), 0, '2^32 returns +0'); t.equal(ES.ToUint32(0x100000000 - 1), 0x100000000 - 1, '2^32 - 1 returns 2^32 - 1'); t.equal(ES.ToUint32(0x80000000), 0x80000000, '2^31 returns 2^31'); t.equal(ES.ToUint32(0x80000000 - 1), 0x80000000 - 1, '2^31 - 1 returns 2^31 - 1'); forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) { t.equal(ES.ToUint32(num), ES.ToUint32(ES.ToInt32(num)), 'ToUint32(x) === ToUint32(ToInt32(x)) for 0x' + num.toString(16)); t.equal(ES.ToUint32(-num), ES.ToUint32(ES.ToInt32(-num)), 'ToUint32(x) === ToUint32(ToInt32(x)) for -0x' + num.toString(16)); }); t.end(); }); test('ToUint16', function (t) { t.equal(0, ES.ToUint16(NaN), 'NaN coerces to +0'); forEach([0, Infinity], function (num) { t.equal(0, ES.ToUint16(num), num + ' returns +0'); t.equal(0, ES.ToUint16(-num), '-' + num + ' returns +0'); }); t['throws'](function () { return ES.ToUint16(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); t.equal(ES.ToUint16(0x100000000), 0, '2^32 returns +0'); t.equal(ES.ToUint16(0x100000000 - 1), 0x10000 - 1, '2^32 - 1 returns 2^16 - 1'); t.equal(ES.ToUint16(0x80000000), 0, '2^31 returns +0'); t.equal(ES.ToUint16(0x80000000 - 1), 0x10000 - 1, '2^31 - 1 returns 2^16 - 1'); t.equal(ES.ToUint16(0x10000), 0, '2^16 returns +0'); t.equal(ES.ToUint16(0x10000 - 1), 0x10000 - 1, '2^16 - 1 returns 2^16 - 1'); t.end(); }); test('ToString', function (t) { forEach(v.objects.concat(v.nonSymbolPrimitives), function (item) { t.equal(ES.ToString(item), String(item), 'ES.ToString(' + debug(item) + ') ToStrings to String(' + debug(item) + ')'); }); t['throws'](function () { return ES.ToString(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); t.end(); }); test('ToObject', function (t) { t['throws'](function () { return ES.ToObject(undefined); }, TypeError, 'undefined throws'); t['throws'](function () { return ES.ToObject(null); }, TypeError, 'null throws'); forEach(v.numbers, function (number) { var obj = ES.ToObject(number); t.equal(typeof obj, 'object', 'number ' + number + ' coerces to object'); t.equal(true, obj instanceof Number, 'object of ' + number + ' is Number object'); t.equal(obj.valueOf(), number, 'object of ' + number + ' coerces to ' + number); }); t.end(); }); test('CheckObjectCoercible', function (t) { t['throws'](function () { return ES.CheckObjectCoercible(undefined); }, TypeError, 'undefined throws'); t['throws'](function () { return ES.CheckObjectCoercible(null); }, TypeError, 'null throws'); var checkCoercible = function (value) { t.doesNotThrow(function () { return ES.CheckObjectCoercible(value); }, debug(value) + ' does not throw'); }; forEach(v.objects.concat(v.nonNullPrimitives), checkCoercible); t.end(); }); test('IsCallable', function (t) { t.equal(true, ES.IsCallable(function () {}), 'function is callable'); var nonCallables = [/a/g, {}, Object.prototype, NaN].concat(v.nonFunctions); forEach(nonCallables, function (nonCallable) { t.equal(false, ES.IsCallable(nonCallable), debug(nonCallable) + ' is not callable'); }); t.end(); }); test('SameValue', function (t) { t.equal(true, ES.SameValue(NaN, NaN), 'NaN is SameValue as NaN'); t.equal(false, ES.SameValue(0, -0), '+0 is not SameValue as -0'); forEach(v.objects.concat(v.primitives), function (val) { t.equal(val === val, ES.SameValue(val, val), debug(val) + ' is SameValue to itself'); }); t.end(); }); test('Type', function (t) { t.equal(ES.Type(), 'Undefined', 'Type() is Undefined'); t.equal(ES.Type(undefined), 'Undefined', 'Type(undefined) is Undefined'); t.equal(ES.Type(null), 'Null', 'Type(null) is Null'); t.equal(ES.Type(true), 'Boolean', 'Type(true) is Boolean'); t.equal(ES.Type(false), 'Boolean', 'Type(false) is Boolean'); t.equal(ES.Type(0), 'Number', 'Type(0) is Number'); t.equal(ES.Type(NaN), 'Number', 'Type(NaN) is Number'); t.equal(ES.Type('abc'), 'String', 'Type("abc") is String'); t.equal(ES.Type(function () {}), 'Object', 'Type(function () {}) is Object'); t.equal(ES.Type({}), 'Object', 'Type({}) is Object'); t.end(); }); assertRecordTests(ES, test); test('IsAccessorDescriptor', function (t) { forEach(v.nonUndefinedPrimitives, function (primitive) { t['throws']( function () { ES.IsAccessorDescriptor(primitive); }, TypeError, debug(primitive) + ' is not a Property Descriptor' ); }); t.equal(ES.IsAccessorDescriptor(), false, 'no value is not an Accessor Descriptor'); t.equal(ES.IsAccessorDescriptor(undefined), false, 'undefined value is not an Accessor Descriptor'); t.equal(ES.IsAccessorDescriptor(v.accessorDescriptor()), true, 'accessor descriptor is an Accessor Descriptor'); t.equal(ES.IsAccessorDescriptor(v.mutatorDescriptor()), true, 'mutator descriptor is an Accessor Descriptor'); t.equal(ES.IsAccessorDescriptor(v.dataDescriptor()), false, 'data descriptor is not an Accessor Descriptor'); t.equal(ES.IsAccessorDescriptor(v.genericDescriptor()), false, 'generic descriptor is not an Accessor Descriptor'); t.end(); }); test('IsDataDescriptor', function (t) { forEach(v.nonUndefinedPrimitives, function (primitive) { t['throws']( function () { ES.IsDataDescriptor(primitive); }, TypeError, debug(primitive) + ' is not a Property Descriptor' ); }); t.equal(ES.IsDataDescriptor(), false, 'no value is not a Data Descriptor'); t.equal(ES.IsDataDescriptor(undefined), false, 'undefined value is not a Data Descriptor'); t.equal(ES.IsDataDescriptor(v.accessorDescriptor()), false, 'accessor descriptor is not a Data Descriptor'); t.equal(ES.IsDataDescriptor(v.mutatorDescriptor()), false, 'mutator descriptor is not a Data Descriptor'); t.equal(ES.IsDataDescriptor(v.dataDescriptor()), true, 'data descriptor is a Data Descriptor'); t.equal(ES.IsDataDescriptor(v.genericDescriptor()), false, 'generic descriptor is not a Data Descriptor'); t.end(); }); test('IsGenericDescriptor', function (t) { forEach(v.nonUndefinedPrimitives, function (primitive) { t['throws']( function () { ES.IsGenericDescriptor(primitive); }, TypeError, debug(primitive) + ' is not a Property Descriptor' ); }); t.equal(ES.IsGenericDescriptor(), false, 'no value is not a Data Descriptor'); t.equal(ES.IsGenericDescriptor(undefined), false, 'undefined value is not a Data Descriptor'); t.equal(ES.IsGenericDescriptor(v.accessorDescriptor()), false, 'accessor descriptor is not a generic Descriptor'); t.equal(ES.IsGenericDescriptor(v.mutatorDescriptor()), false, 'mutator descriptor is not a generic Descriptor'); t.equal(ES.IsGenericDescriptor(v.dataDescriptor()), false, 'data descriptor is not a generic Descriptor'); t.equal(ES.IsGenericDescriptor(v.genericDescriptor()), true, 'generic descriptor is a generic Descriptor'); t.end(); }); test('FromPropertyDescriptor', function (t) { t.equal(ES.FromPropertyDescriptor(), undefined, 'no value begets undefined'); t.equal(ES.FromPropertyDescriptor(undefined), undefined, 'undefined value begets undefined'); forEach(v.nonNullPrimitives.concat(null), function (primitive) { t['throws']( function () { ES.FromPropertyDescriptor(primitive); }, TypeError, debug(primitive) + ' is not a Property Descriptor' ); }); var accessor = v.accessorDescriptor(); t.deepEqual(ES.FromPropertyDescriptor(accessor), { get: accessor['[[Get]]'], set: accessor['[[Set]]'], enumerable: !!accessor['[[Enumerable]]'], configurable: !!accessor['[[Configurable]]'] }); var mutator = v.mutatorDescriptor(); t.deepEqual(ES.FromPropertyDescriptor(mutator), { get: mutator['[[Get]]'], set: mutator['[[Set]]'], enumerable: !!mutator['[[Enumerable]]'], configurable: !!mutator['[[Configurable]]'] }); var data = v.dataDescriptor(); t.deepEqual(ES.FromPropertyDescriptor(data), { value: data['[[Value]]'], writable: data['[[Writable]]'], enumerable: !!data['[[Enumerable]]'], configurable: !!data['[[Configurable]]'] }); t['throws']( function () { ES.FromPropertyDescriptor(v.genericDescriptor()); }, TypeError, 'a complete Property Descriptor is required' ); t.end(); }); test('ToPropertyDescriptor', function (t) { forEach(v.nonUndefinedPrimitives, function (primitive) { t['throws']( function () { ES.ToPropertyDescriptor(primitive); }, TypeError, debug(primitive) + ' is not an Object' ); }); var accessor = v.accessorDescriptor(); t.deepEqual(ES.ToPropertyDescriptor({ get: accessor['[[Get]]'], enumerable: !!accessor['[[Enumerable]]'], configurable: !!accessor['[[Configurable]]'] }), accessor); var mutator = v.mutatorDescriptor(); t.deepEqual(ES.ToPropertyDescriptor({ set: mutator['[[Set]]'], enumerable: !!mutator['[[Enumerable]]'], configurable: !!mutator['[[Configurable]]'] }), mutator); var data = v.descriptors.nonConfigurable(v.dataDescriptor()); t.deepEqual(ES.ToPropertyDescriptor({ value: data['[[Value]]'], writable: data['[[Writable]]'], configurable: !!data['[[Configurable]]'] }), data); var both = v.bothDescriptor(); t['throws']( function () { ES.ToPropertyDescriptor({ get: both['[[Get]]'], value: both['[[Value]]'] }); }, TypeError, 'data and accessor descriptors are mutually exclusive' ); t['throws']( function () { ES.ToPropertyDescriptor({ get: 'not callable' }); }, TypeError, '"get" must be undefined or callable' ); t['throws']( function () { ES.ToPropertyDescriptor({ set: 'not callable' }); }, TypeError, '"set" must be undefined or callable' ); forEach(v.nonFunctions, function (nonFunction) { if (typeof nonFunction !== 'undefined') { t['throws']( function () { ES.ToPropertyDescriptor({ get: nonFunction }); }, TypeError, '`.get` has ' + debug(nonFunction) + ', which is not a Function' ); t['throws']( function () { ES.ToPropertyDescriptor({ set: nonFunction }); }, TypeError, '`.set` has ' + debug(nonFunction) + ', which is not a Function' ); } }); forEach(['get', 'set'], function (accessorName) { forEach(['value', 'writable'], function (dataName) { var o = {}; o[accessorName] = undefined; o[dataName] = undefined; t['throws']( function () { ES.ToPropertyDescriptor(o); }, TypeError, accessorName + ' + ' + dataName + ' is invalid' ); }); }); t.end(); }); test('Abstract Equality Comparison', function (t) { t.test('same types use ===', function (st) { forEach(v.primitives.concat(v.objects), function (value) { st.equal(ES['Abstract Equality Comparison'](value, value), value === value, debug(value) + ' is abstractly equal to itself'); }); st.end(); }); t.test('different types coerce', function (st) { var pairs = [ [null, undefined], [3, '3'], [true, '3'], [true, 3], [false, 0], [false, '0'], [3, [3]], ['3', [3]], [true, [1]], [false, [0]], [String(v.coercibleObject), v.coercibleObject], [Number(String(v.coercibleObject)), v.coercibleObject], [Number(v.coercibleObject), v.coercibleObject], [String(Number(v.coercibleObject)), v.coercibleObject] ]; forEach(pairs, function (pair) { var a = pair[0]; var b = pair[1]; // eslint-disable-next-line eqeqeq st.equal(ES['Abstract Equality Comparison'](a, b), a == b, debug(a) + ' == ' + debug(b)); // eslint-disable-next-line eqeqeq st.equal(ES['Abstract Equality Comparison'](b, a), b == a, debug(b) + ' == ' + debug(a)); }); st.end(); }); t.end(); }); test('Strict Equality Comparison', function (t) { t.test('same types use ===', function (st) { forEach(v.primitives.concat(v.objects), function (value) { st.equal(ES['Strict Equality Comparison'](value, value), value === value, debug(value) + ' is strictly equal to itself'); }); st.end(); }); t.test('different types are not ===', function (st) { var pairs = [ [null, undefined], [3, '3'], [true, '3'], [true, 3], [false, 0], [false, '0'], [3, [3]], ['3', [3]], [true, [1]], [false, [0]], [String(v.coercibleObject), v.coercibleObject], [Number(String(v.coercibleObject)), v.coercibleObject], [Number(v.coercibleObject), v.coercibleObject], [String(Number(v.coercibleObject)), v.coercibleObject] ]; forEach(pairs, function (pair) { var a = pair[0]; var b = pair[1]; st.equal(ES['Strict Equality Comparison'](a, b), a === b, debug(a) + ' === ' + debug(b)); st.equal(ES['Strict Equality Comparison'](b, a), b === a, debug(b) + ' === ' + debug(a)); }); st.end(); }); t.end(); }); test('Abstract Relational Comparison', function (t) { t.test('at least one operand is NaN', function (st) { st.equal(ES['Abstract Relational Comparison'](NaN, {}, true), undefined, 'LeftFirst: first is NaN, returns undefined'); st.equal(ES['Abstract Relational Comparison']({}, NaN, true), undefined, 'LeftFirst: second is NaN, returns undefined'); st.equal(ES['Abstract Relational Comparison'](NaN, {}, false), undefined, '!LeftFirst: first is NaN, returns undefined'); st.equal(ES['Abstract Relational Comparison']({}, NaN, false), undefined, '!LeftFirst: second is NaN, returns undefined'); st.end(); }); forEach(v.nonBooleans, function (nonBoolean) { t['throws']( function () { ES['Abstract Relational Comparison'](3, 4, nonBoolean); }, TypeError, debug(nonBoolean) + ' is not a Boolean' ); }); forEach(v.zeroes, function (zero) { t.equal(ES['Abstract Relational Comparison'](zero, 1, true), true, 'LeftFirst: ' + debug(zero) + ' is less than 1'); t.equal(ES['Abstract Relational Comparison'](zero, 1, false), true, '!LeftFirst: ' + debug(zero) + ' is less than 1'); t.equal(ES['Abstract Relational Comparison'](1, zero, true), false, 'LeftFirst: 1 is not less than ' + debug(zero)); t.equal(ES['Abstract Relational Comparison'](1, zero, false), false, '!LeftFirst: 1 is not less than ' + debug(zero)); t.equal(ES['Abstract Relational Comparison'](zero, zero, true), false, 'LeftFirst: ' + debug(zero) + ' is not less than ' + debug(zero)); t.equal(ES['Abstract Relational Comparison'](zero, zero, false), false, '!LeftFirst: ' + debug(zero) + ' is not less than ' + debug(zero)); }); t.equal(ES['Abstract Relational Comparison'](Infinity, -Infinity, true), false, 'LeftFirst: ∞ is not less than -∞'); t.equal(ES['Abstract Relational Comparison'](Infinity, -Infinity, false), false, '!LeftFirst: ∞ is not less than -∞'); t.equal(ES['Abstract Relational Comparison'](-Infinity, Infinity, true), true, 'LeftFirst: -∞ is less than ∞'); t.equal(ES['Abstract Relational Comparison'](-Infinity, Infinity, false), true, '!LeftFirst: -∞ is less than ∞'); t.equal(ES['Abstract Relational Comparison'](-Infinity, 0, true), true, 'LeftFirst: -∞ is less than +0'); t.equal(ES['Abstract Relational Comparison'](-Infinity, 0, false), true, '!LeftFirst: -∞ is less than +0'); t.equal(ES['Abstract Relational Comparison'](0, -Infinity, true), false, 'LeftFirst: +0 is not less than -∞'); t.equal(ES['Abstract Relational Comparison'](0, -Infinity, false), false, '!LeftFirst: +0 is not less than -∞'); t.equal(ES['Abstract Relational Comparison'](3, 4, true), true, 'LeftFirst: 3 is less than 4'); t.equal(ES['Abstract Relational Comparison'](4, 3, true), false, 'LeftFirst: 3 is not less than 4'); t.equal(ES['Abstract Relational Comparison'](3, 4, false), true, '!LeftFirst: 3 is less than 4'); t.equal(ES['Abstract Relational Comparison'](4, 3, false), false, '!LeftFirst: 3 is not less than 4'); t.equal(ES['Abstract Relational Comparison']('3', '4', true), true, 'LeftFirst: "3" is less than "4"'); t.equal(ES['Abstract Relational Comparison']('4', '3', true), false, 'LeftFirst: "3" is not less than "4"'); t.equal(ES['Abstract Relational Comparison']('3', '4', false), true, '!LeftFirst: "3" is less than "4"'); t.equal(ES['Abstract Relational Comparison']('4', '3', false), false, '!LeftFirst: "3" is not less than "4"'); t.equal(ES['Abstract Relational Comparison']('a', 'abc', true), true, 'LeftFirst: "a" is less than "abc"'); t.equal(ES['Abstract Relational Comparison']('abc', 'a', true), false, 'LeftFirst: "abc" is not less than "a"'); t.equal(ES['Abstract Relational Comparison']('a', 'abc', false), true, '!LeftFirst: "a" is less than "abc"'); t.equal(ES['Abstract Relational Comparison']('abc', 'a', false), false, '!LeftFirst: "abc" is not less than "a"'); t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, 42, true), true, 'LeftFirst: coercible object is less than 42'); t.equal(ES['Abstract Relational Comparison'](42, v.coercibleObject, true), false, 'LeftFirst: 42 is not less than coercible object'); t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, 42, false), true, '!LeftFirst: coercible object is less than 42'); t.equal(ES['Abstract Relational Comparison'](42, v.coercibleObject, false), false, '!LeftFirst: 42 is not less than coercible object'); t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, '3', true), false, 'LeftFirst: coercible object is not less than "3"'); t.equal(ES['Abstract Relational Comparison']('3', v.coercibleObject, true), false, 'LeftFirst: "3" is not less than coercible object'); t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, '3', false), false, '!LeftFirst: coercible object is not less than "3"'); t.equal(ES['Abstract Relational Comparison']('3', v.coercibleObject, false), false, '!LeftFirst: "3" is not less than coercible object'); // TODO: compare LeftFirst true/false for observability t.end(); }); test('SecFromTime', function (t) { var now = new Date(); t.equal(ES.SecFromTime(now.getTime()), now.getUTCSeconds(), 'second from Date timestamp matches getUTCSeconds'); t.end(); }); test('MinFromTime', function (t) { var now = new Date(); t.equal(ES.MinFromTime(now.getTime()), now.getUTCMinutes(), 'minute from Date timestamp matches getUTCMinutes'); t.end(); }); test('HourFromTime', function (t) { var now = new Date(); t.equal(ES.HourFromTime(now.getTime()), now.getUTCHours(), 'hour from Date timestamp matches getUTCHours'); t.end(); }); test('msFromTime', function (t) { var now = new Date(); t.equal(ES.msFromTime(now.getTime()), now.getUTCMilliseconds(), 'ms from Date timestamp matches getUTCMilliseconds'); t.end(); }); var msPerSecond = 1e3; var msPerMinute = 60 * msPerSecond; var msPerHour = 60 * msPerMinute; var msPerDay = 24 * msPerHour; test('Day', function (t) { var time = Date.UTC(2019, 8, 10, 2, 3, 4, 5); var add = 2.5; var later = new Date(time + (add * msPerDay)); t.equal(ES.Day(later.getTime()), ES.Day(time) + Math.floor(add), 'adding 2.5 days worth of ms, gives a Day delta of 2'); t.end(); }); test('DayFromYear', function (t) { t.equal(ES.DayFromYear(2021) - ES.DayFromYear(2020), 366, '2021 is a leap year, has 366 days'); t.equal(ES.DayFromYear(2020) - ES.DayFromYear(2019), 365, '2020 is not a leap year, has 365 days'); t.equal(ES.DayFromYear(2019) - ES.DayFromYear(2018), 365, '2019 is not a leap year, has 365 days'); t.equal(ES.DayFromYear(2018) - ES.DayFromYear(2017), 365, '2018 is not a leap year, has 365 days'); t.equal(ES.DayFromYear(2017) - ES.DayFromYear(2016), 366, '2017 is a leap year, has 366 days'); t.end(); }); test('TimeWithinDay', function (t) { var time = Date.UTC(2019, 8, 10, 2, 3, 4, 5); var add = 2.5; var later = new Date(time + (add * msPerDay)); t.equal(ES.TimeWithinDay(later.getTime()), ES.TimeWithinDay(time) + (0.5 * msPerDay), 'adding 2.5 days worth of ms, gives a TimeWithinDay delta of +0.5'); t.end(); }); test('TimeFromYear', function (t) { for (var i = 1900; i < 2100; i += 1) { t.equal(ES.TimeFromYear(i), Date.UTC(i, 0, 1), 'TimeFromYear matches a Date object’s year: ' + i); } t.end(); }); test('YearFromTime', function (t) { for (var i = 1900; i < 2100; i += 1) { t.equal(ES.YearFromTime(Date.UTC(i, 0, 1)), i, 'YearFromTime matches a Date object’s year on 1/1: ' + i); t.equal(ES.YearFromTime(Date.UTC(i, 10, 1)), i, 'YearFromTime matches a Date object’s year on 10/1: ' + i); } t.end(); }); test('WeekDay', function (t) { var now = new Date(); var today = now.getUTCDay(); for (var i = 0; i < 7; i += 1) { var weekDay = ES.WeekDay(now.getTime() + (i * msPerDay)); t.equal(weekDay, (today + i) % 7, i + ' days after today (' + today + '), WeekDay is ' + weekDay); } t.end(); }); test('DaysInYear', function (t) { t.equal(ES.DaysInYear(2021), 365, '2021 is not a leap year'); t.equal(ES.DaysInYear(2020), 366, '2020 is a leap year'); t.equal(ES.DaysInYear(2019), 365, '2019 is not a leap year'); t.equal(ES.DaysInYear(2018), 365, '2018 is not a leap year'); t.equal(ES.DaysInYear(2017), 365, '2017 is not a leap year'); t.equal(ES.DaysInYear(2016), 366, '2016 is a leap year'); t.equal(ES.DaysInYear(2000), 366, '2000 is a leap year'); t.equal(ES.DaysInYear(1900), 365, '1900 is not a leap year'); t.end(); }); test('InLeapYear', function (t) { t.equal(ES.InLeapYear(Date.UTC(2021, 0, 1)), 0, '2021 is not a leap year'); t.equal(ES.InLeapYear(Date.UTC(2020, 0, 1)), 1, '2020 is a leap year'); t.equal(ES.InLeapYear(Date.UTC(2019, 0, 1)), 0, '2019 is not a leap year'); t.equal(ES.InLeapYear(Date.UTC(2018, 0, 1)), 0, '2018 is not a leap year'); t.equal(ES.InLeapYear(Date.UTC(2017, 0, 1)), 0, '2017 is not a leap year'); t.equal(ES.InLeapYear(Date.UTC(2016, 0, 1)), 1, '2016 is a leap year'); t.end(); }); test('DayWithinYear', function (t) { t.equal(ES.DayWithinYear(Date.UTC(2019, 0, 1)), 0, '1/1 is the 1st day'); t.equal(ES.DayWithinYear(Date.UTC(2019, 11, 31)), 364, '12/31 is the 365th day in a non leap year'); t.equal(ES.DayWithinYear(Date.UTC(2016, 11, 31)), 365, '12/31 is the 366th day in a leap year'); t.end(); }); test('MonthFromTime', function (t) { t.equal(ES.MonthFromTime(Date.UTC(2019, 0, 1)), 0, 'non-leap: 1/1 gives January'); t.equal(ES.MonthFromTime(Date.UTC(2019, 0, 31)), 0, 'non-leap: 1/31 gives January'); t.equal(ES.MonthFromTime(Date.UTC(2019, 1, 1)), 1, 'non-leap: 2/1 gives February'); t.equal(ES.MonthFromTime(Date.UTC(2019, 1, 28)), 1, 'non-leap: 2/28 gives February'); t.equal(ES.MonthFromTime(Date.UTC(2019, 1, 29)), 2, 'non-leap: 2/29 gives March'); t.equal(ES.MonthFromTime(Date.UTC(2019, 2, 1)), 2, 'non-leap: 3/1 gives March'); t.equal(ES.MonthFromTime(Date.UTC(2019, 2, 31)), 2, 'non-leap: 3/31 gives March'); t.equal(ES.MonthFromTime(Date.UTC(2019, 3, 1)), 3, 'non-leap: 4/1 gives April'); t.equal(ES.MonthFromTime(Date.UTC(2019, 3, 30)), 3, 'non-leap: 4/30 gives April'); t.equal(ES.MonthFromTime(Date.UTC(2019, 4, 1)), 4, 'non-leap: 5/1 gives May'); t.equal(ES.MonthFromTime(Date.UTC(2019, 4, 31)), 4, 'non-leap: 5/31 gives May'); t.equal(ES.MonthFromTime(Date.UTC(2019, 5, 1)), 5, 'non-leap: 6/1 gives June'); t.equal(ES.MonthFromTime(Date.UTC(2019, 5, 30)), 5, 'non-leap: 6/30 gives June'); t.equal(ES.MonthFromTime(Date.UTC(2019, 6, 1)), 6, 'non-leap: 7/1 gives July'); t.equal(ES.MonthFromTime(Date.UTC(2019, 6, 31)), 6, 'non-leap: 7/31 gives July'); t.equal(ES.MonthFromTime(Date.UTC(2019, 7, 1)), 7, 'non-leap: 8/1 gives August'); t.equal(ES.MonthFromTime(Date.UTC(2019, 7, 30)), 7, 'non-leap: 8/30 gives August'); t.equal(ES.MonthFromTime(Date.UTC(2019, 8, 1)), 8, 'non-leap: 9/1 gives September'); t.equal(ES.MonthFromTime(Date.UTC(2019, 8, 30)), 8, 'non-leap: 9/30 gives September'); t.equal(ES.MonthFromTime(Date.UTC(2019, 9, 1)), 9, 'non-leap: 10/1 gives October'); t.equal(ES.MonthFromTime(Date.UTC(2019, 9, 31)), 9, 'non-leap: 10/31 gives October'); t.equal(ES.MonthFromTime(Date.UTC(2019, 10, 1)), 10, 'non-leap: 11/1 gives November'); t.equal(ES.MonthFromTime(Date.UTC(2019, 10, 30)), 10, 'non-leap: 11/30 gives November'); t.equal(ES.MonthFromTime(Date.UTC(2019, 11, 1)), 11, 'non-leap: 12/1 gives December'); t.equal(ES.MonthFromTime(Date.UTC(2019, 11, 31)), 11, 'non-leap: 12/31 gives December'); t.equal(ES.MonthFromTime(Date.UTC(2016, 0, 1)), 0, 'leap: 1/1 gives January'); t.equal(ES.MonthFromTime(Date.UTC(2016, 0, 31)), 0, 'leap: 1/31 gives January'); t.equal(ES.MonthFromTime(Date.UTC(2016, 1, 1)), 1, 'leap: 2/1 gives February'); t.equal(ES.MonthFromTime(Date.UTC(2016, 1, 28)), 1, 'leap: 2/28 gives February'); t.equal(ES.MonthFromTime(Date.UTC(2016, 1, 29)), 1, 'leap: 2/29 gives February'); t.equal(ES.MonthFromTime(Date.UTC(2016, 2, 1)), 2, 'leap: 3/1 gives March'); t.equal(ES.MonthFromTime(Date.UTC(2016, 2, 31)), 2, 'leap: 3/31 gives March'); t.equal(ES.MonthFromTime(Date.UTC(2016, 3, 1)), 3, 'leap: 4/1 gives April'); t.equal(ES.MonthFromTime(Date.UTC(2016, 3, 30)), 3, 'leap: 4/30 gives April'); t.equal(ES.MonthFromTime(Date.UTC(2016, 4, 1)), 4, 'leap: 5/1 gives May'); t.equal(ES.MonthFromTime(Date.UTC(2016, 4, 31)), 4, 'leap: 5/31 gives May'); t.equal(ES.MonthFromTime(Date.UTC(2016, 5, 1)), 5, 'leap: 6/1 gives June'); t.equal(ES.MonthFromTime(Date.UTC(2016, 5, 30)), 5, 'leap: 6/30 gives June'); t.equal(ES.MonthFromTime(Date.UTC(2016, 6, 1)), 6, 'leap: 7/1 gives July'); t.equal(ES.MonthFromTime(Date.UTC(2016, 6, 31)), 6, 'leap: 7/31 gives July'); t.equal(ES.MonthFromTime(Date.UTC(2016, 7, 1)), 7, 'leap: 8/1 gives August'); t.equal(ES.MonthFromTime(Date.UTC(2016, 7, 30)), 7, 'leap: 8/30 gives August'); t.equal(ES.MonthFromTime(Date.UTC(2016, 8, 1)), 8, 'leap: 9/1 gives September'); t.equal(ES.MonthFromTime(Date.UTC(2016, 8, 30)), 8, 'leap: 9/30 gives September'); t.equal(ES.MonthFromTime(Date.UTC(2016, 9, 1)), 9, 'leap: 10/1 gives October'); t.equal(ES.MonthFromTime(Date.UTC(2016, 9, 31)), 9, 'leap: 10/31 gives October'); t.equal(ES.MonthFromTime(Date.UTC(2016, 10, 1)), 10, 'leap: 11/1 gives November'); t.equal(ES.MonthFromTime(Date.UTC(2016, 10, 30)), 10, 'leap: 11/30 gives November'); t.equal(ES.MonthFromTime(Date.UTC(2016, 11, 1)), 11, 'leap: 12/1 gives December'); t.equal(ES.MonthFromTime(Date.UTC(2016, 11, 31)), 11, 'leap: 12/31 gives December'); t.end(); }); test('DateFromTime', function (t) { var i; for (i = 1; i <= 28; i += 1) { t.equal(ES.DateFromTime(Date.UTC(2019, 1, i)), i, '2019.02.' + i + ' is date ' + i); } for (i = 1; i <= 29; i += 1) { t.equal(ES.DateFromTime(Date.UTC(2016, 1, i)), i, '2016.02.' + i + ' is date ' + i); } for (i = 1; i <= 30; i += 1) { t.equal(ES.DateFromTime(Date.UTC(2019, 2, i)), i, '2019.03.' + i + ' is date ' + i); t.equal(ES.DateFromTime(Date.UTC(2019, 3, i)), i, '2019.04.' + i + ' is date ' + i); t.equal(ES.DateFromTime(Date.UTC(2019, 5, i)), i, '2019.06.' + i + ' is date ' + i); t.equal(ES.DateFromTime(Date.UTC(2019, 7, i)), i, '2019.08.' + i + ' is date ' + i); t.equal(ES.DateFromTime(Date.UTC(2019, 8, i)), i, '2019.09.' + i + ' is date ' + i); t.equal(ES.DateFromTime(Date.UTC(2019, 10, i)), i, '2019.11.' + i + ' is date ' + i); } for (i = 1; i <= 31; i += 1) { t.equal(ES.DateFromTime(Date.UTC(2019, 0, i)), i, '2019.01.' + i + ' is date ' + i); t.equal(ES.DateFromTime(Date.UTC(2019, 4, i)), i, '2019.05.' + i + ' is date ' + i); t.equal(ES.DateFromTime(Date.UTC(2019, 6, i)), i, '2019.07.' + i + ' is date ' + i); t.equal(ES.DateFromTime(Date.UTC(2019, 9, i)), i, '2019.10.' + i + ' is date ' + i); t.equal(ES.DateFromTime(Date.UTC(2019, 11, i)), i, '2019.12.' + i + ' is date ' + i); } t.end(); }); test('MakeDay', function (t) { forEach([NaN, Infinity, -Infinity], function (nonFiniteNumber) { t.equal(ES.MakeDay(nonFiniteNumber, 0, 0), NaN, 'year: ' + debug(nonFiniteNumber) + ' is not finite'); t.equal(ES.MakeDay(0, nonFiniteNumber, 0), NaN, 'month: ' + debug(nonFiniteNumber) + ' is not finite'); t.equal(ES.MakeDay(0, 0, nonFiniteNumber), NaN, 'date: ' + debug(nonFiniteNumber) + ' is not finite'); }); var day2015 = 16687; t.equal(ES.MakeDay(2015, 8, 9), day2015, '2015.09.09 is day 16687'); var day2016 = day2015 + 366; // 2016 is a leap year t.equal(ES.MakeDay(2016, 8, 9), day2016, '2015.09.09 is day 17053'); var day2017 = day2016 + 365; t.equal(ES.MakeDay(2017, 8, 9), day2017, '2017.09.09 is day 17418'); var day2018 = day2017 + 365; t.equal(ES.MakeDay(2018, 8, 9), day2018, '2018.09.09 is day 17783'); var day2019 = day2018 + 365; t.equal(ES.MakeDay(2019, 8, 9), day2019, '2019.09.09 is day 18148'); t.end(); }); test('MakeDate', function (t) { forEach(v.infinities.concat(NaN), function (nonFiniteNumber) { t.equal(ES.MakeDate(nonFiniteNumber, 0), NaN, debug(nonFiniteNumber) + ' is not a finite `day`'); t.equal(ES.MakeDate(0, nonFiniteNumber), NaN, debug(nonFiniteNumber) + ' is not a finite `time`'); }); t.equal(ES.MakeDate(0, 0), 0, 'zero day and zero time is zero date'); t.equal(ES.MakeDate(0, 123), 123, 'zero day and nonzero time is a date of the "time"'); t.equal(ES.MakeDate(1, 0), msPerDay, 'day of 1 and zero time is a date of "ms per day"'); t.equal(ES.MakeDate(3, 0), 3 * msPerDay, 'day of 3 and zero time is a date of thrice "ms per day"'); t.equal(ES.MakeDate(1, 123), msPerDay + 123, 'day of 1 and nonzero time is a date of "ms per day" plus the "time"'); t.equal(ES.MakeDate(3, 123), (3 * msPerDay) + 123, 'day of 3 and nonzero time is a date of thrice "ms per day" plus the "time"'); t.end(); }); test('MakeTime', function (t) { forEach(v.infinities.concat(NaN), function (nonFiniteNumber) { t.equal(ES.MakeTime(nonFiniteNumber, 0, 0, 0), NaN, debug(nonFiniteNumber) + ' is not a finite `hour`'); t.equal(ES.MakeTime(0, nonFiniteNumber, 0, 0), NaN, debug(nonFiniteNumber) + ' is not a finite `min`'); t.equal(ES.MakeTime(0, 0, nonFiniteNumber, 0), NaN, debug(nonFiniteNumber) + ' is not a finite `sec`'); t.equal(ES.MakeTime(0, 0, 0, nonFiniteNumber), NaN, debug(nonFiniteNumber) + ' is not a finite `ms`'); }); t.equal( ES.MakeTime(1.2, 2.3, 3.4, 4.5), (1 * msPerHour) + (2 * msPerMinute) + (3 * msPerSecond) + 4, 'all numbers are converted to integer, multiplied by the right number of ms, and summed' ); t.end(); }); test('TimeClip', function (t) { forEach(v.infinities.concat(NaN), function (nonFiniteNumber) { t.equal(ES.TimeClip(nonFiniteNumber), NaN, debug(nonFiniteNumber) + ' is not a finite `time`'); }); t.equal(ES.TimeClip(8.64e15 + 1), NaN, '8.64e15 is the largest magnitude considered "finite"'); t.equal(ES.TimeClip(-8.64e15 - 1), NaN, '-8.64e15 is the largest magnitude considered "finite"'); forEach(v.zeroes.concat([-10, 10, +new Date()]), function (time) { t.looseEqual(ES.TimeClip(time), time, debug(time) + ' is a time of ' + debug(time)); }); t.end(); }); test('modulo', function (t) { t.equal(3 % 2, 1, '+3 % 2 is +1'); t.equal(ES.modulo(3, 2), 1, '+3 mod 2 is +1'); t.equal(-3 % 2, -1, '-3 % 2 is -1'); t.equal(ES.modulo(-3, 2), 1, '-3 mod 2 is +1'); t.end(); }); }; var es2015 = function ES2015(ES, ops, expectedMissing, skips) { es5(ES, ops, expectedMissing, assign(assign({}, skips), { CheckObjectCoercible: true, FromPropertyDescriptor: true, ToNumber: true, ToString: true, Type: true })); var test = makeTest(ES, skips); var getNamelessFunction = function () { var f = Object(function () {}); try { delete f.name; } catch (e) { /**/ } return f; }; test('AdvanceStringIndex', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.AdvanceStringIndex(nonString); }, TypeError, '"S" argument must be a String; ' + debug(nonString) + ' is not' ); }); var notInts = v.nonNumbers.concat( v.nonIntegerNumbers, v.infinities, [NaN, [], new Date(), Math.pow(2, 53), -1] ); forEach(notInts, function (nonInt) { t['throws']( function () { ES.AdvanceStringIndex('abc', nonInt); }, TypeError, '"index" argument must be an integer, ' + debug(nonInt) + ' is not.' ); }); forEach(v.nonBooleans, function (nonBoolean) { t['throws']( function () { ES.AdvanceStringIndex('abc', 0, nonBoolean); }, TypeError, debug(nonBoolean) + ' is not a Boolean' ); }); var str = 'a' + wholePoo + 'c'; t.test('non-unicode mode', function (st) { for (var i = 0; i < str.length + 2; i += 1) { st.equal(ES.AdvanceStringIndex(str, i, false), i + 1, i + ' advances to ' + (i + 1)); } st.end(); }); t.test('unicode mode', function (st) { st.equal(ES.AdvanceStringIndex(str, 0, true), 1, '0 advances to 1'); st.equal(ES.AdvanceStringIndex(str, 1, true), 3, '1 advances to 3'); st.equal(ES.AdvanceStringIndex(str, 2, true), 3, '2 advances to 3'); st.equal(ES.AdvanceStringIndex(str, 3, true), 4, '3 advances to 4'); st.equal(ES.AdvanceStringIndex(str, 4, true), 5, '4 advances to 5'); st.end(); }); t.test('lone surrogates', function (st) { var halfPoo = 'a' + leadingPoo + 'c'; st.equal(ES.AdvanceStringIndex(halfPoo, 0, true), 1, '0 advances to 1'); st.equal(ES.AdvanceStringIndex(halfPoo, 1, true), 2, '1 advances to 2'); st.equal(ES.AdvanceStringIndex(halfPoo, 2, true), 3, '2 advances to 3'); st.equal(ES.AdvanceStringIndex(halfPoo, 3, true), 4, '3 advances to 4'); st.end(); }); t.test('surrogate pairs', function (st) { var lowestPair = String.fromCharCode('0xD800') + String.fromCharCode('0xDC00'); var highestPair = String.fromCharCode('0xDBFF') + String.fromCharCode('0xDFFF'); st.equal(ES.AdvanceStringIndex(lowestPair, 0, true), 2, 'lowest surrogate pair, 0 -> 2'); st.equal(ES.AdvanceStringIndex(highestPair, 0, true), 2, 'highest surrogate pair, 0 -> 2'); st.equal(ES.AdvanceStringIndex(wholePoo, 0, true), 2, 'poop, 0 -> 2'); st.end(); }); t.end(); }); test('ArrayCreate', function (t) { forEach(v.notNonNegativeIntegers, function (nonIntegerNumber) { t['throws']( function () { ES.ArrayCreate(nonIntegerNumber); }, TypeError, 'length must be an integer number >= 0' ); }); t['throws']( function () { ES.ArrayCreate(Math.pow(2, 32)); }, RangeError, 'length must be < 2**32' ); t.deepEqual(ES.ArrayCreate(-0), [], 'length of -0 creates an empty array'); t.deepEqual(ES.ArrayCreate(0), [], 'length of +0 creates an empty array'); // eslint-disable-next-line no-sparse-arrays, comma-spacing t.deepEqual(ES.ArrayCreate(1), [,], 'length of 1 creates a sparse array of length 1'); // eslint-disable-next-line no-sparse-arrays, comma-spacing t.deepEqual(ES.ArrayCreate(2), [,,], 'length of 2 creates a sparse array of length 2'); t.test('proto argument', { skip: !$setProto }, function (st) { var fakeProto = { push: { toString: function () { return 'not array push'; } } }; st.equal(ES.ArrayCreate(0, fakeProto).push, fakeProto.push, 'passing the proto argument works'); st.end(); }); t.end(); }); test('ArraySetLength', function (t) { forEach(v.primitives.concat(v.objects), function (nonArray) { t['throws']( function () { ES.ArraySetLength(nonArray, { '[[Value]]': 0 }); }, TypeError, 'A: ' + debug(nonArray) + ' is not an Array' ); }); forEach(v.nonUndefinedPrimitives, function (primitive) { t['throws']( function () { ES.ArraySetLength([], primitive); }, TypeError, 'Desc: ' + debug(primitive) + ' is not a Property Descriptor' ); }); t.test('making length nonwritable', { skip: !getOwnPropertyDescriptor }, function (st) { var a = [0]; st.equal( ES.ArraySetLength(a, { '[[Writable]]': false }), true, 'array is made non-writable' ); st.deepEqual( getOwnPropertyDescriptor(a, 'length'), { configurable: false, enumerable: false, value: 1, writable: false }, 'without a value, length becomes nonwritable' ); st.equal( ES.ArraySetLength(a, { '[[Value]]': 0 }), false, 'setting a lower value on a non-writable length fails' ); st.equal(a.length, 1, 'array still has a length of 1'); st.equal( ES.ArraySetLength(a, { '[[Value]]': 2 }), false, 'setting a higher value on a non-writable length fails' ); st.equal(a.length, 1, 'array still has a length of 1'); st.end(); }); forEach([-1, Math.pow(2, 32)].concat(v.nonIntegerNumbers), function (nonLength) { t['throws']( function () { ES.ArraySetLength([], { '[[Value]]': nonLength }); }, RangeError, 'a non-integer, negative, or > (2**31 - 1) is not a valid length: ' + debug(nonLength) ); }); var arr = []; t.equal( ES.ArraySetLength(arr, { '[[Value]]': 7 }), true, 'set length succeeded' ); t.equal(arr.length, 7, 'array now has a length of 0 -> 7'); t.equal( ES.ArraySetLength(arr, { '[[Value]]': 2 }), true, 'set length succeeded' ); t.equal(arr.length, 2, 'array now has a length of 7 -> 2'); t.end(); }); test('ArraySpeciesCreate', function (t) { t.test('errors', function (st) { var testNonNumber = function (nonNumber) { st['throws']( function () { ES.ArraySpeciesCreate([], nonNumber); }, TypeError, debug(nonNumber) + ' is not a number' ); }; forEach(v.nonNumbers, testNonNumber); st['throws']( function () { ES.ArraySpeciesCreate([], -1); }, TypeError, '-1 is not >= 0' ); st['throws']( function () { ES.ArraySpeciesCreate([], -Infinity); }, TypeError, '-Infinity is not >= 0' ); var testNonIntegers = function (nonInteger) { st['throws']( function () { ES.ArraySpeciesCreate([], nonInteger); }, TypeError, debug(nonInteger) + ' is not an integer' ); }; forEach(v.nonIntegerNumbers, testNonIntegers); st.end(); }); t.test('works with a non-array', function (st) { forEach(v.objects.concat(v.primitives), function (nonArray) { var arr = ES.ArraySpeciesCreate(nonArray, 0); st.ok(ES.IsArray(arr), 'is an array'); st.equal(arr.length, 0, 'length is correct'); st.equal(arr.constructor, Array, 'constructor is correct'); }); st.end(); }); t.test('works with a normal array', function (st) { var len = 2; var orig = [1, 2, 3]; var arr = ES.ArraySpeciesCreate(orig, len); st.ok(ES.IsArray(arr), 'is an array'); st.equal(arr.length, len, 'length is correct'); st.equal(arr.constructor, orig.constructor, 'constructor is correct'); st.end(); }); t.test('-0 length produces +0 length', function (st) { var len = -0; st.equal(len, -0, '-0 is negative zero'); st.notEqual(len, 0, '-0 is not positive zero'); var orig = [1, 2, 3]; var arr = ES.ArraySpeciesCreate(orig, len); st.equal(ES.IsArray(arr), true); st.equal(arr.length, 0); st.equal(arr.constructor, orig.constructor); st.end(); }); t.test('works with species construtor', { skip: !hasSpecies }, function (st) { var sentinel = {}; var Foo = function Foo(len) { this.length = len; this.sentinel = sentinel; }; var Bar = getArraySubclassWithSpeciesConstructor(Foo); var bar = new Bar(); st.equal(ES.IsArray(bar), true, 'Bar instance is an array'); var arr = ES.ArraySpeciesCreate(bar, 3); st.equal(arr.constructor, Foo, 'result used species constructor'); st.equal(arr.length, 3, 'length property is correct'); st.equal(arr.sentinel, sentinel, 'Foo constructor was exercised'); st.end(); }); t.test('works with null species constructor', { skip: !hasSpecies }, function (st) { var Bar = getArraySubclassWithSpeciesConstructor(null); var bar = new Bar(); st.equal(ES.IsArray(bar), true, 'Bar instance is an array'); var arr = ES.ArraySpeciesCreate(bar, 3); st.equal(arr.constructor, Array, 'result used default constructor'); st.equal(arr.length, 3, 'length property is correct'); st.end(); }); t.test('works with undefined species constructor', { skip: !hasSpecies }, function (st) { var Bar = getArraySubclassWithSpeciesConstructor(); var bar = new Bar(); st.equal(ES.IsArray(bar), true, 'Bar instance is an array'); var arr = ES.ArraySpeciesCreate(bar, 3); st.equal(arr.constructor, Array, 'result used default constructor'); st.equal(arr.length, 3, 'length property is correct'); st.end(); }); t.test('throws with object non-construtor species constructor', { skip: !hasSpecies }, function (st) { forEach(v.objects, function (obj) { var Bar = getArraySubclassWithSpeciesConstructor(obj); var bar = new Bar(); st.equal(ES.IsArray(bar), true, 'Bar instance is an array'); st['throws']( function () { ES.ArraySpeciesCreate(bar, 3); }, TypeError, debug(obj) + ' is not a constructor' ); }); st.end(); }); t.end(); }); test('Call', function (t) { var receiver = {}; var notFuncs = v.nonFunctions.concat([/a/g, new RegExp('a', 'g')]); t.plan(notFuncs.length + v.nonArrays.length + 5); forEach(notFuncs, function (notFunc) { t['throws']( function () { return ES.Call(notFunc, receiver); }, TypeError, debug(notFunc) + ' (' + typeof notFunc + ') is not callable' ); }); forEach(v.nonArrays, function (nonArray) { t['throws']( function () { ES.Call(Function.prototype, null, nonArray); }, TypeError, debug(nonArray) + ' is not an array' ); }); ES.Call( function (a, b) { t.equal(this, receiver, 'context matches expected'); t.deepEqual([a, b], [1, 2], 'named args are correct'); t.equal(arguments.length, 3, 'extra argument was passed'); t.equal(arguments[2], 3, 'extra argument was correct'); }, receiver, [1, 2, 3] ); t.test('Call doesn’t use func.apply', function (st) { st.plan(4); var bad = function (a, b) { st.equal(this, receiver, 'context matches expected'); st.deepEqual([a, b], [1, 2], 'named args are correct'); st.equal(arguments.length, 3, 'extra argument was passed'); st.equal(arguments[2], 3, 'extra argument was correct'); }; defineProperty(bad, 'apply', { enumerable: true, configurable: true, value: function () { st.fail('bad.apply shouldn’t get called'); }, writable: true }); ES.Call(bad, receiver, [1, 2, 3]); st.end(); }); t.end(); }); test('CanonicalNumericIndexString', function (t) { var throwsOnNonString = function (notString) { t['throws']( function () { return ES.CanonicalNumericIndexString(notString); }, TypeError, debug(notString) + ' is not a string' ); }; forEach(v.nonStrings, throwsOnNonString); t.equal(ES.CanonicalNumericIndexString('-0'), -0, '"-0" returns -0'); for (var i = -50; i < 50; i += 10) { t.equal(i, ES.CanonicalNumericIndexString(String(i)), '"' + i + '" returns ' + i); t.equal(undefined, ES.CanonicalNumericIndexString(String(i) + 'a'), '"' + i + 'a" returns undefined'); } t.end(); }); test('CompletePropertyDescriptor', function (t) { forEach(v.nonUndefinedPrimitives, function (primitive) { t['throws']( function () { ES.CompletePropertyDescriptor(primitive); }, TypeError, debug(primitive) + ' is not a Property Descriptor' ); }); var generic = v.genericDescriptor(); t.deepEqual( ES.CompletePropertyDescriptor(generic), { '[[Configurable]]': !!generic['[[Configurable]]'], '[[Enumerable]]': !!generic['[[Enumerable]]'], '[[Value]]': undefined, '[[Writable]]': false }, 'completes a Generic Descriptor' ); var data = v.dataDescriptor(); t.deepEqual( ES.CompletePropertyDescriptor(data), { '[[Configurable]]': !!data['[[Configurable]]'], '[[Enumerable]]': false, '[[Value]]': data['[[Value]]'], '[[Writable]]': !!data['[[Writable]]'] }, 'completes a Data Descriptor' ); var accessor = v.accessorDescriptor(); t.deepEqual( ES.CompletePropertyDescriptor(accessor), { '[[Get]]': accessor['[[Get]]'], '[[Enumerable]]': !!accessor['[[Enumerable]]'], '[[Configurable]]': !!accessor['[[Configurable]]'], '[[Set]]': undefined }, 'completes an Accessor Descriptor' ); var mutator = v.mutatorDescriptor(); t.deepEqual( ES.CompletePropertyDescriptor(mutator), { '[[Set]]': mutator['[[Set]]'], '[[Enumerable]]': !!mutator['[[Enumerable]]'], '[[Configurable]]': !!mutator['[[Configurable]]'], '[[Get]]': undefined }, 'completes a mutator Descriptor' ); t['throws']( function () { ES.CompletePropertyDescriptor(v.bothDescriptor()); }, TypeError, 'data and accessor descriptors are mutually exclusive' ); t.end(); }); test('CharacterRange', function (t) { forEach(['', 'abc', [], ['a', 'b', 'c']], function (notOne) { t['throws']( function () { ES.CharacterRange(notOne, 'a'); }, TypeError, debug(notOne) + ' as first arg does not have 1 item' ); t['throws']( function () { ES.CharacterRange('a', notOne); }, TypeError, debug(notOne) + ' as second arg does not have 1 item' ); t['throws']( function () { ES.CharacterRange(notOne, notOne); }, TypeError, debug(notOne) + ' as both args do not have 1 item' ); }); t.deepEqual( ES.CharacterRange('a', 'b'), ['a', 'b'] ); t.deepEqual( ES.CharacterRange('Z', 'a'), ['Z', '[', '\\', ']', '^', '_', '`', 'a'] ); t.end(); }); test('CreateDataProperty', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.CreateDataProperty(primitive); }, TypeError, debug(primitive) + ' is not an object' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.CreateDataProperty({}, nonPropertyKey); }, TypeError, debug(nonPropertyKey) + ' is not a property key' ); }); var sentinel = { id: 'sentinel' }; var secondSentinel = { id: 'second sentinel' }; forEach(v.propertyKeys, function (propertyKey) { var obj = {}; var status = ES.CreateDataProperty(obj, propertyKey, sentinel); t.equal(status, true, 'status is true'); t.equal( obj[propertyKey], sentinel, debug(sentinel) + ' is installed on "' + debug(propertyKey) + '" on the object' ); var secondStatus = ES.CreateDataProperty(obj, propertyKey, secondSentinel); t.equal(secondStatus, true, 'second status is true'); t.equal( obj[propertyKey], secondSentinel, debug(secondSentinel) + ' is installed on "' + debug(propertyKey) + '" on the object' ); t.test('with defineProperty', { skip: !defineProperty.oDP }, function (st) { var nonWritable = defineProperty({}, propertyKey, { configurable: true, writable: false }); var nonWritableStatus = ES.CreateDataProperty(nonWritable, propertyKey, sentinel); st.equal(nonWritableStatus, true, 'create data property succeeded'); st.equal( nonWritable[propertyKey], sentinel, debug(sentinel) + ' is installed on "' + debug(propertyKey) + '" on the object when key is configurable but nonwritable' ); var nonConfigurable = defineProperty({}, propertyKey, { configurable: false, writable: true }); var nonConfigurableStatus = ES.CreateDataProperty(nonConfigurable, propertyKey, sentinel); st.equal(nonConfigurableStatus, false, 'create data property failed'); st.notEqual( nonConfigurable[propertyKey], sentinel, debug(sentinel) + ' is not installed on "' + debug(propertyKey) + '" on the object when key is nonconfigurable' ); st.end(); }); }); t.end(); }); test('CreateDataPropertyOrThrow', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.CreateDataPropertyOrThrow(primitive); }, TypeError, debug(primitive) + ' is not an object' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.CreateDataPropertyOrThrow({}, nonPropertyKey); }, TypeError, debug(nonPropertyKey) + ' is not a property key' ); }); var sentinel = {}; forEach(v.propertyKeys, function (propertyKey) { var obj = {}; var status = ES.CreateDataPropertyOrThrow(obj, propertyKey, sentinel); t.equal(status, true, 'status is true'); t.equal( obj[propertyKey], sentinel, debug(sentinel) + ' is installed on "' + debug(propertyKey) + '" on the object' ); if (typeof Object.preventExtensions === 'function') { var notExtensible = {}; Object.preventExtensions(notExtensible); t['throws']( function () { ES.CreateDataPropertyOrThrow(notExtensible, propertyKey, sentinel); }, TypeError, 'can not install ' + debug(propertyKey) + ' on non-extensible object' ); t.notEqual( notExtensible[propertyKey], sentinel, debug(sentinel) + ' is not installed on "' + debug(propertyKey) + '" on the object' ); } }); t.end(); }); test('CreateListFromArrayLike', function (t) { forEach(v.primitives, function (nonObject) { t['throws']( function () { ES.CreateListFromArrayLike(nonObject); }, TypeError, debug(nonObject) + ' is not an Object' ); }); forEach(v.nonArrays, function (nonArray) { t['throws']( function () { ES.CreateListFromArrayLike({}, nonArray); }, TypeError, debug(nonArray) + ' is not an Array' ); }); t.deepEqual( ES.CreateListFromArrayLike({ length: 2, 0: 'a', 1: 'b', 2: 'c' }), ['a', 'b'], 'arraylike stops at the length' ); t.end(); }); test('CreateHTML', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.CreateHTML('', nonString, '', ''); }, TypeError, 'tag: ' + debug(nonString) + ' is not a String' ); t['throws']( function () { ES.CreateHTML('', '', nonString, ''); }, TypeError, 'attribute: ' + debug(nonString) + ' is not a String' ); }); t.equal( ES.CreateHTML( { toString: function () { return 'the string'; } }, 'some HTML tag!', '' ), 'the string', 'works with an empty string attribute value' ); t.equal( ES.CreateHTML( { toString: function () { return 'the string'; } }, 'some HTML tag!', 'attr', 'value "with quotes"' ), 'the string', 'works with an attribute, and a value with quotes' ); t.end(); }); test('CreateMethodProperty', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.CreateMethodProperty(primitive, 'key'); }, TypeError, 'O must be an Object; ' + debug(primitive) + ' is not one' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.CreateMethodProperty({}, nonPropertyKey); }, TypeError, debug(nonPropertyKey) + ' is not a Property Key' ); }); t.test('defines correctly', function (st) { var obj = {}; var key = 'the key'; var value = { foo: 'bar' }; st.equal(ES.CreateMethodProperty(obj, key, value), true, 'defines property successfully'); st.test('property descriptor', { skip: !getOwnPropertyDescriptor }, function (s2t) { s2t.deepEqual( getOwnPropertyDescriptor(obj, key), { configurable: true, enumerable: false, value: value, writable: true }, 'sets the correct property descriptor' ); s2t.end(); }); st.equal(obj[key], value, 'sets the correct value'); st.end(); }); t.test('fails as expected on a frozen object', { skip: !Object.freeze }, function (st) { var obj = Object.freeze({ foo: 'bar' }); st['throws']( function () { ES.CreateMethodProperty(obj, 'foo', { value: 'baz' }); }, TypeError, 'nonconfigurable key can not be defined' ); st.end(); }); t.test('fails as expected on a function with a nonconfigurable name', { skip: !functionsHaveNames || functionsHaveConfigurableNames }, function (st) { st['throws']( function () { ES.CreateMethodProperty(function () {}, 'name', { value: 'baz' }); }, TypeError, 'nonconfigurable function name can not be defined' ); st.end(); }); t.end(); }); test('CreateIterResultObject', function (t) { forEach(v.nonBooleans, function (nonBoolean) { t['throws']( function () { ES.CreateIterResultObject({}, nonBoolean); }, TypeError, '"done" argument must be a boolean; ' + debug(nonBoolean) + ' is not' ); }); var value = {}; t.deepEqual( ES.CreateIterResultObject(value, true), { value: value, done: true }, 'creates a "done" iteration result' ); t.deepEqual( ES.CreateIterResultObject(value, false), { value: value, done: false }, 'creates a "not done" iteration result' ); t.end(); }); test('DefinePropertyOrThrow', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.DefinePropertyOrThrow(primitive, 'key', {}); }, TypeError, 'O must be an Object' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.DefinePropertyOrThrow({}, nonPropertyKey, {}); }, TypeError, debug(nonPropertyKey) + ' is not a Property Key' ); }); t.test('defines correctly', function (st) { var obj = {}; var key = 'the key'; var descriptor = { configurable: true, enumerable: false, value: { foo: 'bar' }, writable: true }; st.equal(ES.DefinePropertyOrThrow(obj, key, descriptor), true, 'defines property successfully'); st.test('property descriptor', { skip: !getOwnPropertyDescriptor }, function (s2t) { s2t.deepEqual( getOwnPropertyDescriptor(obj, key), descriptor, 'sets the correct property descriptor' ); s2t.end(); }); st.deepEqual(obj[key], descriptor.value, 'sets the correct value'); st.end(); }); t.test('fails as expected on a frozen object', { skip: !Object.freeze }, function (st) { var obj = Object.freeze({ foo: 'bar' }); st['throws']( function () { ES.DefinePropertyOrThrow(obj, 'foo', { configurable: true, value: 'baz' }); }, TypeError, 'nonconfigurable key can not be defined' ); st.end(); }); t.test('fails as expected on a function with a nonconfigurable name', { skip: !functionsHaveNames || functionsHaveConfigurableNames }, function (st) { st['throws']( function () { ES.DefinePropertyOrThrow(function () {}, 'name', { configurable: true, value: 'baz' }); }, TypeError, 'nonconfigurable function name can not be defined' ); st.end(); }); t.end(); }); test('DeletePropertyOrThrow', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.DeletePropertyOrThrow(primitive, 'key', {}); }, TypeError, 'O must be an Object' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.DeletePropertyOrThrow({}, nonPropertyKey, {}); }, TypeError, debug(nonPropertyKey) + ' is not a Property Key' ); }); t.test('defines correctly', function (st) { var obj = { 'the key': 42 }; var key = 'the key'; st.equal(ES.DeletePropertyOrThrow(obj, key), true, 'deletes property successfully'); st.equal(key in obj, false, 'key is no longer in the object'); st.end(); }); t.test('fails as expected on a frozen object', { skip: !Object.freeze }, function (st) { var obj = Object.freeze({ foo: 'bar' }); st['throws']( function () { ES.DeletePropertyOrThrow(obj, 'foo'); }, TypeError, 'nonconfigurable key can not be deleted' ); st.end(); }); t.test('fails as expected on a function with a nonconfigurable name', { skip: !functionsHaveNames || functionsHaveConfigurableNames }, function (st) { st['throws']( function () { ES.DeletePropertyOrThrow(function () {}, 'name'); }, TypeError, 'nonconfigurable function name can not be deleted' ); st.end(); }); t.end(); }); test('EnumerableOwnNames', function (t) { var obj = testEnumerableOwnNames(t, function (O) { return ES.EnumerableOwnNames(O); }); t.deepEqual( ES.EnumerableOwnNames(obj), ['own'], 'returns enumerable own names' ); t.end(); }); test('FromPropertyDescriptor', function (t) { t.equal(ES.FromPropertyDescriptor(), undefined, 'no value begets undefined'); t.equal(ES.FromPropertyDescriptor(undefined), undefined, 'undefined value begets undefined'); forEach(v.nonUndefinedPrimitives, function (primitive) { t['throws']( function () { ES.FromPropertyDescriptor(primitive); }, TypeError, debug(primitive) + ' is not a Property Descriptor' ); }); var accessor = v.accessorDescriptor(); t.deepEqual(ES.FromPropertyDescriptor(accessor), { get: accessor['[[Get]]'], enumerable: !!accessor['[[Enumerable]]'], configurable: !!accessor['[[Configurable]]'] }); var mutator = v.mutatorDescriptor(); t.deepEqual(ES.FromPropertyDescriptor(mutator), { set: mutator['[[Set]]'], enumerable: !!mutator['[[Enumerable]]'], configurable: !!mutator['[[Configurable]]'] }); var data = v.dataDescriptor(); t.deepEqual(ES.FromPropertyDescriptor(data), { value: data['[[Value]]'], writable: data['[[Writable]]'] }); t.deepEqual(ES.FromPropertyDescriptor(v.genericDescriptor()), { enumerable: false, configurable: true }); var both = v.bothDescriptor(); t['throws']( function () { ES.FromPropertyDescriptor({ get: both['[[Get]]'], value: both['[[Value]]'] }); }, TypeError, 'data and accessor descriptors are mutually exclusive' ); t.end(); }); test('Get', function (t) { t['throws'](function () { return ES.Get('a', 'a'); }, TypeError, 'Throws a TypeError if `O` is not an Object'); t['throws'](function () { return ES.Get({ 7: 7 }, 7); }, TypeError, 'Throws a TypeError if `P` is not a property key'); var value = {}; t.test('Symbols', { skip: !v.hasSymbols }, function (st) { var sym = Symbol('sym'); var obj = {}; obj[sym] = value; st.equal(ES.Get(obj, sym), value, 'returns property `P` if it exists on object `O`'); st.end(); }); t.equal(ES.Get({ a: value }, 'a'), value, 'returns property `P` if it exists on object `O`'); t.end(); }); test('GetIterator', function (t) { var arr = [1, 2]; testIterator(t, ES.GetIterator(arr), arr); testIterator(t, ES.GetIterator('abc'), 'abc'.split('')); var sentinel = {}; forEach(v.primitives, function (nonObject) { var method = function () { return nonObject; }; t['throws']( function () { ES.GetIterator(sentinel, method); }, TypeError, debug(nonObject) + ' is not an Object; iterator method must return an Object' ); }); var i = 0; var manualMethod = function () { t.equal(this, sentinel, 'receiver is expected object'); return { next: function () { var value = arr[i]; i += 1; return { done: i > arr.length, value: value }; } }; }; testIterator(t, ES.GetIterator(sentinel, manualMethod), arr); t.test('Symbol.iterator', { skip: !v.hasSymbols }, function (st) { var m = new Map(); m.set(1, 'a'); m.set(2, 'b'); testIterator(st, ES.GetIterator(m), [[1, 'a'], [2, 'b']]); forEach(v.primitives, function (nonObject) { var badIterable = {}; badIterable[Symbol.iterator] = function () { return nonObject; }; st['throws']( function () { return ES.GetIterator(badIterable); }, TypeError, debug(nonObject) + ' is not an Object; iterator method must return an Object' ); }); st.end(); }); t.end(); }); test('GetMethod', function (t) { t['throws'](function () { return ES.GetMethod({ 7: 7 }, 7); }, TypeError, 'Throws a TypeError if `P` is not a property key'); t.equal(ES.GetMethod({}, 'a'), undefined, 'returns undefined in property is undefined'); t.equal(ES.GetMethod({ a: null }, 'a'), undefined, 'returns undefined if property is null'); t.equal(ES.GetMethod({ a: undefined }, 'a'), undefined, 'returns undefined if property is undefined'); var obj = { a: function () {} }; t['throws'](function () { ES.GetMethod({ a: 'b' }, 'a'); }, TypeError, 'throws TypeError if property exists and is not callable'); t.equal(ES.GetMethod(obj, 'a'), obj.a, 'returns property if it is callable'); t.end(); }); test('GetOwnPropertyKeys', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.GetOwnPropertyKeys(primitive, 'String'); }, TypeError, 'O: ' + debug(primitive) + ' is not an Object' ); }); t['throws']( function () { ES.GetOwnPropertyKeys({}, 'not string or symbol'); }, TypeError, 'Type: must be "String" or "Symbol"' ); t.test('Symbols', { skip: !v.hasSymbols }, function (st) { var O = { a: 1 }; O[Symbol.iterator] = true; var s = Symbol('test'); defineProperty(O, s, { enumerable: false, value: true }); st.deepEqual( ES.GetOwnPropertyKeys(O, 'Symbol'), [Symbol.iterator, s], 'works with Symbols, enumerable or not' ); st.end(); }); t.test('non-enumerable names', { skip: !defineProperty.oDP }, function (st) { var O = { a: 1 }; defineProperty(O, 'b', { enumerable: false, value: 2 }); if (v.hasSymbols) { O[Symbol.iterator] = true; } st.deepEqual( ES.GetOwnPropertyKeys(O, 'String').sort(), ['a', 'b'].sort(), 'works with Strings, enumerable or not' ); st.end(); }); t.deepEqual( ES.GetOwnPropertyKeys({ a: 1, b: 2 }, 'String').sort(), ['a', 'b'].sort(), 'works with enumerable keys' ); t.end(); }); test('GetPrototypeFromConstructor', function (t) { forEach(v.nonFunctions, function (nonFunction) { t['throws']( function () { ES.GetPrototypeFromConstructor(nonFunction, '%Array%'); }, TypeError, debug(nonFunction) + ' is not a constructor' ); }); forEach(arrowFns, function (arrowFn) { t['throws']( function () { ES.GetPrototypeFromConstructor(arrowFn, '%Array%'); }, TypeError, debug(arrowFn) + ' is not a constructor' ); }); var f = function () {}; t.equal( ES.GetPrototypeFromConstructor(f, '%Array.prototype%'), f.prototype, 'function with normal `prototype` property returns it' ); forEach([true, 'foo', 42], function (truthyPrimitive) { f.prototype = truthyPrimitive; t.equal( ES.GetPrototypeFromConstructor(f, '%Array.prototype%'), Array.prototype, 'function with non-object `prototype` property (' + debug(truthyPrimitive) + ') returns default intrinsic' ); }); t.end(); }); test('GetSubstitution', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.GetSubstitution(nonString, '', 0, [], ''); }, TypeError, '`matched`: ' + debug(nonString) + ' is not a String' ); t['throws']( function () { ES.GetSubstitution('', nonString, 0, [], ''); }, TypeError, '`str`: ' + debug(nonString) + ' is not a String' ); t['throws']( function () { ES.GetSubstitution('', '', 0, [], nonString); }, TypeError, '`replacement`: ' + debug(nonString) + ' is not a String' ); if (canDistinguishSparseFromUndefined || typeof nonString !== 'undefined') { t['throws']( function () { ES.GetSubstitution('', '', 0, [nonString], ''); }, TypeError, '`captures`: ' + debug([nonString]) + ' is not an Array of strings' ); } }); forEach(v.notNonNegativeIntegers, function (nonNonNegativeInteger) { t['throws']( function () { ES.GetSubstitution('', '', nonNonNegativeInteger, [], ''); }, TypeError, '`position`: ' + debug(nonNonNegativeInteger) + ' is not a non-negative integer' ); }); forEach(v.nonArrays, function (nonArray) { t['throws']( function () { ES.GetSubstitution('', '', 0, nonArray, ''); }, TypeError, '`captures`: ' + debug(nonArray) + ' is not an Array' ); }); t.equal( ES.GetSubstitution('def', 'abcdefghi', 3, [], '123'), '123', 'returns the substitution' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '$$2$'), '$2$', 'supports $$, and trailing $' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$&<'), '>abcdef<', 'supports $&' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$`<'), '><', 'supports $` at position 0' ); t.equal( ES.GetSubstitution('def', 'abcdefghi', 3, [], '>$`<'), '>ab<', 'supports $` at position > 0' ); // https://github.com/tc39/ecma262/pull/2484#discussion_r684725247 t.equal( ES.GetSubstitution('1234567', 'abc', 0, [], ">$'<"), '><', 'match is longer than the input string' ); t.equal( ES.GetSubstitution('x', 'abc', 3, [], ">$'<"), '><', 'nonempty match at the end of the input string' ); t.equal( ES.GetSubstitution('def', 'abcdefghi', 7, [], ">$'<"), '><', "supports $' at a position where there's less than `matched.length` chars left" ); t.equal( ES.GetSubstitution('def', 'abcdefghi', 3, [], ">$'<"), '>ghi<', "supports $' at a position where there's more than `matched.length` chars left" ); for (var i = 0; i < 100; i += 1) { var captures = []; captures[i] = 'test'; if (i > 0) { t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$' + i + '<'), '>undefined<', 'supports $' + i + ' with no captures' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$' + i), '>undefined', 'supports $' + i + ' at the end of the replacement, with no captures' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, '>$' + i + '<'), '><', 'supports $' + i + ' with a capture at that index' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, '>$' + i), '>', 'supports $' + i + ' at the end of the replacement, with a capture at that index' ); } if (i < 10) { t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$0' + i + '<'), i === 0 ? '><' : '>undefined<', 'supports $0' + i + ' with no captures' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$0' + i), i === 0 ? '>' : '>undefined', 'supports $0' + i + ' at the end of the replacement, with no captures' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, '>$0' + i + '<'), '><', 'supports $0' + i + ' with a capture at that index' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, '>$0' + i), '>', 'supports $0' + i + ' at the end of the replacement, with a capture at that index' ); } } t.end(); }); test('GetV', function (t) { t['throws'](function () { return ES.GetV({ 7: 7 }, 7); }, TypeError, 'Throws a TypeError if `P` is not a property key'); var obj = { a: function () {} }; t.equal(ES.GetV(obj, 'a'), obj.a, 'returns property if it exists'); t.equal(ES.GetV(obj, 'b'), undefined, 'returns undefiend if property does not exist'); t.end(); }); test('HasOwnProperty', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.HasOwnProperty(primitive, 'key'); }, TypeError, debug(primitive) + ' is not an Object' ); }); forEach(v.nonPropertyKeys, function (nonKey) { t['throws']( function () { ES.HasOwnProperty({}, nonKey); }, TypeError, debug(nonKey) + ' is not a Property Key' ); }); t.equal(ES.HasOwnProperty({}, 'toString'), false, 'inherited properties are not own'); t.equal( ES.HasOwnProperty({ toString: 1 }, 'toString'), true, 'shadowed inherited own properties are own' ); t.equal(ES.HasOwnProperty({ a: 1 }, 'a'), true, 'own properties are own'); t.end(); }); test('HasProperty', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.HasProperty(primitive, 'key'); }, TypeError, debug(primitive) + ' is not an Object' ); }); forEach(v.nonPropertyKeys, function (nonKey) { t['throws']( function () { ES.HasProperty({}, nonKey); }, TypeError, debug(nonKey) + ' is not a Property Key' ); }); t.equal(ES.HasProperty({}, 'nope'), false, 'object does not have nonexistent properties'); t.equal(ES.HasProperty({}, 'toString'), true, 'object has inherited properties'); t.equal( ES.HasProperty({ toString: 1 }, 'toString'), true, 'object has shadowed inherited own properties' ); t.equal(ES.HasProperty({ a: 1 }, 'a'), true, 'object has own properties'); t.end(); }); test('InstanceofOperator', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.InstanceofOperator(primitive, function () {}); }, TypeError, debug(primitive) + ' is not an object' ); }); forEach(v.nonFunctions, function (nonFunction) { t['throws']( function () { ES.InstanceofOperator({}, nonFunction); }, TypeError, debug(nonFunction) + ' is not callable' ); }); var C = function C() {}; var D = function D() {}; t.equal(ES.InstanceofOperator(new C(), C), true, 'constructor function has an instance of itself'); t.equal(ES.InstanceofOperator(new D(), C), false, 'constructor/instance mismatch is false'); t.equal(ES.InstanceofOperator(new C(), D), false, 'instance/constructor mismatch is false'); t.equal(ES.InstanceofOperator({}, C), false, 'plain object is not an instance of a constructor'); t.equal(ES.InstanceofOperator({}, Object), true, 'plain object is an instance of Object'); t.test('Symbol.hasInstance', { skip: !v.hasSymbols || !Symbol.hasInstance }, function (st) { st.plan(5); var O = {}; var C2 = function () {}; st.equal(ES.InstanceofOperator(O, C2), false, 'O is not an instance of C2'); defineProperty(C2, Symbol.hasInstance, { configurable: true, value: function (obj) { st.equal(this, C2, 'hasInstance receiver is C2'); st.equal(obj, O, 'hasInstance argument is O'); return {}; // testing coercion to boolean } }); st.equal(ES.InstanceofOperator(O, C2), true, 'O is now an instance of C2'); defineProperty(C2, Symbol.hasInstance, { configurable: true, value: undefined }); st.equal(ES.InstanceofOperator(O, C2), false, 'O is no longer an instance of C2'); st.end(); }); t.end(); }); test('Invoke', function (t) { forEach(v.nonPropertyKeys, function (nonKey) { t['throws']( function () { ES.Invoke({}, nonKey); }, TypeError, debug(nonKey) + ' is not a Property Key' ); }); t['throws']( function () { ES.Invoke({ o: false }, 'o'); }, TypeError, 'fails on a non-function' ); forEach(v.nonArrays, function (nonArray) { t['throws']( function () { ES.Invoke({}, '', nonArray); }, TypeError, debug(nonArray) + ' is not an Array' ); }); t.test('invoked callback', function (st) { var aValue = {}; var bValue = {}; var obj = { f: function (a) { st.equal(arguments.length, 2, '2 args passed'); st.equal(a, aValue, 'first arg is correct'); st.equal(arguments[1], bValue, 'second arg is correct'); } }; st.plan(3); ES.Invoke(obj, 'f', [aValue, bValue]); }); t.end(); }); test('IsArray', function (t) { t.equal(true, ES.IsArray([]), '[] is array'); t.equal(false, ES.IsArray({}), '{} is not array'); t.equal(false, ES.IsArray({ length: 1, 0: true }), 'arraylike object is not array'); forEach(v.objects.concat(v.primitives), function (value) { t.equal(false, ES.IsArray(value), debug(value) + ' is not array'); }); t.end(); }); test('IsCompatiblePropertyDescriptor', function (t) { t.equal( ES.IsCompatiblePropertyDescriptor( true, v.descriptors.configurable(), ES.CompletePropertyDescriptor(v.descriptors.nonConfigurable()) ), false ); t.equal( ES.IsCompatiblePropertyDescriptor( false, v.descriptors.configurable(), ES.CompletePropertyDescriptor(v.descriptors.nonConfigurable()) ), false ); t.equal( ES.IsCompatiblePropertyDescriptor( true, v.descriptors.nonConfigurable(), ES.CompletePropertyDescriptor(v.descriptors.configurable()) ), true ); t.equal( ES.IsCompatiblePropertyDescriptor( false, v.descriptors.nonConfigurable(), ES.CompletePropertyDescriptor(v.descriptors.configurable()) ), true ); t.end(); }); test('IsConcatSpreadable', function (t) { forEach(v.primitives, function (primitive) { t.equal(ES.IsConcatSpreadable(primitive), false, debug(primitive) + ' is not an Object'); }); var hasSymbolConcatSpreadable = v.hasSymbols && Symbol.isConcatSpreadable; t.test('Symbol.isConcatSpreadable', { skip: !hasSymbolConcatSpreadable }, function (st) { forEach(v.falsies, function (falsy) { var obj = {}; obj[Symbol.isConcatSpreadable] = falsy; st.equal( ES.IsConcatSpreadable(obj), false, 'an object with ' + debug(falsy) + ' as Symbol.isConcatSpreadable is not concat spreadable' ); }); forEach(v.truthies, function (truthy) { var obj = {}; obj[Symbol.isConcatSpreadable] = truthy; st.equal( ES.IsConcatSpreadable(obj), true, 'an object with ' + debug(truthy) + ' as Symbol.isConcatSpreadable is concat spreadable' ); }); st.end(); }); forEach(v.objects, function (object) { t.equal( ES.IsConcatSpreadable(object), false, 'non-array without Symbol.isConcatSpreadable is not concat spreadable' ); }); t.equal(ES.IsConcatSpreadable([]), true, 'arrays are concat spreadable'); t.end(); }); test('IsConstructor', function (t) { t.equal(true, ES.IsConstructor(function () {}), 'function is constructor'); t.equal(false, ES.IsConstructor(/a/g), 'regex is not constructor'); forEach(v.objects, function (object) { t.equal(false, ES.IsConstructor(object), object + ' object is not constructor'); }); try { var arrow = Function('return () => {}')(); // eslint-disable-line no-new-func t.equal(ES.IsConstructor(arrow), false, 'arrow function is not constructor'); } catch (e) { t.comment('SKIP: arrow function syntax not supported.'); } try { var foo = Function('return class Foo {}')(); // eslint-disable-line no-new-func t.equal(ES.IsConstructor(foo), true, 'class is constructor'); } catch (e) { t.comment('SKIP: class syntax not supported.'); } if (typeof Reflect !== 'object' || typeof Proxy !== 'function' || has(Proxy, 'prototype')) { t.comment('SKIP: Proxy is constructor'); } else { t.equal(ES.IsConstructor(Proxy), true, 'Proxy is constructor'); } t.end(); }); test('IsExtensible', function (t) { forEach(v.objects, function (object) { t.equal(true, ES.IsExtensible(object), debug(object) + ' object is extensible'); }); forEach(v.primitives, function (primitive) { t.equal(false, ES.IsExtensible(primitive), debug(primitive) + ' is not extensible'); }); if (Object.preventExtensions) { t.equal(false, ES.IsExtensible(Object.preventExtensions({})), 'object with extensions prevented is not extensible'); } t.end(); }); test('IsPromise', { skip: typeof Promise !== 'function' }, function (t) { forEach(v.objects.concat(v.primitives), function (nonPromise) { t.equal(ES.IsPromise(nonPromise), false, debug(nonPromise) + ' is not a Promise'); }); var thenable = { then: Promise.prototype.then }; t.equal(ES.IsPromise(thenable), false, 'generic thenable is not a Promise'); t.equal(ES.IsPromise(Promise.resolve()), true, 'Promise is a Promise'); t.end(); }); test('IsPropertyDescriptor', function (t) { forEach(v.primitives, function (primitive) { t.equal( ES.IsPropertyDescriptor(primitive), false, debug(primitive) + ' is not a Property Descriptor' ); }); t.equal(ES.IsPropertyDescriptor({ invalid: true }), false, 'invalid keys not allowed on a Property Descriptor'); t.equal(ES.IsPropertyDescriptor({}), true, 'empty object is an incomplete Property Descriptor'); t.equal(ES.IsPropertyDescriptor(v.accessorDescriptor()), true, 'accessor descriptor is a Property Descriptor'); t.equal(ES.IsPropertyDescriptor(v.mutatorDescriptor()), true, 'mutator descriptor is a Property Descriptor'); t.equal(ES.IsPropertyDescriptor(v.dataDescriptor()), true, 'data descriptor is a Property Descriptor'); t.equal(ES.IsPropertyDescriptor(v.genericDescriptor()), true, 'generic descriptor is a Property Descriptor'); t['throws']( function () { ES.IsPropertyDescriptor(v.bothDescriptor()); }, TypeError, 'a Property Descriptor can not be both a Data and an Accessor Descriptor' ); t['throws']( function () { ES.IsPropertyDescriptor(v.bothDescriptorWritable()); }, TypeError, 'a Property Descriptor can not be both a Data and an Accessor Descriptor' ); t.end(); }); test('IsPropertyKey', function (t) { forEach(v.numbers.concat(v.objects), function (notKey) { t.equal(false, ES.IsPropertyKey(notKey), debug(notKey) + ' is not property key'); }); t.equal(true, ES.IsPropertyKey('foo'), 'string is property key'); forEach(v.symbols, function (symbol) { t.equal(true, ES.IsPropertyKey(symbol), debug(symbol) + ' is property key'); }); t.end(); }); test('IsRegExp', function (t) { forEach([/a/g, new RegExp('a', 'g')], function (regex) { t.equal(true, ES.IsRegExp(regex), regex + ' is regex'); }); forEach(v.objects.concat(v.primitives), function (nonRegex) { t.equal(false, ES.IsRegExp(nonRegex), debug(nonRegex) + ' is not regex'); }); t.test('Symbol.match', { skip: !v.hasSymbols || !Symbol.match }, function (st) { var obj = {}; obj[Symbol.match] = true; st.equal(true, ES.IsRegExp(obj), 'object with truthy Symbol.match is regex'); var regex = /a/; defineProperty(regex, Symbol.match, { value: false }); st.equal(false, ES.IsRegExp(regex), 'regex with falsy Symbol.match is not regex'); st.end(); }); t.end(); }); test('IsInteger', function (t) { for (var i = -100; i < 100; i += 10) { t.equal(true, ES.IsInteger(i), i + ' is integer'); t.equal(false, ES.IsInteger(i + 0.2), (i + 0.2) + ' is not integer'); } t.equal(true, ES.IsInteger(-0), '-0 is integer'); var notInts = v.nonNumbers.concat(v.nonIntegerNumbers, v.infinities, [NaN, [], new Date()]); forEach(notInts, function (notInt) { t.equal(false, ES.IsInteger(notInt), debug(notInt) + ' is not integer'); }); t.equal(false, ES.IsInteger(v.uncoercibleObject), 'uncoercibleObject is not integer'); t.end(); }); test('IteratorNext', function (t) { forEach(v.primitives, function (nonObject) { t['throws']( function () { ES.IteratorNext(nonObject); }, TypeError, debug(nonObject) + ' is not an Object' ); t['throws']( function () { ES.IteratorNext({ next: function () { return nonObject; } }); }, TypeError, '`next()` returns ' + debug(nonObject) + ', which is not an Object' ); }); var iterator = { next: function (value) { return [arguments.length, value]; } }; t.deepEqual( ES.IteratorNext(iterator), [0, undefined], 'returns expected value from `.next()`; `next` receives expected 0 arguments' ); t.deepEqual( ES.IteratorNext(iterator, iterator), [1, iterator], 'returns expected value from `.next()`; `next` receives expected 1 argument' ); t.end(); }); test('IteratorComplete', function (t) { forEach(v.primitives, function (nonObject) { t['throws']( function () { ES.IteratorComplete(nonObject); }, TypeError, debug(nonObject) + ' is not an Object' ); }); forEach(v.truthies, function (truthy) { t.equal(ES.IteratorComplete({ done: truthy }), true, '{ done: ' + debug(truthy) + ' } is true'); }); forEach(v.falsies, function (falsy) { t.equal(ES.IteratorComplete({ done: falsy }), false, '{ done: ' + debug(falsy) + ' } is false'); }); t.end(); }); test('IteratorValue', function (t) { forEach(v.primitives, function (nonObject) { t['throws']( function () { ES.IteratorValue(nonObject); }, TypeError, debug(nonObject) + ' is not an Object' ); }); var sentinel = {}; t.equal(ES.IteratorValue({ value: sentinel }), sentinel, 'Gets `.value` off the object'); t.end(); }); test('IteratorStep', function (t) { t.deepEqual( ES.IteratorStep({ next: function () { return { done: false, value: [1, arguments.length] }; } }), { done: false, value: [1, 0] }, 'not-done iterator result yields iterator result' ); t.deepEqual( ES.IteratorStep({ next: function () { return { done: true, value: [2, arguments.length] }; } }), false, 'done iterator result yields false' ); t.end(); }); test('IteratorClose', function (t) { forEach(v.primitives, function (nonObject) { t['throws']( function () { ES.IteratorClose(nonObject); }, TypeError, debug(nonObject) + ' is not an Object' ); t['throws']( function () { ES.IteratorClose({ 'return': function () { return nonObject; } }, function () {}); }, TypeError, '`.return` returns ' + debug(nonObject) + ', which is not an Object' ); }); forEach(v.nonFunctions, function (nonFunction) { t['throws']( function () { ES.IteratorClose({}, nonFunction); }, TypeError, debug(nonFunction) + ' is not a thunk for a Completion Record' ); if (nonFunction != null) { t['throws']( function () { ES.IteratorClose({ 'return': nonFunction }, function () {}); }, TypeError, '`.return` of ' + debug(nonFunction) + ' is not a Function' ); } }); var sentinel = {}; t.equal( ES.IteratorClose({ 'return': undefined }, function () { return sentinel; }), sentinel, 'when `.return` is `undefined`, invokes and returns the completion thunk' ); /* eslint no-throw-literal: 0 */ t['throws']( function () { ES.IteratorClose({ 'return': function () { throw sentinel; } }, function () {}); }, sentinel, '`.return` that throws, when completionThunk does not, throws exception from `.return`' ); t['throws']( function () { ES.IteratorClose({ 'return': function () { throw sentinel; } }, function () { throw -1; }); }, -1, '`.return` that throws, when completionThunk does too, throws exception from completionThunk' ); t['throws']( function () { ES.IteratorClose({ 'return': function () { } }, function () { throw -1; }); }, -1, '`.return` that does not throw, when completionThunk does, throws exception from completionThunk' ); t.equal( ES.IteratorClose({ 'return': function () { return sentinel; } }, function () { return 42; }), 42, 'when `.return` and completionThunk do not throw, and `.return` returns an Object, returns completionThunk' ); t.end(); }); test('ObjectCreate', function (t) { forEach(v.nonNullPrimitives, function (value) { t['throws']( function () { ES.ObjectCreate(value); }, TypeError, debug(value) + ' is not null, or an object' ); }); t.test('proto arg', function (st) { var Parent = function Parent() {}; Parent.prototype.foo = {}; var child = ES.ObjectCreate(Parent.prototype); st.equal(child instanceof Parent, true, 'child is instanceof Parent'); st.equal(child.foo, Parent.prototype.foo, 'child inherits properties from Parent.prototype'); st.end(); }); t.test('internal slots arg', function (st) { st.doesNotThrow(function () { ES.ObjectCreate({}, []); }, 'an empty slot list is valid'); st['throws']( function () { ES.ObjectCreate({}, ['a']); }, SyntaxError, 'internal slots are not supported' ); st.end(); }); t.test('null proto', { skip: !Object.create && !$setProto }, function (st) { st.equal('toString' in {}, true, 'normal objects have toString'); st.equal('toString' in ES.ObjectCreate(null), false, 'makes a null object'); st.end(); }); t.test('null proto when no native Object.create', { skip: Object.create || $setProto }, function (st) { st['throws']( function () { ES.ObjectCreate(null); }, SyntaxError, 'without a native Object.create, can not create null objects' ); st.end(); }); t.end(); }); test('ObjectDefineProperties', function (t) { forEach(v.primitives, function (nonObject) { t['throws']( function () { ES.ObjectDefineProperties(nonObject); }, debug(nonObject) + ' is not an Object' ); }); var sentinel = { sentinel: true }; t.test('basic data properties', function (st) { var o = {}; var result = ES.ObjectDefineProperties(o, { foo: fromPropertyDescriptor(v.assignedDescriptor(42)), bar: fromPropertyDescriptor(v.assignedDescriptor(sentinel)), toString: fromPropertyDescriptor(v.assignedDescriptor('not Object.prototype.toString')) }); st.equal(result, o, 'returns same object'); st.deepEqual( o, { foo: 42, bar: sentinel, toString: 'not Object.prototype.toString' }, 'expected properties are installed' ); st.end(); }); t.test('fancy stuff', function (st) { st.doesNotThrow( function () { ES.ObjectDefineProperties({}, { foo: v.assignedDescriptor(42) }); }, TypeError ); var o = {}; var result = ES.ObjectDefineProperties(o, { foo: fromPropertyDescriptor(v.accessorDescriptor(42)), bar: fromPropertyDescriptor(v.descriptors.enumerable(v.descriptors.nonConfigurable(v.dataDescriptor(sentinel)))), toString: fromPropertyDescriptor(v.accessorDescriptor('not Object.prototype.toString')) }); st.equal(result, o, 'returns same object'); st.deepEqual( o, { foo: 42, bar: sentinel, toString: 'not Object.prototype.toString' }, 'expected properties are installed' ); st.end(); }); t.end(); }); test('OrdinaryCreateFromConstructor', function (t) { forEach(v.nonFunctions, function (nonFunction) { t['throws']( function () { ES.OrdinaryCreateFromConstructor(nonFunction, '%Array.prototype%'); }, TypeError, debug(nonFunction) + ' is not a constructor' ); }); forEach(arrowFns, function (arrowFn) { t['throws']( function () { ES.OrdinaryCreateFromConstructor(arrowFn, '%Array.prototype%'); }, TypeError, debug(arrowFn) + ' is not a constructor' ); }); t.test('proto arg', function (st) { var Parent = function Parent() {}; Parent.prototype.foo = {}; var child = ES.OrdinaryCreateFromConstructor(Parent, '%Array.prototype%'); st.equal(child instanceof Parent, true, 'child is instanceof Parent'); st.equal(child instanceof Array, false, 'child is not instanceof Array'); st.equal(child.foo, Parent.prototype.foo, 'child inherits properties from Parent.prototype'); st.end(); }); t.test('internal slots arg', function (st) { st.doesNotThrow( function () { ES.OrdinaryCreateFromConstructor(function () {}, '%Array.prototype%', []); }, 'an empty slot list is valid' ); st['throws']( function () { ES.OrdinaryCreateFromConstructor(function () {}, '%Array.prototype%', ['a']); }, SyntaxError, 'internal slots are not supported' ); st.end(); }); t.end(); }); test('OrdinaryGetOwnProperty', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.OrdinaryGetOwnProperty(primitive, ''); }, TypeError, 'O: ' + debug(primitive) + ' is not an Object' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.OrdinaryGetOwnProperty({}, nonPropertyKey); }, TypeError, 'P: ' + debug(nonPropertyKey) + ' is not a Property Key' ); }); t.equal(ES.OrdinaryGetOwnProperty({}, 'not in the object'), undefined, 'missing property yields undefined'); t.equal(ES.OrdinaryGetOwnProperty({}, 'toString'), undefined, 'inherited non-own property yields undefined'); t.deepEqual( ES.OrdinaryGetOwnProperty({ a: 1 }, 'a'), ES.ToPropertyDescriptor({ configurable: true, enumerable: true, value: 1, writable: true }), 'own assigned data property yields expected descriptor' ); t.deepEqual( ES.OrdinaryGetOwnProperty(/a/, 'lastIndex'), ES.ToPropertyDescriptor({ configurable: false, enumerable: false, value: 0, writable: true }), 'regex lastIndex yields expected descriptor' ); t.deepEqual( ES.OrdinaryGetOwnProperty([], 'length'), ES.ToPropertyDescriptor({ configurable: false, enumerable: false, value: 0, writable: true }), 'array length yields expected descriptor' ); if (!Object.isFrozen || !Object.isFrozen(Object.prototype)) { t.deepEqual( ES.OrdinaryGetOwnProperty(Object.prototype, 'toString'), ES.ToPropertyDescriptor({ configurable: true, enumerable: false, value: Object.prototype.toString, writable: true }), 'own non-enumerable data property yields expected descriptor' ); } t.test('ES5+', { skip: !defineProperty.oDP }, function (st) { var O = {}; defineProperty(O, 'foo', { configurable: false, enumerable: false, value: O, writable: true }); st.deepEqual( ES.OrdinaryGetOwnProperty(O, 'foo'), ES.ToPropertyDescriptor({ configurable: false, enumerable: false, value: O, writable: true }), 'defined own property yields expected descriptor' ); st.end(); }); t.end(); }); test('OrdinaryDefineOwnProperty', { skip: !getOwnPropertyDescriptor }, function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.OrdinaryDefineOwnProperty(primitive, {}, []); }, TypeError, 'O: ' + debug(primitive) + ' is not an Object' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.OrdinaryDefineOwnProperty({}, nonPropertyKey, v.genericDescriptor()); }, TypeError, 'P: ' + debug(nonPropertyKey) + ' is not a Property Key' ); }); forEach(v.primitives, function (primitive) { t['throws']( function () { ES.OrdinaryDefineOwnProperty(primitive, '', v.genericDescriptor()); }, TypeError, 'Desc: ' + debug(primitive) + ' is not a Property Descriptor' ); }); var O = {}; var P = 'property key'; var Desc = v.accessorDescriptor(); t.equal( ES.OrdinaryDefineOwnProperty(O, P, Desc), true, 'operation is successful' ); t.deepEqual( getOwnPropertyDescriptor(O, P), ES.FromPropertyDescriptor(ES.CompletePropertyDescriptor(Desc)), 'expected property descriptor is defined' ); t.end(); }); test('OrdinaryHasInstance', function (t) { forEach(v.nonFunctions, function (nonFunction) { t.equal(ES.OrdinaryHasInstance(nonFunction, {}), false, debug(nonFunction) + ' is not callable'); }); forEach(v.primitives, function (primitive) { t.equal(ES.OrdinaryHasInstance(function () {}, primitive), false, debug(primitive) + ' is not an object'); }); var C = function C() {}; var D = function D() {}; t.equal(ES.OrdinaryHasInstance(C, new C()), true, 'constructor function has an instance of itself'); t.equal(ES.OrdinaryHasInstance(C, new D()), false, 'constructor/instance mismatch is false'); t.equal(ES.OrdinaryHasInstance(D, new C()), false, 'instance/constructor mismatch is false'); t.equal(ES.OrdinaryHasInstance(C, {}), false, 'plain object is not an instance of a constructor'); t.equal(ES.OrdinaryHasInstance(Object, {}), true, 'plain object is an instance of Object'); t.end(); }); test('OrdinaryHasProperty', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.OrdinaryHasProperty(primitive, ''); }, TypeError, debug(primitive) + ' is not an object' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.OrdinaryHasProperty({}, nonPropertyKey); }, TypeError, 'P: ' + debug(nonPropertyKey) + ' is not a Property Key' ); }); t.equal(ES.OrdinaryHasProperty({ a: 1 }, 'a'), true, 'own property is true'); t.equal(ES.OrdinaryHasProperty({}, 'toString'), true, 'inherited property is true'); t.equal(ES.OrdinaryHasProperty({}, 'nope'), false, 'absent property is false'); t.end(); }); test('QuoteJSONString', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.QuoteJSONString(nonString); }, TypeError, debug(nonString) + ' is not a String' ); }); t.equal(ES.QuoteJSONString(''), '""', '"" gets properly JSON-quoted'); t.equal(ES.QuoteJSONString('a'), '"a"', '"a" gets properly JSON-quoted'); t.equal(ES.QuoteJSONString('"'), '"\\""', '"\\"" gets properly JSON-quoted'); t.equal(ES.QuoteJSONString('\b'), '"\\b"', '"\\b" gets properly JSON-quoted'); t.equal(ES.QuoteJSONString('\t'), '"\\t"', '"\\t" gets properly JSON-quoted'); t.equal(ES.QuoteJSONString('\n'), '"\\n"', '"\\n" gets properly JSON-quoted'); t.equal(ES.QuoteJSONString('\f'), '"\\f"', '"\\f" gets properly JSON-quoted'); t.equal(ES.QuoteJSONString('\r'), '"\\r"', '"\\r" gets properly JSON-quoted'); t.equal(ES.QuoteJSONString('\\'), '"\\\\"', '"\\\\" gets properly JSON-quoted'); t.equal(ES.QuoteJSONString('\\'), '"\\\\"', '"\\\\" gets properly JSON-quoted'); t.equal(ES.QuoteJSONString('\u0019'), '"\\u0019"', '"\\u0019" gets properly JSON-quoted'); t.end(); }); test('RegExpCreate', function (t) { forEach(v.nonStrings, function (nonString) { if (typeof nonString !== 'symbol') { var p = typeof nonString === 'undefined' ? '' : nonString; t.equal( String(ES.RegExpCreate(p, 'g')), '/' + (String(p) || RegExp.prototype.source || String(RegExp.prototype).slice(1, -1)) + '/g', debug(nonString) + ' becomes `/' + String(p) + '/g`' ); } }); t.deepEqual(ES.RegExpCreate(), new RegExp(), 'undefined pattern and flags yields empty regex'); t.end(); }); test('RegExpExec', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.RegExpExec(primitive); }, TypeError, '"R" argument must be an object; ' + debug(primitive) + ' is not' ); }); forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.RegExpExec({}, nonString); }, TypeError, '"S" argument must be a String; ' + debug(nonString) + ' is not' ); }); t.test('gets and calls a callable "exec"', function (st) { var str = '123'; var o = { exec: function (S) { st.equal(this, o, '"exec" receiver is R'); st.equal(S, str, '"exec" argument is S'); return null; } }; st.plan(2); ES.RegExpExec(o, str); st.end(); }); t.test('throws if a callable "exec" returns a non-null non-object', function (st) { var str = '123'; st.plan(v.nonNullPrimitives.length); forEach(v.nonNullPrimitives, function (nonNullPrimitive) { st['throws']( function () { ES.RegExpExec({ exec: function () { return nonNullPrimitive; } }, str); }, TypeError, '"exec" method must return `null` or an Object; ' + debug(nonNullPrimitive) + ' is not' ); }); st.end(); }); t.test('actual regex that should match against a string', function (st) { var S = 'aabc'; var R = /a/g; var match1 = ES.RegExpExec(R, S); var expected1 = assign(['a'], kludgeMatch(R, { index: 0, input: S })); var match2 = ES.RegExpExec(R, S); var expected2 = assign(['a'], kludgeMatch(R, { index: 1, input: S })); var match3 = ES.RegExpExec(R, S); st.deepEqual(match1, expected1, 'match object 1 is as expected'); st.deepEqual(match2, expected2, 'match object 2 is as expected'); st.equal(match3, null, 'match 3 is null as expected'); st.end(); }); t.test('actual regex that should match against a string, with shadowed "exec"', function (st) { var S = 'aabc'; var R = /a/g; defineProperty(R, 'exec', { configurable: true, enumerable: true, value: undefined, writable: true }); var match1 = ES.RegExpExec(R, S); var expected1 = assign(['a'], kludgeMatch(R, { index: 0, input: S })); var match2 = ES.RegExpExec(R, S); var expected2 = assign(['a'], kludgeMatch(R, { index: 1, input: S })); var match3 = ES.RegExpExec(R, S); st.deepEqual(match1, expected1, 'match object 1 is as expected'); st.deepEqual(match2, expected2, 'match object 2 is as expected'); st.equal(match3, null, 'match 3 is null as expected'); st.end(); }); t.end(); }); test('RequireObjectCoercible', function (t) { t.equal(false, 'CheckObjectCoercible' in ES, 'CheckObjectCoercible -> RequireObjectCoercible in ES6'); t['throws'](function () { return ES.RequireObjectCoercible(undefined); }, TypeError, 'undefined throws'); t['throws'](function () { return ES.RequireObjectCoercible(null); }, TypeError, 'null throws'); var isCoercible = function (value) { t.doesNotThrow(function () { return ES.RequireObjectCoercible(value); }, debug(value) + ' does not throw'); }; forEach(v.objects.concat(v.nonNullPrimitives), isCoercible); t.end(); }); test('SameValueZero', function (t) { t.equal(true, ES.SameValueZero(NaN, NaN), 'NaN is SameValueZero as NaN'); t.equal(true, ES.SameValueZero(0, -0), '+0 is SameValueZero as -0'); forEach(v.objects.concat(v.primitives), function (val) { t.equal(val === val, ES.SameValueZero(val, val), debug(val) + ' is SameValueZero to itself'); }); t.end(); }); test('Set', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.Set(primitive, '', null, false); }, TypeError, debug(primitive) + ' is not an Object' ); }); forEach(v.nonPropertyKeys, function (nonKey) { t['throws']( function () { ES.Set({}, nonKey, null, false); }, TypeError, debug(nonKey) + ' is not a Property Key' ); }); forEach(v.nonBooleans, function (nonBoolean) { t['throws']( function () { ES.Set({}, '', null, nonBoolean); }, TypeError, debug(nonBoolean) + ' is not a Boolean' ); }); var o = {}; var value = {}; ES.Set(o, 'key', value, true); t.deepEqual(o, { key: value }, 'key is set'); t.test('nonwritable', { skip: !defineProperty.oDP }, function (st) { var obj = { a: value }; defineProperty(obj, 'a', { writable: false }); st['throws']( function () { ES.Set(obj, 'a', {}, true); }, TypeError, 'can not Set nonwritable property' ); st.doesNotThrow( function () { st.equal(ES.Set(obj, 'a', {}, false), false, 'unsuccessful Set returns false'); }, 'setting Throw to false prevents an exception' ); st.end(); }); t.test('nonconfigurable', { skip: !defineProperty.oDP }, function (st) { var obj = { a: value }; defineProperty(obj, 'a', { configurable: false }); st.equal(ES.Set(obj, 'a', value, true), true, 'successful Set returns true'); st.deepEqual(obj, { a: value }, 'key is set'); st.end(); }); t.test('doesn’t call [[Get]] in conforming strict mode environments', { skip: noThrowOnStrictViolation }, function (st) { var getterCalled = false; var setterCalls = 0; var obj = {}; defineProperty(obj, 'a', { get: function () { getterCalled = true; }, set: function () { setterCalls += 1; } }); st.equal(ES.Set(obj, 'a', value, false), true, 'successful Set returns true'); st.equal(setterCalls, 1, 'setter was called once'); st.equal(getterCalled, false, 'getter was not called'); st.end(); }); t.end(); }); test('SetFunctionName', function (t) { forEach(v.nonFunctions, function (nonFunction) { t['throws']( function () { ES.SetFunctionName(nonFunction, ''); }, TypeError, debug(nonFunction) + ' is not a Function' ); }); t.test('non-extensible function', { skip: !Object.preventExtensions }, function (st) { var f = getNamelessFunction(); Object.preventExtensions(f); st['throws']( function () { ES.SetFunctionName(f, ''); }, TypeError, 'throws on a non-extensible function' ); st.end(); }); t.test('has an own name property', { skip: !functionsHaveNames }, function (st) { st['throws']( function () { ES.SetFunctionName(function g() {}, ''); }, TypeError, 'throws if function has an own `name` property' ); st.end(); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.SetFunctionName(getNamelessFunction(), nonPropertyKey); }, TypeError, debug(nonPropertyKey) + ' is not a Symbol or String' ); }); t.test('symbols', { skip: !v.hasSymbols || has(getNamelessFunction(), 'name') }, function (st) { var pairs = [ [Symbol(), ''], [Symbol(undefined), ''], [Symbol(null), '[null]'], [Symbol(''), getInferredName ? '[]' : ''], [Symbol.iterator, '[Symbol.iterator]'], [Symbol('foo'), '[foo]'] ]; forEach(pairs, function (pair) { var sym = pair[0]; var desc = pair[1]; var f = getNamelessFunction(); ES.SetFunctionName(f, sym); st.equal(f.name, desc, debug(sym) + ' yields a name of ' + debug(desc)); }); st.end(); }); var f = getNamelessFunction(); t.test('when names are configurable', { skip: !functionsHaveConfigurableNames || has(f, 'name') }, function (st) { // without prefix st.notEqual(f.name, 'foo', 'precondition'); ES.SetFunctionName(f, 'foo'); st.equal(f.name, 'foo', 'function name is set without a prefix'); // with prefix var g = getNamelessFunction(); st.notEqual(g.name, 'pre- foo', 'precondition'); ES.SetFunctionName(g, 'foo', 'pre-'); st.equal(g.name, 'pre- foo', 'function name is set with a prefix'); st.end(); }); t.end(); }); test('SetIntegrityLevel', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.SetIntegrityLevel(primitive); }, TypeError, debug(primitive) + ' is not an Object' ); }); t['throws']( function () { ES.SetIntegrityLevel({}); }, /^TypeError: Assertion failed: `level` must be `"sealed"` or `"frozen"`$/, '`level` must be `"sealed"` or `"frozen"`' ); var O = { a: 1 }; t.test('sealed', { skip: !Object.preventExtensions || noThrowOnStrictViolation }, function (st) { st.equal(ES.SetIntegrityLevel(O, 'sealed'), true); st['throws']( function () { O.b = 2; }, /^TypeError: (Cannot|Can't) add property b, object is not extensible$/, 'sealing prevent new properties from being added' ); O.a = 2; st.equal(O.a, 2, 'pre-frozen, existing properties are mutable'); st.end(); }); t.test('frozen', { skip: !Object.freeze || noThrowOnStrictViolation }, function (st) { st.equal(ES.SetIntegrityLevel(O, 'frozen'), true); st['throws']( function () { O.a = 3; }, /^TypeError: Cannot assign to read only property 'a' of /, 'freezing prevents existing properties from being mutated' ); st.end(); }); t.end(); }); test('SpeciesConstructor', function (t) { t['throws'](function () { ES.SpeciesConstructor(null); }, TypeError); t['throws'](function () { ES.SpeciesConstructor(undefined); }, TypeError); var defaultConstructor = function Foo() {}; t.equal( ES.SpeciesConstructor({ constructor: undefined }, defaultConstructor), defaultConstructor, 'undefined constructor returns defaultConstructor' ); t['throws']( function () { return ES.SpeciesConstructor({ constructor: null }, defaultConstructor); }, TypeError, 'non-undefined non-object constructor throws' ); t.test('with Symbol.species', { skip: !hasSpecies }, function (st) { var Bar = function Bar() {}; Bar[Symbol.species] = null; st.equal( ES.SpeciesConstructor(new Bar(), defaultConstructor), defaultConstructor, 'undefined/null Symbol.species returns default constructor' ); var Baz = function Baz() {}; Baz[Symbol.species] = Bar; st.equal( ES.SpeciesConstructor(new Baz(), defaultConstructor), Bar, 'returns Symbol.species constructor value' ); Baz[Symbol.species] = {}; st['throws']( function () { ES.SpeciesConstructor(new Baz(), defaultConstructor); }, TypeError, 'throws when non-constructor non-null non-undefined species value found' ); st.end(); }); t.end(); }); test('SplitMatch', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.SplitMatch(nonString, 0, ''); }, TypeError, 'S: ' + debug(nonString) + ' is not a String' ); t['throws']( function () { ES.SplitMatch('', 0, nonString); }, TypeError, 'R: ' + debug(nonString) + ' is not a String' ); }); forEach(v.nonNumbers.concat(v.nonIntegerNumbers), function (nonIntegerNumber) { t['throws']( function () { ES.SplitMatch('', nonIntegerNumber, ''); }, TypeError, 'q: ' + debug(nonIntegerNumber) + ' is not an integer' ); }); t.equal(ES.SplitMatch('abc', 0, 'a'), 1, '"a" is found at index 0, before index 1, in "abc"'); t.equal(ES.SplitMatch('abc', 1, 'a'), false, '"a" is not found at index 1 in "abc"'); t.equal(ES.SplitMatch('abc', 2, 'a'), false, '"a" is not found at index 2 in "abc"'); t.equal(ES.SplitMatch('abc', 0, 'b'), false, '"a" is not found at index 0 in "abc"'); t.equal(ES.SplitMatch('abc', 1, 'b'), 2, '"b" is found at index 1, before index 2, in "abc"'); t.equal(ES.SplitMatch('abc', 2, 'b'), false, '"a" is not found at index 2 in "abc"'); t.equal(ES.SplitMatch('abc', 0, 'c'), false, '"a" is not found at index 0 in "abc"'); t.equal(ES.SplitMatch('abc', 1, 'c'), false, '"a" is not found at index 1 in "abc"'); t.equal(ES.SplitMatch('abc', 2, 'c'), 3, '"c" is found at index 2, before index 3, in "abc"'); t.equal(ES.SplitMatch('a', 0, 'ab'), false, 'R longer than S yields false'); var s = 'a' + wholePoo + 'c'; t.equal(ES.SplitMatch(s, 1, wholePoo), 3, debug(wholePoo) + ' is found at index 1, before index 3, in ' + debug(s)); t.end(); }); test('StringCreate', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.StringCreate(nonString, String.prototype); }, TypeError, debug(nonString) + ' is not a String' ); }); t.deepEqual(ES.StringCreate('foo', String.prototype), Object('foo'), '"foo" with `String.prototype` makes `Object("foo")'); var proto = {}; if ($setProto) { t.equal($getProto(ES.StringCreate('', proto)), proto, '[[Prototype]] is set as expected'); } else { t['throws']( function () { ES.StringCreate('', proto); }, SyntaxError, 'setting [[Prototype]] is not supported in this env' ); } t.equal(ES.StringCreate('a', String.prototype).length, 'a'.length, 'length is preserved'); t.end(); }); test('StringGetIndexProperty', function (t) { forEach(v.nonStrings.concat(v.strings), function (nonStringObjects) { t['throws']( function () { ES.StringGetIndexProperty(nonStringObjects); }, TypeError, debug(nonStringObjects) + ' is not a boxed String Object' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.StringGetIndexProperty('', nonPropertyKey); }, TypeError, debug(nonPropertyKey) + ' is not a Property Key' ); }); forEach(v.symbols, function (symbol) { t.equal( ES.StringGetIndexProperty(Object('a'), symbol), undefined, debug(symbol) + ' is a Property Key, but not a String' ); }); // a string where CanonicalNumericIndexString returns undefined, a non-integer, or -0 forEach(['-1', '-0', 'undefined'].concat(v.nonIntegerNumbers), function (nonIndex) { var S = Object('abc'); t.equal( ES.StringGetIndexProperty(S, String(nonIndex)), undefined, debug(nonIndex) + ' is not an index inside ' + debug(S) ); }); forEach(v.strings, function (str) { var S = Object(str); for (var i = 0; i < str.length; i += 1) { var desc = { '[[Configurable]]': false, '[[Enumerable]]': true, '[[Value]]': str.charAt(i), '[[Writable]]': false }; t.deepEqual( ES.StringGetIndexProperty(S, String(i)), desc, 'boxed String ' + debug(S) + ' at index ' + debug(i) + ' is ' + debug(desc) ); } t.equal( ES.StringGetIndexProperty(S, String(str.length)), undefined, 'boxed String ' + debug(S) + ' at OOB index ' + debug(str.length) + ' is `undefined' ); }); t.end(); }); test('SymbolDescriptiveString', function (t) { forEach(v.nonSymbolPrimitives.concat(v.objects), function (nonSymbol) { t['throws']( function () { ES.SymbolDescriptiveString(nonSymbol); }, TypeError, debug(nonSymbol) + ' is not a Symbol' ); }); t.test('Symbols', { skip: !v.hasSymbols }, function (st) { st.equal(ES.SymbolDescriptiveString(Symbol()), 'Symbol()', 'undefined description'); st.equal(ES.SymbolDescriptiveString(Symbol('')), 'Symbol()', 'empty string description'); st.equal(ES.SymbolDescriptiveString(Symbol.iterator), 'Symbol(Symbol.iterator)', 'well-known symbol'); st.equal(ES.SymbolDescriptiveString(Symbol('foo')), 'Symbol(foo)', 'string description'); st.end(); }); t.end(); }); test('TestIntegrityLevel', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.TestIntegrityLevel(primitive); }, TypeError, debug(primitive) + ' is not an Object' ); }); t['throws']( function () { ES.TestIntegrityLevel({ a: 1 }); }, /^TypeError: Assertion failed: `level` must be `"sealed"` or `"frozen"`$/, '`level` must be `"sealed"` or `"frozen"`' ); t.equal(ES.TestIntegrityLevel({ a: 1 }, 'sealed'), false, 'basic object is not sealed'); t.equal(ES.TestIntegrityLevel({ a: 1 }, 'frozen'), false, 'basic object is not frozen'); t.test('preventExtensions', { skip: !Object.preventExtensions }, function (st) { var o = Object.preventExtensions({ a: 1 }); st.equal(ES.TestIntegrityLevel(o, 'sealed'), false, 'nonextensible object is not sealed'); st.equal(ES.TestIntegrityLevel(o, 'frozen'), false, 'nonextensible object is not frozen'); var empty = Object.preventExtensions({}); st.equal(ES.TestIntegrityLevel(empty, 'sealed'), true, 'empty nonextensible object is sealed'); st.equal(ES.TestIntegrityLevel(empty, 'frozen'), true, 'empty nonextensible object is frozen'); st.end(); }); t.test('seal', { skip: !Object.seal }, function (st) { var o = Object.seal({ a: 1 }); st.equal(ES.TestIntegrityLevel(o, 'sealed'), true, 'sealed object is sealed'); st.equal(ES.TestIntegrityLevel(o, 'frozen'), false, 'sealed object is not frozen'); var empty = Object.seal({}); st.equal(ES.TestIntegrityLevel(empty, 'sealed'), true, 'empty sealed object is sealed'); st.equal(ES.TestIntegrityLevel(empty, 'frozen'), true, 'empty sealed object is frozen'); st.end(); }); t.test('freeze', { skip: !Object.freeze }, function (st) { var o = Object.freeze({ a: 1 }); st.equal(ES.TestIntegrityLevel(o, 'sealed'), true, 'frozen object is sealed'); st.equal(ES.TestIntegrityLevel(o, 'frozen'), true, 'frozen object is frozen'); var empty = Object.freeze({}); st.equal(ES.TestIntegrityLevel(empty, 'sealed'), true, 'empty frozen object is sealed'); st.equal(ES.TestIntegrityLevel(empty, 'frozen'), true, 'empty frozen object is frozen'); st.end(); }); t.end(); }); test('thisNumberValue', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.thisNumberValue(nonNumber); }, TypeError, debug(nonNumber) + ' is not a Number' ); }); forEach(v.numbers, function (number) { t.equal(ES.thisNumberValue(number), number, debug(number) + ' is its own thisNumberValue'); var obj = Object(number); t.equal(ES.thisNumberValue(obj), number, debug(obj) + ' is the boxed thisNumberValue'); }); t.end(); }); test('thisBooleanValue', function (t) { forEach(v.nonBooleans, function (nonBoolean) { t['throws']( function () { ES.thisBooleanValue(nonBoolean); }, TypeError, debug(nonBoolean) + ' is not a Boolean' ); }); forEach(v.booleans, function (boolean) { t.equal(ES.thisBooleanValue(boolean), boolean, debug(boolean) + ' is its own thisBooleanValue'); var obj = Object(boolean); t.equal(ES.thisBooleanValue(obj), boolean, debug(obj) + ' is the boxed thisBooleanValue'); }); t.end(); }); test('thisStringValue', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.thisStringValue(nonString); }, TypeError, debug(nonString) + ' is not a String' ); }); forEach(v.strings, function (string) { t.equal(ES.thisStringValue(string), string, debug(string) + ' is its own thisStringValue'); var obj = Object(string); t.equal(ES.thisStringValue(obj), string, debug(obj) + ' is the boxed thisStringValue'); }); t.end(); }); test('thisTimeValue', function (t) { forEach(v.primitives.concat(v.objects), function (nonDate) { t['throws']( function () { ES.thisTimeValue(nonDate); }, TypeError, debug(nonDate) + ' is not a Date' ); }); forEach(v.timestamps, function (timestamp) { var date = new Date(timestamp); t.equal(ES.thisTimeValue(date), timestamp, debug(date) + ' is its own thisTimeValue'); }); t.end(); }); test('ToDateString', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.ToDateString(nonNumber); }, TypeError, debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.ToDateString(NaN), 'Invalid Date', 'NaN becomes "Invalid Date"'); var now = +new Date(); t.equal(ES.ToDateString(now), Date(now), 'any timestamp becomes `Date(timestamp)`'); t.end(); }); test('ToInt16', function (t) { t.equal(0, ES.ToInt16(NaN), 'NaN coerces to +0'); forEach([0, Infinity], function (num) { t.equal(0, ES.ToInt16(num), num + ' returns +0'); t.equal(0, ES.ToInt16(-num), '-' + num + ' returns +0'); }); t['throws'](function () { return ES.ToInt16(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); t.equal(ES.ToInt16(0x100000000), 0, '2^32 returns +0'); t.equal(ES.ToInt16(0x100000000 - 1), -1, '2^32 - 1 returns -1'); t.equal(ES.ToInt16(0x80000000), 0, '2^31 returns +0'); t.equal(ES.ToInt16(0x80000000 - 1), -1, '2^31 - 1 returns -1'); t.equal(ES.ToInt16(0x10000), 0, '2^16 returns +0'); t.equal(ES.ToInt16(0x10000 - 1), -1, '2^16 - 1 returns -1'); t.end(); }); test('ToInt8', function (t) { t.equal(0, ES.ToInt8(NaN), 'NaN coerces to +0'); forEach([0, Infinity], function (num) { t.equal(0, ES.ToInt8(num), num + ' returns +0'); t.equal(0, ES.ToInt8(-num), '-' + num + ' returns +0'); }); t['throws'](function () { return ES.ToInt8(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); t.equal(ES.ToInt8(0x100000000), 0, '2^32 returns +0'); t.equal(ES.ToInt8(0x100000000 - 1), -1, '2^32 - 1 returns -1'); t.equal(ES.ToInt8(0x80000000), 0, '2^31 returns +0'); t.equal(ES.ToInt8(0x80000000 - 1), -1, '2^31 - 1 returns -1'); t.equal(ES.ToInt8(0x10000), 0, '2^16 returns +0'); t.equal(ES.ToInt8(0x10000 - 1), -1, '2^16 - 1 returns -1'); t.equal(ES.ToInt8(0x100), 0, '2^8 returns +0'); t.equal(ES.ToInt8(0x100 - 1), -1, '2^8 - 1 returns -1'); t.equal(ES.ToInt8(0x10), 0x10, '2^4 returns 2^4'); t.end(); }); test('ToNumber', function (t) { testToNumber(t, ES, ES.ToNumber); t.end(); }); test('ToUint8', function (t) { t.equal(0, ES.ToUint8(NaN), 'NaN coerces to +0'); forEach([0, Infinity], function (num) { t.equal(0, ES.ToUint8(num), num + ' returns +0'); t.equal(0, ES.ToUint8(-num), '-' + num + ' returns +0'); }); t['throws'](function () { return ES.ToUint8(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); t.equal(ES.ToUint8(0x100000000), 0, '2^32 returns +0'); t.equal(ES.ToUint8(0x100000000 - 1), 0x100 - 1, '2^32 - 1 returns 2^8 - 1'); t.equal(ES.ToUint8(0x80000000), 0, '2^31 returns +0'); t.equal(ES.ToUint8(0x80000000 - 1), 0x100 - 1, '2^31 - 1 returns 2^8 - 1'); t.equal(ES.ToUint8(0x10000), 0, '2^16 returns +0'); t.equal(ES.ToUint8(0x10000 - 1), 0x100 - 1, '2^16 - 1 returns 2^8 - 1'); t.equal(ES.ToUint8(0x100), 0, '2^8 returns +0'); t.equal(ES.ToUint8(0x100 - 1), 0x100 - 1, '2^8 - 1 returns 2^16 - 1'); t.equal(ES.ToUint8(0x10), 0x10, '2^4 returns 2^4'); t.equal(ES.ToUint8(0x10 - 1), 0x10 - 1, '2^4 - 1 returns 2^4 - 1'); t.end(); }); test('ToUint8Clamp', function (t) { t.equal(0, ES.ToUint8Clamp(NaN), 'NaN coerces to +0'); t.equal(0, ES.ToUint8Clamp(0), '+0 returns +0'); t.equal(0, ES.ToUint8Clamp(-0), '-0 returns +0'); t.equal(0, ES.ToUint8Clamp(-Infinity), '-Infinity returns +0'); t['throws'](function () { return ES.ToUint8Clamp(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); forEach([255, 256, 0x100000, Infinity], function (number) { t.equal(255, ES.ToUint8Clamp(number), number + ' coerces to 255'); }); t.equal(1, ES.ToUint8Clamp(1.49), '1.49 coerces to 1'); t.equal(2, ES.ToUint8Clamp(1.5), '1.5 coerces to 2, because 2 is even'); t.equal(2, ES.ToUint8Clamp(1.51), '1.51 coerces to 2'); t.equal(2, ES.ToUint8Clamp(2.49), '2.49 coerces to 2'); t.equal(2, ES.ToUint8Clamp(2.5), '2.5 coerces to 2, because 2 is even'); t.equal(3, ES.ToUint8Clamp(2.51), '2.51 coerces to 3'); t.end(); }); test('ToLength', function (t) { t['throws'](function () { return ES.ToLength(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError'); t.equal(3, ES.ToLength(v.coercibleObject), 'coercibleObject coerces to 3'); t.equal(42, ES.ToLength('42.5'), '"42.5" coerces to 42'); t.equal(7, ES.ToLength(7.3), '7.3 coerces to 7'); forEach([-0, -1, -42, -Infinity], function (negative) { t.equal(0, ES.ToLength(negative), negative + ' coerces to +0'); }); t.equal(MAX_SAFE_INTEGER, ES.ToLength(MAX_SAFE_INTEGER + 1), '2^53 coerces to 2^53 - 1'); t.equal(MAX_SAFE_INTEGER, ES.ToLength(MAX_SAFE_INTEGER + 3), '2^53 + 2 coerces to 2^53 - 1'); t.end(); }); test('ToPropertyKey', function (t) { forEach(v.objects.concat(v.nonSymbolPrimitives), function (value) { t.equal(ES.ToPropertyKey(value), String(value), 'ToPropertyKey(value) === String(value) for non-Symbols'); }); forEach(v.symbols, function (symbol) { t.equal( ES.ToPropertyKey(symbol), symbol, 'ToPropertyKey(' + debug(symbol) + ') === ' + debug(symbol) ); t.equal( ES.ToPropertyKey(Object(symbol)), symbol, 'ToPropertyKey(' + debug(Object(symbol)) + ') === ' + debug(symbol) ); }); t.end(); }); test('ToString', function (t) { forEach(v.objects.concat(v.nonSymbolPrimitives), function (item) { t.equal(ES.ToString(item), String(item), 'ES.ToString(' + debug(item) + ') ToStrings to String(' + debug(item) + ')'); }); t['throws'](function () { return ES.ToString(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); forEach(v.symbols, function (symbol) { t['throws'](function () { return ES.ToString(symbol); }, TypeError, debug(symbol) + ' throws'); }); t.end(); }); test('Type', function (t) { t.equal(ES.Type(), 'Undefined', 'Type() is Undefined'); t.equal(ES.Type(undefined), 'Undefined', 'Type(undefined) is Undefined'); t.equal(ES.Type(null), 'Null', 'Type(null) is Null'); t.equal(ES.Type(true), 'Boolean', 'Type(true) is Boolean'); t.equal(ES.Type(false), 'Boolean', 'Type(false) is Boolean'); t.equal(ES.Type(0), 'Number', 'Type(0) is Number'); t.equal(ES.Type(NaN), 'Number', 'Type(NaN) is Number'); t.equal(ES.Type('abc'), 'String', 'Type("abc") is String'); t.equal(ES.Type(function () {}), 'Object', 'Type(function () {}) is Object'); t.equal(ES.Type({}), 'Object', 'Type({}) is Object'); t.test('symbols', { skip: !v.hasSymbols }, function (st) { st.equal(ES.Type(Symbol.iterator), 'Symbol', 'Type(Symbol.iterator) is Symbol'); st.end(); }); t.end(); }); test('ValidateAndApplyPropertyDescriptor', function (t) { forEach(v.nonUndefinedPrimitives, function (nonUndefinedPrimitive) { t['throws']( function () { ES.ValidateAndApplyPropertyDescriptor(nonUndefinedPrimitive, '', false, v.genericDescriptor(), v.genericDescriptor()); }, TypeError, 'O: ' + debug(nonUndefinedPrimitive) + ' is not undefined or an Object' ); }); forEach(v.nonBooleans, function (nonBoolean) { t['throws']( function () { return ES.ValidateAndApplyPropertyDescriptor( undefined, null, nonBoolean, v.genericDescriptor(), v.genericDescriptor() ); }, TypeError, 'extensible: ' + debug(nonBoolean) + ' is not a Boolean' ); }); forEach(v.primitives, function (primitive) { // Desc must be a Property Descriptor t['throws']( function () { return ES.ValidateAndApplyPropertyDescriptor( undefined, null, false, primitive, v.genericDescriptor() ); }, TypeError, 'Desc: ' + debug(primitive) + ' is not a Property Descriptor' ); }); forEach(v.nonUndefinedPrimitives, function (primitive) { // current must be undefined or a Property Descriptor t['throws']( function () { return ES.ValidateAndApplyPropertyDescriptor( undefined, null, false, v.genericDescriptor(), primitive ); }, TypeError, 'current: ' + debug(primitive) + ' is not a Property Descriptor or undefined' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { // if O is an object, P must be a property key t['throws']( function () { return ES.ValidateAndApplyPropertyDescriptor( {}, nonPropertyKey, false, v.genericDescriptor(), v.genericDescriptor() ); }, TypeError, 'P: ' + debug(nonPropertyKey) + ' is not a Property Key' ); }); t.test('current is undefined', function (st) { var propertyKey = 'howdy'; st.test('generic descriptor', { skip: !defineProperty.oDP }, function (s2t) { var generic = v.genericDescriptor(); generic['[[Enumerable]]'] = true; var O = {}; ES.ValidateAndApplyPropertyDescriptor(undefined, propertyKey, true, generic); s2t.equal( ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, false, generic), false, 'when extensible is false, nothing happens' ); s2t.deepEqual(O, {}, 'no changes applied when O is undefined or extensible is false'); s2t.equal( ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, true, generic), true, 'operation is successful' ); var expected = {}; expected[propertyKey] = generic['[[Value]]']; s2t.deepEqual(O, expected, 'generic descriptor has been defined as an own data property'); s2t.end(); }); st.test('data descriptor', function (s2t) { var data = v.descriptors.enumerable(v.dataDescriptor()); if (!defineProperty.oDP) { // IE 8 can't handle defining a new property with an incomplete descriptor data = v.descriptors.configurable(v.descriptors.writable(data)); } var O = {}; s2t.equal( ES.ValidateAndApplyPropertyDescriptor(undefined, propertyKey, true, data), true, 'noop when O is undefined' ); s2t.equal( ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, false, data), false, 'when extensible is false, nothing happens' ); s2t.deepEqual(O, {}, 'no changes applied when O is undefined or extensible is false'); s2t.equal( ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, true, data), true, 'operation is successful' ); var expected = {}; expected[propertyKey] = data['[[Value]]']; s2t.deepEqual(O, expected, 'data descriptor has been defined as an own data property'); s2t.end(); }); st.test('accessor descriptor', { skip: !defineProperty.oDP }, function (s2t) { var count = 0; var accessor = v.accessorDescriptor(); accessor['[[Enumerable]]'] = true; accessor['[[Get]]'] = function () { count += 1; return count; }; var O = {}; ES.ValidateAndApplyPropertyDescriptor(undefined, propertyKey, true, accessor); s2t.equal( ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, false, accessor), false, 'when extensible is false, nothing happens' ); s2t.deepEqual(O, {}, 'no changes applied when O is undefined or extensible is false'); s2t.equal( ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, true, accessor), true, 'operation is successful' ); var expected = {}; expected[propertyKey] = accessor['[[Get]]']() + 1; s2t.deepEqual(O, expected, 'accessor descriptor has been defined as an own accessor property'); s2t.end(); }); st.end(); }); t.test('every field in Desc is absent', { skip: 'it is unclear if having no fields qualifies Desc to be a Property Descriptor' }); forEach([v.dataDescriptor, v.accessorDescriptor, v.mutatorDescriptor], function (getDescriptor) { t.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, getDescriptor(), ES.CompletePropertyDescriptor(getDescriptor()) ), true, 'when Desc and current are the same, early return true' ); }); t.test('current is nonconfigurable', function (st) { // note: these must not be generic descriptors, or else the algorithm returns an early true st.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, v.descriptors.configurable(v.dataDescriptor()), ES.CompletePropertyDescriptor(v.descriptors.nonConfigurable(v.dataDescriptor())) ), false, 'false if Desc is configurable' ); st.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, v.descriptors.enumerable(v.dataDescriptor()), ES.CompletePropertyDescriptor(v.descriptors.nonEnumerable(v.dataDescriptor())) ), false, 'false if Desc is Enumerable and current is not' ); st.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, v.descriptors.nonEnumerable(v.dataDescriptor()), ES.CompletePropertyDescriptor(v.descriptors.enumerable(v.dataDescriptor())) ), false, 'false if Desc is not Enumerable and current is' ); var descLackingEnumerable = v.accessorDescriptor(); delete descLackingEnumerable['[[Enumerable]]']; st.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, descLackingEnumerable, ES.CompletePropertyDescriptor(v.descriptors.enumerable(v.accessorDescriptor())) ), true, 'not false if Desc lacks Enumerable' ); st.equal( ES.ValidateAndApplyPropertyDescriptor( {}, 'property key', true, v.descriptors.nonConfigurable(), v.descriptors.nonConfigurable(v.descriptors.enumerable(v.accessorDescriptor())) ), true, 'see https://github.com/tc39/ecma262/issues/2761' ); st.end(); }); t.test('Desc and current: one is a data descriptor, one is not', { skip: !defineProperty || !getOwnPropertyDescriptor }, function (st) { // note: Desc must be configurable if current is nonconfigurable, to hit this branch st.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, v.descriptors.configurable(v.accessorDescriptor()), ES.CompletePropertyDescriptor(v.descriptors.nonConfigurable(v.dataDescriptor())) ), false, 'false if current (data) is nonconfigurable' ); st.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, v.descriptors.configurable(v.dataDescriptor()), ES.CompletePropertyDescriptor(v.descriptors.nonConfigurable(v.accessorDescriptor())) ), false, 'false if current (not data) is nonconfigurable' ); // one is data and one is not, // // if current is data, convert to accessor // // else convert to data var startsWithData = { 'property key': 42 }; st.equal( ES.ValidateAndApplyPropertyDescriptor( startsWithData, 'property key', true, v.descriptors.enumerable(v.descriptors.configurable(v.accessorDescriptor())), ES.CompletePropertyDescriptor(v.descriptors.enumerable(v.descriptors.configurable(v.dataDescriptor()))) ), true, 'operation is successful: current is data, Desc is accessor' ); var shouldBeAccessor = getOwnPropertyDescriptor(startsWithData, 'property key'); st.equal(typeof shouldBeAccessor.get, 'function', 'has a getter'); var key = 'property key'; var startsWithAccessor = {}; defineProperty(startsWithAccessor, key, { configurable: true, enumerable: true, get: function get() { return 42; } }); st.equal( ES.ValidateAndApplyPropertyDescriptor( startsWithAccessor, key, true, v.descriptors.enumerable(v.descriptors.configurable(v.dataDescriptor())), v.descriptors.enumerable(v.descriptors.configurable(v.accessorDescriptor(42))) ), true, 'operation is successful: current is accessor, Desc is data' ); var shouldBeData = getOwnPropertyDescriptor(startsWithAccessor, 'property key'); st.deepEqual(shouldBeData, { configurable: true, enumerable: true, value: 42, writable: false }, 'is a data property'); st.end(); }); t.test('Desc and current are both data descriptors', function (st) { st.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, v.descriptors.writable(v.dataDescriptor()), ES.CompletePropertyDescriptor(v.descriptors.nonWritable(v.descriptors.nonConfigurable(v.dataDescriptor()))) ), false, 'false if frozen current and writable Desc' ); st.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, v.descriptors.configurable({ '[[Value]]': 42 }), ES.CompletePropertyDescriptor(v.descriptors.nonWritable({ '[[Value]]': 7 })) ), false, 'false if nonwritable current has a different value than Desc' ); st.end(); }); t.test('current is nonconfigurable; Desc and current are both accessor descriptors', function (st) { st.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, v.mutatorDescriptor(), ES.CompletePropertyDescriptor(v.descriptors.nonConfigurable(v.mutatorDescriptor())) ), false, 'false if both Sets are not equal' ); st.equal( ES.ValidateAndApplyPropertyDescriptor( undefined, 'property key', true, v.accessorDescriptor(), ES.CompletePropertyDescriptor(v.descriptors.nonConfigurable(v.accessorDescriptor())) ), false, 'false if both Gets are not equal' ); st.end(); }); t.end(); }); }; var es2016 = function ES2016(ES, ops, expectedMissing, skips) { es2015(ES, ops, expectedMissing, assign(assign({}, skips), { StringGetIndexProperty: true })); var test = makeTest(ES, skips); test('IterableToArrayLike', function (t) { t.test('custom iterables', { skip: !v.hasSymbols }, function (st) { var O = {}; O[Symbol.iterator] = function () { var i = -1; return { next: function () { i += 1; return { done: i >= 5, value: i }; } }; }; st.deepEqual( ES.IterableToArrayLike(O), [0, 1, 2, 3, 4], 'Symbol.iterator method is called and values collected' ); st.end(); }); t.deepEqual(ES.IterableToArrayLike('abc'), ['a', 'b', 'c'], 'a string of code units spreads'); t.deepEqual(ES.IterableToArrayLike('💩'), ['💩'], 'a string of code points spreads'); t.deepEqual(ES.IterableToArrayLike('a💩c'), ['a', '💩', 'c'], 'a string of code points and units spreads'); var arr = [1, 2, 3]; t.deepEqual(ES.IterableToArrayLike(arr), arr, 'an array becomes a similar array'); t.notEqual(ES.IterableToArrayLike(arr), arr, 'an array becomes a different, but similar, array'); var O = {}; t.equal(ES.IterableToArrayLike(O), O, 'a non-iterable non-array non-string object is returned directly'); t.end(); }); test('OrdinaryGetPrototypeOf', function (t) { t.test('values', { skip: !$getProto }, function (st) { st.equal(ES.OrdinaryGetPrototypeOf([]), Array.prototype, 'array [[Prototype]] is Array.prototype'); st.equal(ES.OrdinaryGetPrototypeOf({}), Object.prototype, 'object [[Prototype]] is Object.prototype'); st.equal(ES.OrdinaryGetPrototypeOf(/a/g), RegExp.prototype, 'regex [[Prototype]] is RegExp.prototype'); st.equal(ES.OrdinaryGetPrototypeOf(Object('')), String.prototype, 'boxed string [[Prototype]] is String.prototype'); st.equal(ES.OrdinaryGetPrototypeOf(Object(42)), Number.prototype, 'boxed number [[Prototype]] is Number.prototype'); st.equal(ES.OrdinaryGetPrototypeOf(Object(true)), Boolean.prototype, 'boxed boolean [[Prototype]] is Boolean.prototype'); if (v.hasSymbols) { st.equal(ES.OrdinaryGetPrototypeOf(Object(Symbol.iterator)), Symbol.prototype, 'boxed symbol [[Prototype]] is Symbol.prototype'); } st.end(); }); forEach(v.primitives, function (primitive) { t['throws']( function () { ES.OrdinaryGetPrototypeOf(primitive); }, TypeError, debug(primitive) + ' is not an Object' ); }); t.end(); }); test('OrdinarySetPrototypeOf', { skip: !$getProto || !$setProto }, function (t) { var a = []; var proto = {}; t.equal(ES.OrdinaryGetPrototypeOf(a), Array.prototype, 'precondition'); t.equal(ES.OrdinarySetPrototypeOf(a, proto), true, 'setting prototype is successful'); t.equal(ES.OrdinaryGetPrototypeOf(a), proto, 'postcondition'); t.end(); }); test('SameValueNonNumber', function (t) { var willThrow = [ [3, 4], [NaN, 4], [4, ''], ['abc', true], [{}, false] ]; forEach(willThrow, function (nums) { t['throws'](function () { return ES.SameValueNonNumber.apply(ES, nums); }, TypeError, 'value must be same type and non-number'); }); forEach(v.objects.concat(v.nonNumberPrimitives), function (val) { t.equal(val === val, ES.SameValueNonNumber(val, val), debug(val) + ' is SameValueNonNumber to itself'); }); t.end(); }); test('UTF16Encoding', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.UTF16Encoding(nonNumber); }, TypeError, debug(nonNumber) + ' is not a Number' ); }); t['throws']( function () { ES.UTF16Encoding(-1); }, TypeError, '-1 is < 0' ); t['throws']( function () { ES.UTF16Encoding(0x10FFFF + 1); }, TypeError, '0x10FFFF + 1 is > 0x10FFFF' ); t.equal(ES.UTF16Encoding(0xD83D), leadingPoo, '0xD83D is the first half of ' + wholePoo); t.equal(ES.UTF16Encoding(0xDCA9), trailingPoo, '0xDCA9 is the last half of ' + wholePoo); t.equal(ES.UTF16Encoding(0x1F4A9), wholePoo, '0xDCA9 is the last half of ' + wholePoo); t.end(); }); test('UTF16Decode', function (t) { t['throws']( function () { ES.UTF16Decode('a'.charCodeAt(0), trailingPoo.charCodeAt(0)); }, TypeError, '"a" is not a leading surrogate' ); t['throws']( function () { ES.UTF16Decode(leadingPoo.charCodeAt(0), 'b'.charCodeAt(0)); }, TypeError, '"b" is not a trailing surrogate' ); t.equal(ES.UTF16Decode(leadingPoo.charCodeAt(0), trailingPoo.charCodeAt(0)), wholePoo); t.end(); }); }; var es2017 = function ES2017(ES, ops, expectedMissing, skips) { es2016(ES, ops, expectedMissing, assign({}, skips, { EnumerableOwnNames: true, IterableToArrayLike: true })); var test = makeTest(ES, skips); test('EnumerableOwnProperties', function (t) { var obj = testEnumerableOwnNames(t, function (O) { return ES.EnumerableOwnProperties(O, 'key'); }); t.deepEqual( ES.EnumerableOwnProperties(obj, 'value'), [obj.own], 'returns enumerable own values' ); t.deepEqual( ES.EnumerableOwnProperties(obj, 'key+value'), [['own', obj.own]], 'returns enumerable own entries' ); t.end(); }); test('IterableToList', function (t) { var customIterator = function () { var i = -1; return { next: function () { i += 1; return { done: i >= 5, value: i }; } }; }; t.deepEqual( ES.IterableToList({}, customIterator), [0, 1, 2, 3, 4], 'iterator method is called and values collected' ); t.test('Symbol support', { skip: !v.hasSymbols }, function (st) { st.deepEqual(ES.IterableToList('abc', String.prototype[Symbol.iterator]), ['a', 'b', 'c'], 'a string of code units spreads'); st.deepEqual(ES.IterableToList('☃', String.prototype[Symbol.iterator]), ['☃'], 'a string of code points spreads'); var arr = [1, 2, 3]; st.deepEqual(ES.IterableToList(arr, arr[Symbol.iterator]), arr, 'an array becomes a similar array'); st.notEqual(ES.IterableToList(arr, arr[Symbol.iterator]), arr, 'an array becomes a different, but similar, array'); st.end(); }); t['throws']( function () { ES.IterableToList({}, void 0); }, TypeError, 'non-function iterator method' ); t.end(); }); test('OrdinaryToPrimitive', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.OrdinaryToPrimitive(primitive, 'string'); }, TypeError, debug(primitive) + ' is not Object' ); if (primitive != null) { t.equal( ES.OrdinaryToPrimitive(Object(primitive), 'number'), primitive, debug(Object(primitive)) + ' becomes ' + debug(primitive) ); } }); t.test('Symbols', { skip: !v.hasSymbols }, function (st) { forEach(v.symbols, function (sym) { st.equal( ES.OrdinaryToPrimitive(Object(sym), 'string'), Symbol.prototype.toString.call(sym), debug(Object(sym)) + ' with hint "string" returns ' + debug(Symbol.prototype.toString.call(sym)) ); st.equal( ES.OrdinaryToPrimitive(Object(sym), 'number'), sym, debug(Object(sym)) + ' with hint "number" returns ' + debug(sym) ); }); var primitiveSym = Symbol('primitiveSym'); var objectSym = Object(primitiveSym); st.equal( ES.OrdinaryToPrimitive(objectSym, 'string'), Symbol.prototype.toString.call(primitiveSym), debug(objectSym) + ' with hint "string" returns ' + debug(Symbol.prototype.toString.call(primitiveSym)) ); st.equal( ES.OrdinaryToPrimitive(objectSym, 'number'), primitiveSym, debug(objectSym) + ' with hint "number" returns ' + debug(primitiveSym) ); st.end(); }); t.test('Arrays', function (st) { var arrays = [[], ['a', 'b'], [1, 2]]; forEach(arrays, function (arr) { st.equal(ES.OrdinaryToPrimitive(arr, 'string'), String(arr), debug(arr) + ' with hint "string" returns the string version of the array'); st.equal(ES.OrdinaryToPrimitive(arr, 'number'), String(arr), debug(arr) + ' with hint "number" returns the string version of the array'); }); st.end(); }); t.test('Dates', function (st) { var dates = [new Date(), new Date(0), new Date(NaN)]; forEach(dates, function (date) { st.equal(ES.OrdinaryToPrimitive(date, 'string'), String(date), debug(date) + ' with hint "string" returns the string version of the date'); st.equal(ES.OrdinaryToPrimitive(date, 'number'), Number(date), debug(date) + ' with hint "number" returns the number version of the date'); }); st.end(); }); t.test('Objects', function (st) { st.equal(ES.OrdinaryToPrimitive(v.coercibleObject, 'number'), v.coercibleObject.valueOf(), 'coercibleObject with hint "number" coerces to valueOf'); st.equal(ES.OrdinaryToPrimitive(v.coercibleObject, 'string'), v.coercibleObject.toString(), 'coercibleObject with hint "string" coerces to non-stringified toString'); st.equal(ES.OrdinaryToPrimitive(v.coercibleFnObject, 'number'), v.coercibleFnObject.toString(), 'coercibleFnObject with hint "number" coerces to non-stringified toString'); st.equal(ES.OrdinaryToPrimitive(v.coercibleFnObject, 'string'), v.coercibleFnObject.toString(), 'coercibleFnObject with hint "string" coerces to non-stringified toString'); st.equal(ES.OrdinaryToPrimitive({}, 'number'), '[object Object]', '{} with hint "number" coerces to Object#toString'); st.equal(ES.OrdinaryToPrimitive({}, 'string'), '[object Object]', '{} with hint "string" coerces to Object#toString'); st.equal(ES.OrdinaryToPrimitive(v.toStringOnlyObject, 'number'), v.toStringOnlyObject.toString(), 'toStringOnlyObject with hint "number" returns non-stringified toString'); st.equal(ES.OrdinaryToPrimitive(v.toStringOnlyObject, 'string'), v.toStringOnlyObject.toString(), 'toStringOnlyObject with hint "string" returns non-stringified toString'); st.equal(ES.OrdinaryToPrimitive(v.valueOfOnlyObject, 'number'), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint "number" returns valueOf'); st.equal(ES.OrdinaryToPrimitive(v.valueOfOnlyObject, 'string'), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint "string" returns non-stringified valueOf'); st.test('exceptions', function (s2t) { s2t['throws'](function () { ES.OrdinaryToPrimitive.call(null, v.uncoercibleObject, 'number'); }, TypeError, 'uncoercibleObject with hint "number" throws a TypeError'); s2t['throws'](function () { ES.OrdinaryToPrimitive.call(null, v.uncoercibleObject, 'string'); }, TypeError, 'uncoercibleObject with hint "string" throws a TypeError'); s2t['throws'](function () { ES.OrdinaryToPrimitive.call(null, v.uncoercibleFnObject, 'number'); }, TypeError, 'uncoercibleFnObject with hint "number" throws a TypeError'); s2t['throws'](function () { ES.OrdinaryToPrimitive.call(null, v.uncoercibleFnObject, 'string'); }, TypeError, 'uncoercibleFnObject with hint "string" throws a TypeError'); s2t.end(); }); st.end(); }); t.end(); }); test('StringGetOwnProperty', function (t) { forEach(v.nonStrings.concat(v.strings), function (nonBoxedString) { t['throws']( function () { ES.StringGetOwnProperty(nonBoxedString, '0'); }, TypeError, debug(nonBoxedString) + ' is not a boxed String' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.StringGetOwnProperty(Object(''), nonPropertyKey); }, TypeError, debug(nonPropertyKey) + ' is not a Property Key' ); }); t.equal(ES.StringGetOwnProperty(Object(''), '0'), undefined, 'empty boxed string yields undefined'); forEach(v.strings, function (string) { if (string) { var S = Object(string); for (var i = 0; i < string.length; i += 1) { var descriptor = ES.StringGetOwnProperty(S, String(i)); t.deepEqual( descriptor, { '[[Configurable]]': false, '[[Enumerable]]': true, '[[Value]]': string.charAt(i), '[[Writable]]': false }, debug(string) + ': property ' + debug(String(i)) + ': returns expected descriptor' ); } } }); t.end(); }); test('ToIndex', function (t) { t.equal(ES.ToIndex(), 0, 'no value gives +0'); t.equal(ES.ToIndex(undefined), 0, 'undefined value gives +0'); t.equal(ES.ToIndex(-0), 0, '-0 gives +0'); t['throws'](function () { ES.ToIndex(-1); }, RangeError, 'negative numbers throw'); t['throws'](function () { ES.ToIndex(MAX_SAFE_INTEGER + 1); }, RangeError, 'too large numbers throw'); t.equal(ES.ToIndex(3), 3, 'numbers work'); t.equal(ES.ToIndex(v.valueOfOnlyObject), 4, 'coercible objects are coerced'); t.end(); }); test('IsSharedArrayBuffer', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.IsSharedArrayBuffer(primitive); }, TypeError, debug(primitive) + ' is not an Object' ); }); forEach(v.objects, function (nonSAB) { t.equal(ES.IsSharedArrayBuffer(nonSAB), false, debug(nonSAB) + ' is not a SharedArrayBuffer'); }); t.test('real SABs', { skip: typeof SharedArrayBuffer !== 'function' }, function (st) { var sab = new SharedArrayBuffer(); st.equal(ES.IsSharedArrayBuffer(sab), true, debug(sab) + ' is a SharedArrayBuffer'); st.end(); }); t.end(); }); }; var es2018 = function ES2018(ES, ops, expectedMissing, skips) { es2017(ES, ops, expectedMissing, assign({}, skips, { EnumerableOwnProperties: true, GetSubstitution: true, IsPropertyDescriptor: true })); var test = makeTest(ES, skips); test('Abstract Relational Comparison', function (t) { forEach(v.bigints, function (bigint) { t.equal( ES['Abstract Relational Comparison'](bigint, bigint + BigInt(1), false), true, debug(bigint) + ' is less than the same + 1n' ); t.equal( ES['Abstract Relational Comparison'](bigint, bigint - BigInt(1), false), false, debug(bigint) + ' is not less than the same - 1n' ); t.equal( ES['Abstract Relational Comparison'](bigint, -Infinity, false), false, debug(bigint) + ' is not less than -∞' ); t.equal( ES['Abstract Relational Comparison'](-Infinity, bigint, false), true, '-∞ is less than ' + debug(bigint) ); t.equal( ES['Abstract Relational Comparison'](bigint, Infinity, false), true, debug(bigint) + ' is less than ∞' ); t.equal( ES['Abstract Relational Comparison'](Infinity, bigint, false), false, '∞ is not less than ' + debug(bigint) ); }); t.end(); }); test('CopyDataProperties', function (t) { t.test('first argument: target', function (st) { forEach(v.primitives, function (primitive) { st['throws']( function () { ES.CopyDataProperties(primitive, {}, []); }, TypeError, debug(primitive) + ' is not an Object' ); }); st.end(); }); t.test('second argument: source', function (st) { var frozenTarget = Object.freeze ? Object.freeze({}) : {}; forEach(v.nullPrimitives, function (nullish) { st.equal( ES.CopyDataProperties(frozenTarget, nullish, []), frozenTarget, debug(nullish) + ' "source" yields identical, unmodified target' ); }); forEach(v.nonNullPrimitives, function (objectCoercible) { var target = {}; var result = ES.CopyDataProperties(target, objectCoercible, []); st.equal(result, target, 'result === target'); st.deepEqual(keys(result), keys(Object(objectCoercible)), 'target ends up with keys of ' + debug(objectCoercible)); }); st.test('enumerable accessor property', { skip: !defineProperty.oDP }, function (s2t) { var target = {}; var source = {}; defineProperty(source, 'a', { enumerable: true, get: function () { return 42; } }); var result = ES.CopyDataProperties(target, source, []); s2t.equal(result, target, 'result === target'); s2t.deepEqual(result, { a: 42 }, 'target ends up with enumerable accessor of source'); s2t.end(); }); st.end(); }); t.test('third argument: excludedItems', function (st) { forEach(v.objects.concat(v.primitives), function (nonArray) { st['throws']( function () { ES.CopyDataProperties({}, {}, nonArray); }, TypeError, debug(nonArray) + ' is not an Array' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { st['throws']( function () { ES.CopyDataProperties({}, {}, [nonPropertyKey]); }, TypeError, debug(nonPropertyKey) + ' is not a Property Key' ); }); var result = ES.CopyDataProperties({}, { a: 1, b: 2, c: 3 }, ['b']); st.deepEqual(keys(result).sort(), ['a', 'c'].sort(), 'excluded string keys are excluded'); st.test('excluding symbols', { skip: !v.hasSymbols }, function (s2t) { var source = {}; forEach(v.symbols, function (symbol) { source[symbol] = true; }); var includedSymbols = v.symbols.slice(1); var excludedSymbols = v.symbols.slice(0, 1); var target = ES.CopyDataProperties({}, source, excludedSymbols); forEach(includedSymbols, function (symbol) { s2t.equal(has(target, symbol), true, debug(symbol) + ' is included'); }); forEach(excludedSymbols, function (symbol) { s2t.equal(has(target, symbol), false, debug(symbol) + ' is excluded'); }); s2t.end(); }); st.end(); }); // TODO: CopyDataProperties does not throw when copying fails t.end(); }); test('DateString', function (t) { forEach(v.nonNumbers.concat(NaN), function (nonNumberOrNaN) { t['throws']( function () { ES.DateString(nonNumberOrNaN); }, TypeError, debug(nonNumberOrNaN) + ' is not a non-NaN Number' ); }); t.equal(ES.DateString(Date.UTC(2019, 8, 10, 7, 8, 9)), 'Tue Sep 10 2019'); t.equal(ES.DateString(Date.UTC(2016, 1, 29, 7, 8, 9)), 'Mon Feb 29 2016'); // leap day t.end(); }); test('EnumerableOwnPropertyNames', function (t) { var obj = testEnumerableOwnNames(t, function (O) { return ES.EnumerableOwnPropertyNames(O, 'key'); }); t.deepEqual( ES.EnumerableOwnPropertyNames(obj, 'value'), [obj.own], 'returns enumerable own values' ); t.deepEqual( ES.EnumerableOwnPropertyNames(obj, 'key+value'), [['own', obj.own]], 'returns enumerable own entries' ); t.end(); }); test('GetSubstitution', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.GetSubstitution(nonString, '', 0, [], undefined, ''); }, TypeError, '`matched`: ' + debug(nonString) + ' is not a String' ); t['throws']( function () { ES.GetSubstitution('', nonString, 0, [], undefined, ''); }, TypeError, '`str`: ' + debug(nonString) + ' is not a String' ); t['throws']( function () { ES.GetSubstitution('', '', 0, [], undefined, nonString); }, TypeError, '`replacement`: ' + debug(nonString) + ' is not a String' ); if (canDistinguishSparseFromUndefined || typeof nonString !== 'undefined') { t['throws']( function () { ES.GetSubstitution('', '', 0, [nonString], undefined, ''); }, TypeError, '`captures`: ' + debug([nonString]) + ' is not an Array of strings' ); } }); forEach(v.notNonNegativeIntegers, function (nonNonNegativeInteger) { t['throws']( function () { ES.GetSubstitution('', '', nonNonNegativeInteger, [], undefined, ''); }, TypeError, '`position`: ' + debug(nonNonNegativeInteger) + ' is not a non-negative integer' ); }); forEach(v.nonArrays, function (nonArray) { t['throws']( function () { ES.GetSubstitution('', '', 0, nonArray, undefined, ''); }, TypeError, '`captures`: ' + debug(nonArray) + ' is not an Array' ); }); t.equal( ES.GetSubstitution('def', 'abcdefghi', 3, [], undefined, '123'), '123', 'returns the substitution' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '$$2$'), '$2$', 'supports $$, and trailing $' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$&<'), '>abcdef<', 'supports $&' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$`<'), '><', 'supports $` at position 0' ); t.equal( ES.GetSubstitution('def', 'abcdefghi', 3, [], undefined, '>$`<'), '>ab<', 'supports $` at position > 0' ); t.equal( ES.GetSubstitution('def', 'abcdefghi', 7, [], undefined, ">$'<"), '><', "supports $' at a position where there's less than `matched.length` chars left" ); t.equal( ES.GetSubstitution('def', 'abcdefghi', 3, [], undefined, ">$'<"), '>ghi<', "supports $' at a position where there's more than `matched.length` chars left" ); for (var i = 0; i < 100; i += 1) { var captures = []; captures[i] = 'test'; if (i > 0) { t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$' + i + '<'), '>undefined<', 'supports $' + i + ' with no captures' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$' + i), '>undefined', 'supports $' + i + ' at the end of the replacement, with no captures' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, undefined, '>$' + i + '<'), '><', 'supports $' + i + ' with a capture at that index' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, undefined, '>$' + i), '>', 'supports $' + i + ' at the end of the replacement, with a capture at that index' ); } if (i < 10) { t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$0' + i + '<'), i === 0 ? '><' : '>undefined<', 'supports $0' + i + ' with no captures' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$0' + i), i === 0 ? '>' : '>undefined', 'supports $0' + i + ' at the end of the replacement, with no captures' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, undefined, '>$0' + i + '<'), '><', 'supports $0' + i + ' with a capture at that index' ); t.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, undefined, '>$0' + i), '>', 'supports $0' + i + ' at the end of the replacement, with a capture at that index' ); } } t.test('named captures', function (st) { var namedCaptures = { foo: 'foo!' }; st.equal( ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, namedCaptures, 'a>$foo!> bitsN, debug(bigInt32) + ' >> ' + debug(bitsN) + ' is ' + debug(bigInt32 >> bitsN) ); }); }); t.end(); }); test('BigInt::subtract', { skip: !hasBigInts }, function (t) { forEach(v.nonBigInts, function (nonBigInt) { t['throws']( function () { ES.BigInt.subtract(nonBigInt, $BigInt(0)); }, TypeError, 'x: ' + debug(nonBigInt) + ' is not a BigInt' ); t['throws']( function () { ES.BigInt.subtract($BigInt(0), nonBigInt); }, TypeError, 'y: ' + debug(nonBigInt) + ' is not a BigInt' ); }); t.equal(ES.BigInt.subtract($BigInt(0), $BigInt(0)), $BigInt(0), '0n - 0n is 0n'); forEach(v.bigints, function (bigint) { t.equal(ES.BigInt.subtract(bigint, $BigInt(0)), bigint, debug(bigint) + ' - 0n produces ' + bigint); t.equal(ES.BigInt.subtract(bigint, $BigInt(1)), bigint - $BigInt(1), debug(bigint) + ' - 1n produces ' + (bigint + $BigInt(1))); t.equal(ES.BigInt.subtract(bigint, $BigInt(42)), bigint - $BigInt(42), debug(bigint) + ' - 42n produces ' + (bigint - $BigInt(42))); }); t.end(); }); test('BigInt::toString', function (t) { forEach(v.nonBigInts, function (nonBigInt) { t['throws']( function () { ES.BigInt.toString(nonBigInt); }, TypeError, debug(nonBigInt) + ' is not a BigInt' ); }); forEach(v.bigints, function (bigint) { t.equal(ES.BigInt.toString(bigint), String(bigint), debug(bigint) + ' stringifies to ' + bigint); }); t.end(); }); test('BigInt::unaryMinus', function (t) { forEach(v.nonBigInts, function (nonBigInt) { t['throws']( function () { ES.BigInt.unaryMinus(nonBigInt); }, TypeError, debug(nonBigInt) + ' is not a BigInt' ); }); t.test('actual BigInts', { skip: !hasBigInts }, function (st) { forEach(v.bigints, function (bigint) { st.equal(ES.BigInt.unaryMinus(bigint), -bigint, debug(bigint) + ' produces -' + debug(bigint)); }); st.end(); }); t.end(); }); test('BigInt::unsignedRightShift', { skip: !hasBigInts }, function (t) { forEach(v.nonBigInts, function (nonBigInt) { t['throws']( function () { ES.BigInt.unsignedRightShift(nonBigInt, $BigInt(0)); }, TypeError, 'x: ' + debug(nonBigInt) + ' is not a BigInt' ); t['throws']( function () { ES.BigInt.unsignedRightShift($BigInt(0), nonBigInt); }, TypeError, 'y: ' + debug(nonBigInt) + ' is not a BigInt' ); }); forEach([0].concat(v.int32s), function (int32) { var bigInt32 = $BigInt(int32); forEach([1, 3, 5, 31, 32, 33], function (bits) { var bitsN = $BigInt(bits); t['throws']( function () { ES.BigInt.unsignedRightShift(bigInt32, bitsN); }, TypeError, debug(bigInt32) + ' >>> ' + debug(bitsN) + ' throws' ); }); }); t.end(); }); test('BigIntBitwiseOp', { skip: !hasBigInts }, function (t) { t['throws']( function () { ES.BigIntBitwiseOp('invalid', BigInt(0), BigInt(0)); }, TypeError, 'throws with an invalid op' ); t.equal(ES.BigIntBitwiseOp('&', BigInt(1), BigInt(2)), BigInt(1) & BigInt(2)); t.equal(ES.BigIntBitwiseOp('|', BigInt(1), BigInt(2)), BigInt(1) | BigInt(2)); t.equal(ES.BigIntBitwiseOp('^', BigInt(1), BigInt(2)), BigInt(1) ^ BigInt(2)); t.end(); }); test('BinaryAnd', function (t) { t.equal(ES.BinaryAnd(0, 0), 0); t.equal(ES.BinaryAnd(0, 1), 0); t.equal(ES.BinaryAnd(1, 0), 0); t.equal(ES.BinaryAnd(1, 1), 1); forEach(v.nonIntegerNumbers.concat(v.nonNumberPrimitives, v.objects), function (nonBit) { t['throws']( function () { ES.BinaryAnd(0, nonBit); }, TypeError ); t['throws']( function () { ES.BinaryAnd(nonBit, 1); }, TypeError ); }); t.end(); }); test('BinaryOr', function (t) { t.equal(ES.BinaryOr(0, 0), 0); t.equal(ES.BinaryOr(0, 1), 1); t.equal(ES.BinaryOr(1, 0), 1); t.equal(ES.BinaryOr(1, 1), 1); forEach(v.nonIntegerNumbers.concat(v.nonNumberPrimitives, v.objects), function (nonBit) { t['throws']( function () { ES.BinaryOr(0, nonBit); }, TypeError ); t['throws']( function () { ES.BinaryOr(nonBit, 1); }, TypeError ); }); t.end(); }); test('BinaryXor', function (t) { t.equal(ES.BinaryXor(0, 0), 0); t.equal(ES.BinaryXor(0, 1), 1); t.equal(ES.BinaryXor(1, 0), 1); t.equal(ES.BinaryXor(1, 1), 0); forEach(v.nonIntegerNumbers.concat(v.nonNumberPrimitives, v.objects), function (nonBit) { t['throws']( function () { ES.BinaryXor(0, nonBit); }, TypeError ); t['throws']( function () { ES.BinaryXor(nonBit, 1); }, TypeError ); }); t.end(); }); test('CodePointAt', function (t) { t['throws']( function () { ES.CodePointAt('abc', -1); }, TypeError, 'requires an index >= 0' ); t['throws']( function () { ES.CodePointAt('abc', 3); }, TypeError, 'requires an index < string length' ); t.deepEqual(ES.CodePointAt('abc', 0), { '[[CodePoint]]': 'a', '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': false }); t.deepEqual(ES.CodePointAt('abc', 1), { '[[CodePoint]]': 'b', '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': false }); t.deepEqual(ES.CodePointAt('abc', 2), { '[[CodePoint]]': 'c', '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': false }); var strWithHalfPoo = 'a' + leadingPoo + 'c'; var strWithWholePoo = 'a' + wholePoo + 'd'; t.deepEqual(ES.CodePointAt(strWithHalfPoo, 0), { '[[CodePoint]]': 'a', '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': false }); t.deepEqual(ES.CodePointAt(strWithHalfPoo, 1), { '[[CodePoint]]': leadingPoo, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': true }); t.deepEqual(ES.CodePointAt(strWithHalfPoo, 2), { '[[CodePoint]]': 'c', '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': false }); t.deepEqual(ES.CodePointAt(strWithWholePoo, 0), { '[[CodePoint]]': 'a', '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': false }); t.deepEqual(ES.CodePointAt(strWithWholePoo, 1), { '[[CodePoint]]': wholePoo, '[[CodeUnitCount]]': 2, '[[IsUnpairedSurrogate]]': false }); t.deepEqual(ES.CodePointAt(strWithWholePoo, 2), { '[[CodePoint]]': trailingPoo, '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': true }); t.deepEqual(ES.CodePointAt(strWithWholePoo, 3), { '[[CodePoint]]': 'd', '[[CodeUnitCount]]': 1, '[[IsUnpairedSurrogate]]': false }); t.end(); }); test('CopyDataProperties', function (t) { t.test('first argument: target', function (st) { forEach(v.primitives, function (primitive) { st['throws']( function () { ES.CopyDataProperties(primitive, {}, []); }, TypeError, debug(primitive) + ' is not an Object' ); }); st.end(); }); t.test('second argument: source', function (st) { var frozenTarget = Object.freeze ? Object.freeze({}) : {}; forEach(v.nullPrimitives, function (nullish) { st.equal( ES.CopyDataProperties(frozenTarget, nullish, []), frozenTarget, debug(nullish) + ' "source" yields identical, unmodified target' ); }); forEach(v.nonNullPrimitives, function (objectCoercible) { var target = {}; var result = ES.CopyDataProperties(target, objectCoercible, []); st.equal(result, target, 'result === target'); st.deepEqual(keys(result), keys(Object(objectCoercible)), 'target ends up with keys of ' + debug(objectCoercible)); }); st.test('enumerable accessor property', { skip: !defineProperty.oDP }, function (s2t) { var target = {}; var source = {}; defineProperty(source, 'a', { enumerable: true, get: function () { return 42; } }); var result = ES.CopyDataProperties(target, source, []); s2t.equal(result, target, 'result === target'); s2t.deepEqual(result, { a: 42 }, 'target ends up with enumerable accessor of source'); s2t.end(); }); st.end(); }); t.test('third argument: excludedItems', function (st) { forEach(v.objects.concat(v.primitives), function (nonArray) { st['throws']( function () { ES.CopyDataProperties({}, {}, nonArray); }, TypeError, debug(nonArray) + ' is not an Array' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { st['throws']( function () { ES.CopyDataProperties({}, {}, [nonPropertyKey]); }, TypeError, debug(nonPropertyKey) + ' is not a Property Key' ); }); var result = ES.CopyDataProperties({}, { a: 1, b: 2, c: 3 }, ['b']); st.deepEqual(keys(result).sort(), ['a', 'c'].sort(), 'excluded string keys are excluded'); st.test('excluding symbols', { skip: !v.hasSymbols }, function (s2t) { var source = {}; forEach(v.symbols, function (symbol) { source[symbol] = true; }); var includedSymbols = v.symbols.slice(1); var excludedSymbols = v.symbols.slice(0, 1); var target = ES.CopyDataProperties({}, source, excludedSymbols); forEach(includedSymbols, function (symbol) { s2t.equal(has(target, symbol), true, debug(symbol) + ' is included'); }); forEach(excludedSymbols, function (symbol) { s2t.equal(has(target, symbol), false, debug(symbol) + ' is excluded'); }); s2t.end(); }); st.end(); }); // TODO: CopyDataProperties throws when copying fails t.end(); }); test('CreateRegExpStringIterator', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.CreateRegExpStringIterator({}, nonString, false, false); }, TypeError, debug(nonString) + ' is not a String' ); }); forEach(v.nonBooleans, function (nonBoolean) { t['throws']( function () { ES.CreateRegExpStringIterator({}, '', nonBoolean, false); }, TypeError, debug(nonBoolean) + ' is not a String (`global`)' ); t['throws']( function () { ES.CreateRegExpStringIterator({}, '', false, nonBoolean); }, TypeError, debug(nonBoolean) + ' is not a String (`fullUnicode`)' ); }); t.test('`global` matches `g` flag', function (st) { st.test('non-global regex', function (s2t) { var regex = /a/; var str = 'abcabc'; var expected = [ assign(['a'], kludgeMatch(regex, { index: 0, input: str, lastIndex: 1 })) ]; testRESIterator(ES, s2t, regex, str, false, false, expected); s2t.end(); }); st.test('non-global unicode regex', { skip: !('unicode' in RegExp.prototype) }, function (s2t) { var regex = new RegExp(wholePoo, 'u'); var str = 'a' + wholePoo + 'ca' + wholePoo + 'c'; var expected = [ assign([wholePoo], kludgeMatch(regex, { index: 1, input: str, lastIndex: 1 })) ]; testRESIterator(ES, s2t, regex, str, false, true, expected); s2t.end(); }); st.test('global regex', function (s2t) { var regex = /a/g; var str = 'abcabc'; var expected = [ assign(['a'], kludgeMatch(regex, { index: 0, input: str, lastIndex: 1 })), assign(['a'], kludgeMatch(regex, { index: 3, input: str, lastIndex: 4 })) ]; testRESIterator(ES, s2t, regex, str, true, false, expected); s2t.end(); }); st.test('global unicode regex', { skip: !('unicode' in RegExp.prototype) }, function (s2t) { var regex = new RegExp(wholePoo, 'gu'); var str = 'a' + wholePoo + 'ca' + wholePoo + 'c'; var expected = [ assign([wholePoo], kludgeMatch(regex, { index: 1, input: str })), assign([wholePoo], kludgeMatch(regex, { index: 5, input: str })) ]; testRESIterator(ES, s2t, regex, str, true, true, expected); s2t.end(); }); st.end(); }); // these tests are technically allowed by the AO, but the spec never causes them to happen t.test('`global` does not match `g` flag', { skip: true }, function (st) { st.test('non-global regex', function (s2t) { var regex = /a/; var str = 'abcabc'; var expected = [ assign(['a'], kludgeMatch(regex, { index: 0, input: str })) ]; testRESIterator(ES, s2t, regex, str, true, false, expected); s2t.end(); }); st.test('non-global unicode regex', { skip: !('unicode' in RegExp.prototype) }, function (s2t) { var regex = new RegExp(wholePoo, 'u'); var str = 'a' + wholePoo + 'ca' + wholePoo + 'c'; var expected = [ assign([wholePoo], kludgeMatch(regex, { index: 1, input: str })) ]; testRESIterator(ES, s2t, regex, str, true, true, expected); s2t.end(); }); st.test('global regex', function (s2t) { var regex = /a/g; var str = 'abcabc'; var expected = [ assign(['a'], kludgeMatch(regex, { index: 0, input: str })), assign(['a'], kludgeMatch(regex, { index: 3, input: str })) ]; testRESIterator(ES, s2t, regex, str, false, false, expected); s2t.end(); }); st.test('global unicode regex', { skip: !('unicode' in RegExp.prototype) }, function (s2t) { var regex = new RegExp(wholePoo, 'gu'); var str = 'a' + wholePoo + 'ca' + wholePoo + 'c'; var expected = [ assign([wholePoo], kludgeMatch(regex, { index: 1, input: str })), assign([wholePoo], kludgeMatch(regex, { index: 5, input: str })) ]; testRESIterator(ES, s2t, regex, str, false, true, expected); s2t.end(); }); st.end(); }); var iterator = ES.CreateRegExpStringIterator(/a/, '', false, false); t.deepEqual(keys(iterator), [], 'iterator has no enumerable keys'); if (defineProperty.oDP) { for (var key in iterator) { // eslint-disable-line no-restricted-syntax t.fail(debug(key) + ' should not be an enumerable key'); } } t.end(); }); test('GetIterator', function (t) { try { ES.GetIterator({}, null); } catch (e) { t.ok(e.message.indexOf('Assertion failed: `hint` must be one of \'sync\' or \'async\'' >= 0)); } var arr = [1, 2]; testIterator(t, ES.GetIterator(arr), arr); testIterator(t, ES.GetIterator('abc'), 'abc'.split('')); t.test('Symbol.iterator', { skip: !v.hasSymbols }, function (st) { var m = new Map(); m.set(1, 'a'); m.set(2, 'b'); testIterator(st, ES.GetIterator(m), [[1, 'a'], [2, 'b']]); st.end(); }); t.test('Symbol.asyncIterator', { skip: !v.hasSymbols || !Symbol.asyncIterator }, function (st) { try { ES.GetIterator(arr, 'async'); } catch (e) { st.ok(e.message.indexOf("async from sync iterators aren't currently supported") >= 0); } var it = { next: function () { return Promise.resolve({ done: true }); } }; var obj = {}; obj[Symbol.asyncIterator] = function () { return it; }; st.equal(ES.GetIterator(obj, 'async'), it); st.end(); }); t.end(); }); var unclampedUnsignedIntegerTypes = [ 'Int8', 'Int16', 'Int32' ]; var clampedTypes = [ 'Uint8C' ]; var unclampedSignedIntegerTypes = [ 'Uint8', 'Uint16', 'Uint32' ]; var unclampedIntegerTypes = unclampedUnsignedIntegerTypes.concat(unclampedSignedIntegerTypes); var floatTypes = [ 'Float32', 'Float64' ]; var integerTypes = unclampedIntegerTypes.concat(clampedTypes, floatTypes); var bigIntTypes = [ 'BigInt64', 'BigUint64' ]; var numberTypes = floatTypes.concat(integerTypes); var nonIntegerTypes = floatTypes.concat(bigIntTypes); var unsignedElementTypes = unclampedSignedIntegerTypes.concat([ 'BigUint64' ]); var signedElementTypes = unclampedUnsignedIntegerTypes; test('IsBigIntElementType', function (t) { forEach(bigIntTypes, function (type) { t.equal( ES.IsBigIntElementType(type), true, debug(type) + ' is a BigInt element type' ); }); forEach(numberTypes, function (type) { t.equal( ES.IsBigIntElementType(type), false, debug(type) + ' is not a BigInt element type' ); }); t.end(); }); test('IsUnsignedElementType', function (t) { forEach(unsignedElementTypes, function (type) { t.equal( ES.IsUnsignedElementType(type), true, debug(type) + ' is an unsigned element type' ); }); forEach(signedElementTypes, function (type) { t.equal( ES.IsUnsignedElementType(type), false, debug(type) + ' is not an unsigned element type' ); }); t.end(); }); test('IsUnclampedIntegerElementType', function (t) { forEach(unclampedIntegerTypes, function (type) { t.equal( ES.IsUnclampedIntegerElementType(type), true, debug(type) + ' is an unclamped integer element type' ); }); forEach(clampedTypes.concat(nonIntegerTypes), function (type) { t.equal( ES.IsUnclampedIntegerElementType(type), false, debug(type) + ' is not an unclamped integer element type' ); }); t.end(); }); test('IsNonNegativeInteger', function (t) { forEach(v.notNonNegativeIntegers, function (nonIntegerNumber) { t.equal( ES.IsNonNegativeInteger(nonIntegerNumber), false, debug(nonIntegerNumber) + ' is not a non-negative integer' ); }); forEach(v.zeroes.concat(v.integerNumbers), function (nonNegativeInteger) { t.equal( ES.IsNonNegativeInteger(nonNegativeInteger), true, debug(nonNegativeInteger) + ' is a non-negative integer' ); }); t.end(); }); test('IsNoTearConfiguration', function (t) { forEach(unclampedIntegerTypes, function (type) { t.equal( ES.IsNoTearConfiguration(type), true, debug(type) + ' with any order is a no-tear configuration' ); }); forEach(bigIntTypes, function (type) { t.equal( ES.IsNoTearConfiguration(type, 'Init'), false, debug(type) + ' with ' + debug('Init') + ' is not a no-tear configuration' ); t.equal( ES.IsNoTearConfiguration(type, 'Unordered'), false, debug(type) + ' with ' + debug('Unordered') + ' is not a no-tear configuration' ); t.equal( ES.IsNoTearConfiguration(type), true, debug(type) + ' with any other order is a no-tear configuration' ); }); forEach(clampedTypes, function (type) { t.equal( ES.IsNoTearConfiguration(type), false, debug(type) + ' with any order is not a no-tear configuration' ); }); t.end(); }); test('LengthOfArrayLike', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.LengthOfArrayLike(primitive); }, TypeError, debug(primitive) + ' is not an Object' ); }); t.equal(ES.LengthOfArrayLike([]), 0); t.equal(ES.LengthOfArrayLike([1]), 1); t.equal(ES.LengthOfArrayLike({ length: 42 }), 42); t.end(); }); test('Number::add', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.add(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.add(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.add(+Infinity, +Infinity), +Infinity, '+∞ + +∞ is +∞'); t.equal(ES.Number.add(-Infinity, -Infinity), -Infinity, '-∞ + -∞ is -∞'); t.equal(ES.Number.add(+Infinity, -Infinity), NaN, '+∞ + -∞ is NaN'); t.equal(ES.Number.add(-Infinity, +Infinity), NaN, '-∞ + +∞ is NaN'); t.equal(ES.Number.add(+0, +0), +0, '0 + 0 is +0'); t.equal(ES.Number.add(+0, -0), +0, '0 + -0 is +0'); t.equal(ES.Number.add(-0, +0), +0, '-0 + 0 is +0'); t.equal(ES.Number.add(-0, -0), -0, '-0 + -0 is -0'); forEach(v.numbers, function (number) { if (number !== 0) { t.equal(ES.Number.add(number, 0), number, debug(number) + ' + 0 adds to ' + number); } t.equal(ES.Number.add(number, 1), number + 1, debug(number) + ' + 1 adds to ' + (number + 1)); t.equal(ES.Number.add(1, number), number + 1, '1 + ' + debug(number) + ' adds to ' + (number + 1)); t.equal(ES.Number.add(number, -42), number - 42, debug(number) + ' + -42 adds to ' + (number - 42)); t.equal(ES.Number.add(-42, number), number - 42, '-42 + ' + debug(number) + ' adds to ' + (number - 42)); }); t.end(); }); test('Number::bitwiseAND', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.bitwiseAND(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.bitwiseAND(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.bitwiseAND(1, 2), 1 & 2); t.end(); }); test('Number::bitwiseNOT', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.bitwiseNOT(nonNumber); }, TypeError, debug(nonNumber) + ' is not a Number' ); }); forEach(v.int32s, function (int32) { t.equal(ES.Number.bitwiseNOT(int32), ~int32, debug(int32) + ' becomes ~' + debug(int32)); }); t.end(); }); test('Number::bitwiseOR', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.bitwiseOR(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.bitwiseOR(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.bitwiseOR(1, 2), 1 | 2); t.end(); }); test('Number::bitwiseXOR', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.bitwiseXOR(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.bitwiseXOR(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.bitwiseXOR(1, 2), 1 ^ 2); t.end(); }); test('Number::divide', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.divide(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.divide(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.divide(Infinity, Infinity), NaN, '∞ / ∞ is NaN'); t.equal(ES.Number.divide(-Infinity, Infinity), NaN, '-∞ / ∞ is NaN'); t.equal(ES.Number.divide(Infinity, -Infinity), NaN, '∞ / -∞ is NaN'); t.equal(ES.Number.divide(-Infinity, -Infinity), NaN, '-∞ / -∞ is NaN'); t.equal(ES.Number.divide(NaN, NaN), NaN, 'NaN / NaN is NaN'); t.equal(ES.Number.divide(+Infinity, +0), +Infinity, '+∞ / +0 is +∞'); t.equal(ES.Number.divide(-Infinity, -0), +Infinity, '-∞ / -0 is +∞'); t.equal(ES.Number.divide(+Infinity, -0), -Infinity, '+∞ / -0 is -∞'); t.equal(ES.Number.divide(-Infinity, +0), -Infinity, '-∞ / +0 is -∞'); t.equal(ES.Number.divide(+0, +Infinity), +0, '+0 / +∞ is +0'); t.equal(ES.Number.divide(-0, -Infinity), +0, '-0 / -∞ is +0'); t.equal(ES.Number.divide(-0, +Infinity), -0, '-0 / +∞ is -0'); t.equal(ES.Number.divide(+0, -Infinity), -0, '+0 / -∞ is -0'); forEach(v.numbers, function (number) { if (number !== 0 && isFinite(number)) { t.equal(ES.Number.divide(number, number), 1, debug(number) + ' divided by itself is 1'); t.equal(ES.Number.divide(number, 2), number / 2, debug(number) + ' divided by 2 is half itself'); } }); t.end(); }); test('Number::equal', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.equal(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.equal(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.equal(Infinity, Infinity), true, '∞ === ∞'); t.equal(ES.Number.equal(-Infinity, Infinity), false, '-∞ !== ∞'); t.equal(ES.Number.equal(Infinity, -Infinity), false, '∞ !== -∞'); t.equal(ES.Number.equal(-Infinity, -Infinity), true, '-∞ === -∞'); t.equal(ES.Number.equal(NaN, NaN), false, 'NaN !== NaN'); t.equal(ES.Number.equal(Infinity, 0), false, '∞ !== 0'); t.equal(ES.Number.equal(-Infinity, -0), false, '-∞ !== -0'); t.equal(ES.Number.equal(Infinity, -0), false, '∞ !== -0'); t.equal(ES.Number.equal(-Infinity, 0), false, '-∞ !== 0'); t.equal(ES.Number.equal(+0, +0), true, '+0 === +0'); t.equal(ES.Number.equal(+0, -0), true, '+0 === -0'); t.equal(ES.Number.equal(-0, +0), true, '-0 === +0'); t.equal(ES.Number.equal(-0, -0), true, '-0 === -0'); forEach(v.numbers, function (number) { if (isFinite(number)) { t.equal(ES.Number.equal(number, number), true, debug(number) + ' is equal to itself'); t.equal(ES.Number.equal(number, number + 1), false, debug(number) + ' is not equal to itself plus 1'); } }); t.end(); }); test('Number::exponentiate', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.exponentiate(nonNumber, 0); }, TypeError, 'base: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.exponentiate(0, nonNumber); }, TypeError, 'exponent: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.exponentiate(0, 42), 0, '+0 ** 42 is +0'); t.equal(ES.Number.exponentiate(0, -42), Infinity, '+0 ** 42 is +∞'); t.equal(ES.Number.exponentiate(-0, 42), 0, '-0 ** 42 is +0'); t.equal(ES.Number.exponentiate(-0, 41), -0, '-0 ** 41 is -0'); t.equal(ES.Number.exponentiate(-0, -42), Infinity, '-0 ** 42 is +∞'); t.equal(ES.Number.exponentiate(-0, -41), -Infinity, '-0 ** 41 is -∞'); t.equal(ES.Number.exponentiate(Infinity, 0), 1, '+∞ ** 0 is 1'); t.equal(ES.Number.exponentiate(Infinity, -0), 1, '+∞ ** -0 is 1'); t.equal(ES.Number.exponentiate(-Infinity, 0), 1, '-∞ ** 0 is 1'); t.equal(ES.Number.exponentiate(-Infinity, -0), 1, '-∞ ** -0 is 1'); t.equal(ES.Number.exponentiate(Infinity, 1), Infinity, '+∞ ** 1 is +∞'); t.equal(ES.Number.exponentiate(Infinity, 2), Infinity, '+∞ ** 2 is +∞'); t.equal(ES.Number.exponentiate(Infinity, -1), +0, '+∞ ** -1 is +0'); t.equal(ES.Number.exponentiate(Infinity, -2), +0, '+∞ ** -2 is +0'); t.equal(ES.Number.exponentiate(-Infinity, 1), -Infinity, '-∞ ** 1 is -∞'); t.equal(ES.Number.exponentiate(-Infinity, 2), Infinity, '-∞ ** 2 is +∞'); t.equal(ES.Number.exponentiate(-Infinity, -1), -0, '-∞ ** --1 is -0'); t.equal(ES.Number.exponentiate(-Infinity, -2), +0, '-∞ ** --2 is +0'); t.equal(ES.Number.exponentiate(1.1, Infinity), Infinity, '1.1 ** +∞ is +∞'); t.equal(ES.Number.exponentiate(1.1, -Infinity), 0, '1.1 ** -∞ is +0'); t.equal(ES.Number.exponentiate(-1.1, Infinity), Infinity, '-1.1 ** +∞ is +∞'); t.equal(ES.Number.exponentiate(-1.1, -Infinity), 0, '-1.1 ** -∞ is +0'); t.equal(ES.Number.exponentiate(1, Infinity), NaN, '1 ** +∞ is NaN'); t.equal(ES.Number.exponentiate(1, -Infinity), NaN, '1 ** -∞ is NaN'); t.equal(ES.Number.exponentiate(-1, Infinity), NaN, '-1 ** +∞ is NaN'); t.equal(ES.Number.exponentiate(-1, -Infinity), NaN, '-1 ** -∞ is NaN'); t.equal(ES.Number.exponentiate(0.9, Infinity), 0, '0.9 ** +∞ is +0'); t.equal(ES.Number.exponentiate(0.9, -Infinity), Infinity, '0.9 ** -∞ is ∞'); t.equal(ES.Number.exponentiate(-0.9, Infinity), 0, '-0.9 ** +∞ is +0'); t.equal(ES.Number.exponentiate(-0.9, -Infinity), Infinity, '-0.9 ** -∞ is +∞'); forEach(v.numbers.concat(NaN), function (number) { t.equal(ES.Number.exponentiate(number, NaN), NaN, debug(number) + ' ** NaN is NaN'); if (number !== 0) { t.equal(ES.Number.exponentiate(number, 0), 1, debug(number) + ' ** +0 is 1'); t.equal(ES.Number.exponentiate(number, -0), 1, debug(number) + ' ** -0 is 1'); t.equal(ES.Number.exponentiate(NaN, number), NaN, 'NaN ** ' + debug(number) + ' is NaN'); } if (number !== 0 && isFinite(number)) { t.equal(ES.Number.equal(number, number), true, debug(number) + ' is equal to itself'); t.equal(ES.Number.equal(number, number + 1), false, debug(number) + ' is not equal to itself plus 1'); } }); t.end(); }); test('Number::leftShift', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.leftShift(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.leftShift(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); forEach([0].concat(v.int32s), function (int32) { forEach([1, 3, 5, 31, 32, 33], function (bits) { t.equal(ES.Number.leftShift(int32, bits), int32 << bits, debug(int32) + ' << ' + bits + ' is ' + debug(int32 << bits)); }); }); t.end(); }); test('Number::lessThan', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.lessThan(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.lessThan(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.lessThan(+0, -0), false, '+0 < -0 is false'); t.equal(ES.Number.lessThan(+0, +0), false, '+0 < +0 is false'); t.equal(ES.Number.lessThan(-0, +0), false, '-0 < +0 is false'); t.equal(ES.Number.lessThan(-0, -0), false, '-0 < -0 is false'); t.equal(ES.Number.lessThan(NaN, NaN), undefined, 'NaN < NaN is undefined'); t.equal(ES.Number.lessThan(+Infinity, +Infinity), false, '+∞ < +∞ is false'); t.equal(ES.Number.lessThan(+Infinity, -Infinity), false, '+∞ < -∞ is false'); t.equal(ES.Number.lessThan(-Infinity, +Infinity), true, '-∞ < +∞ is true'); t.equal(ES.Number.lessThan(-Infinity, -Infinity), false, '-∞ < -∞ is false'); forEach(v.numbers.concat(v.infinities), function (number) { t.equal(ES.Number.lessThan(NaN, number), undefined, 'NaN < ' + debug(number) + ' is undefined'); t.equal(ES.Number.lessThan(number, NaN), undefined, debug(number) + ' < NaN is undefined'); t.equal(ES.Number.lessThan(number, number), false, debug(number) + ' is not less than itself'); if (isFinite(number)) { t.equal(ES.Number.lessThan(number, number + 1), true, debug(number) + ' < ' + debug(number + 1) + ' is true'); t.equal(ES.Number.lessThan(number + 1, number), false, debug(number + 1) + ' < ' + debug(number) + ' is false'); t.equal(ES.Number.lessThan(Infinity, number), false, '+∞ < ' + debug(number) + ' is false'); t.equal(ES.Number.lessThan(number, Infinity), true, debug(number) + ' < +∞ is true'); t.equal(ES.Number.lessThan(-Infinity, number), true, '-∞ < ' + debug(number) + ' is true'); t.equal(ES.Number.lessThan(number, -Infinity), false, debug(number) + ' < -∞ is false'); } }); t.end(); }); test('Number::multiply', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.multiply(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.multiply(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); forEach([+0, -0, 1, -1], function (x) { var expected = x === 0 ? NaN : Infinity; t.equal(ES.Number.multiply(Infinity, x), expected, '+∞ * ' + debug(x) + ' is ' + debug(expected)); t.equal(ES.Number.multiply(x, Infinity), expected, debug(x) + ' * +∞ is ' + debug(expected)); t.equal(ES.Number.multiply(-Infinity, x), -expected, '-∞ * ' + debug(x) + ' is ' + debug(expected)); t.equal(ES.Number.multiply(x, -Infinity), -expected, debug(x) + ' * -∞ is ' + debug(expected)); }); t.equal(ES.Number.multiply(Infinity, Infinity), Infinity, '+∞ * +∞ is +∞'); t.equal(ES.Number.multiply(Infinity, -Infinity), -Infinity, '+∞ * -∞ is -∞'); t.equal(ES.Number.multiply(-Infinity, Infinity), -Infinity, '-∞ * +∞ is -∞'); t.equal(ES.Number.multiply(-Infinity, -Infinity), Infinity, '-∞ * -∞ is +∞'); t.equal(ES.Number.multiply(+0, +0), +0, '0 * 0 is +0'); t.equal(ES.Number.multiply(+0, -0), -0, '0 * -0 is -0'); t.equal(ES.Number.multiply(-0, +0), -0, '-0 * 0 is -0'); t.equal(ES.Number.multiply(-0, -0), +0, '-0 * -0 is +0'); forEach(v.numbers.concat(NaN), function (number) { t.equal(ES.Number.multiply(NaN, number), NaN, 'NaN * ' + debug(number) + ' is NaN'); t.equal(ES.Number.multiply(number, NaN), NaN, debug(number) + ' * NaN is NaN'); if (number !== 0 && isFinite(number)) { t.equal(ES.Number.multiply(number, 0), number > 0 ? 0 : -0, debug(number) + ' * +0 produces ' + (number > 0 ? '+0' : '-0')); t.equal(ES.Number.multiply(0, number), number > 0 ? 0 : -0, '+0 * ' + debug(number) + ' produces ' + (number > 0 ? '+0' : '-0')); t.equal(ES.Number.multiply(number, -0), number > 0 ? -0 : 0, debug(number) + ' * -0 produces ' + (number > 0 ? '-0' : '+0')); t.equal(ES.Number.multiply(-0, number), number > 0 ? -0 : 0, '-0 * ' + debug(number) + ' produces ' + (number > 0 ? '-0' : '+0')); t.equal(ES.Number.multiply(number, 1), number, debug(number) + ' * 1 produces itself'); t.equal(ES.Number.multiply(number, -42), number * -42, debug(number) + ' * -42 produces ' + (number - 42)); } }); t.end(); }); test('Number::remainder', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.remainder(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.remainder(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.remainder(NaN, NaN), NaN, 'NaN % NaN is NaN'); t.equal(ES.Number.remainder(+0, +0), NaN, '+0 % +0 is NaN'); t.equal(ES.Number.remainder(+0, -0), NaN, '+0 % -0 is NaN'); t.equal(ES.Number.remainder(-0, +0), NaN, '-0 % +0 is NaN'); t.equal(ES.Number.remainder(-0, -0), NaN, '-0 % -0 is NaN'); forEach(v.numbers, function (number) { t.equal(ES.Number.remainder(number, NaN), NaN, debug(number) + ' % NaN is NaN'); t.equal(ES.Number.remainder(NaN, number), NaN, 'NaN % ' + debug(number) + ' is NaN'); t.equal(ES.Number.remainder(Infinity, number), NaN, '+∞ % ' + debug(number) + ' is NaN'); t.equal(ES.Number.remainder(-Infinity, number), NaN, '-∞ % ' + debug(number) + ' is NaN'); t.equal(ES.Number.remainder(number, 0), NaN, debug(number) + ' % +0 is NaN'); t.equal(ES.Number.remainder(number, -0), NaN, debug(number) + ' % -0 is NaN'); if (isFinite(number)) { t.equal(ES.Number.remainder(number, Infinity), number, debug(number) + ' % +∞ is ' + debug(number)); t.equal(ES.Number.remainder(number, -Infinity), number, debug(number) + ' % -∞ is ' + debug(number)); if (number !== 0) { t.equal(ES.Number.remainder(0, number), 0, '+0 % ' + debug(number) + ' is ' + debug(number)); t.equal(ES.Number.remainder(-0, number), -0, '-0 % ' + debug(number) + ' is ' + debug(number)); t.looseEqual(ES.Number.remainder(number * 2, number), 0, debug(number) + ' % ' + debug(number * 2) + ' is 0'); } } }); t.equal(ES.Number.remainder(-1, 1), -0, '-1 % 1 is -0'); t.end(); }); test('Number::sameValue', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.sameValue(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.sameValue(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.ok(ES.Number.sameValue(NaN, NaN), true, 'NaN is the sameValue as NaN'); t.equal(ES.Number.sameValue(+0, +0), true, '+0 is sameValue as +0'); t.equal(ES.Number.sameValue(+0, -0), false, '+0 is not sameValue as -0'); t.equal(ES.Number.sameValue(-0, +0), false, '-0 is not sameValue as +0'); t.equal(ES.Number.sameValue(-0, -0), true, '-0 is sameValue as -0'); forEach(v.numbers, function (number) { t.ok(ES.Number.sameValue(number, number), debug(number) + ' is the sameValue as itself'); }); t.end(); }); test('Number::sameValueZero', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.sameValueZero(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.sameValueZero(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.ok(ES.Number.sameValueZero(NaN, NaN), true, 'NaN is the sameValueZero as NaN'); t.equal(ES.Number.sameValueZero(+0, +0), true, '+0 is sameValueZero as +0'); t.equal(ES.Number.sameValueZero(+0, -0), true, '+0 is sameValueZero as -0'); t.equal(ES.Number.sameValueZero(-0, +0), true, '-0 is sameValueZero as +0'); t.equal(ES.Number.sameValueZero(-0, -0), true, '-0 is sameValueZero as -0'); forEach(v.numbers, function (number) { t.ok(ES.Number.sameValueZero(number, number), debug(number) + ' is the sameValueZero as itself'); }); t.end(); }); test('Number::signedRightShift', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.signedRightShift(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.signedRightShift(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); forEach([0].concat(v.int32s), function (int32) { forEach([1, 3, 5, 31, 32, 33], function (bits) { t.equal(ES.Number.signedRightShift(int32, bits), int32 >> bits, debug(int32) + ' >> ' + bits + ' is ' + debug(int32 >> bits)); }); }); t.end(); }); test('Number::subtract', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.subtract(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.subtract(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.subtract(+0, +0), +0, '0 - 0 is +0'); t.equal(ES.Number.subtract(+0, -0), +0, '0 - -0 is +0'); t.equal(ES.Number.subtract(-0, +0), -0, '-0 - 0 is -0'); t.equal(ES.Number.subtract(-0, -0), +0, '-0 - -0 is +0'); forEach(v.numbers, function (number) { if (number !== 0) { t.equal(ES.Number.subtract(number, 0), number, debug(number) + ' - 0 produces ' + number); } t.equal(ES.Number.subtract(number, 1), number - 1, debug(number) + ' - 1 produces ' + (number + 1)); t.equal(ES.Number.subtract(number, 42), number - 42, debug(number) + ' - 42 produces ' + (number - 42)); }); t.end(); }); test('Number::toString', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.toString(nonNumber); }, TypeError, debug(nonNumber) + ' is not a Number' ); }); forEach(v.numbers, function (number) { t.equal(ES.Number.toString(number), String(number), debug(number) + ' stringifies to ' + number); }); t.end(); }); test('Number::unaryMinus', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.unaryMinus(nonNumber); }, TypeError, debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.Number.unaryMinus(NaN), NaN, 'NaN produces NaN'); forEach(v.numbers, function (number) { t.equal(ES.Number.unaryMinus(number), -number, debug(number) + ' produces -' + debug(number)); }); t.end(); }); test('Number::unsignedRightShift', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.Number.unsignedRightShift(nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.Number.unsignedRightShift(0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); forEach([0].concat(v.int32s), function (int32) { forEach([1, 3, 5, 31, 32, 33], function (bits) { t.equal(ES.Number.unsignedRightShift(int32, bits), int32 >>> bits, debug(int32) + ' >>> ' + bits + ' is ' + debug(int32 >>> bits)); }); }); t.end(); }); test('NumberToBigInt', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.NumberToBigInt(nonNumber); }, TypeError, debug(nonNumber) + ' is not a Number' ); }); forEach(v.nonIntegerNumbers, function (nonIntegerNumber) { t['throws']( function () { ES.NumberToBigInt(nonIntegerNumber); }, RangeError, debug(nonIntegerNumber) + ' is not an integer' ); }); t.test('actual BigInts', { skip: !hasBigInts }, function (st) { forEach(v.integerNumbers, function (int) { if (int >= 1e17) { // BigInt(1e17) throws on node v10.4 - v10.8 try { st.equal(ES.NumberToBigInt(int), $BigInt(int), debug(int) + ' becomes ' + debug($BigInt(int))); } catch (e) { st['throws']( function () { $BigInt(int); }, RangeError, debug(int) + ' is too large on this engine to convert into a BigInt' ); } } else { st.equal(ES.NumberToBigInt(int), $BigInt(int), debug(int) + ' becomes ' + debug($BigInt(int))); } }); st.end(); }); t.end(); }); test('OrdinaryObjectCreate', function (t) { forEach(v.nonNullPrimitives, function (value) { t['throws']( function () { ES.OrdinaryObjectCreate(value); }, TypeError, debug(value) + ' is not null, or an object' ); }); t.test('proto arg', function (st) { var Parent = function Parent() {}; Parent.prototype.foo = {}; var child = ES.OrdinaryObjectCreate(Parent.prototype); st.equal(child instanceof Parent, true, 'child is instanceof Parent'); st.equal(child.foo, Parent.prototype.foo, 'child inherits properties from Parent.prototype'); st.end(); }); t.test('internal slots arg', function (st) { st.doesNotThrow(function () { ES.OrdinaryObjectCreate({}, []); }, 'an empty slot list is valid'); st['throws']( function () { ES.OrdinaryObjectCreate({}, ['a']); }, SyntaxError, 'internal slots are not supported' ); st.end(); }); t.test('null proto', { skip: !$setProto }, function (st) { st.equal('toString' in {}, true, 'normal objects have toString'); st.equal('toString' in ES.OrdinaryObjectCreate(null), false, 'makes a null object'); st.end(); }); t.test('null proto when no native Object.create', { skip: $setProto }, function (st) { st['throws']( function () { ES.OrdinaryObjectCreate(null); }, SyntaxError, 'without a native Object.create, can not create null objects' ); st.end(); }); t.end(); }); test('SameValueNonNumeric', function (t) { var willThrow = [ [3, 4], [NaN, 4], [4, ''], ['abc', true], [{}, false] ].concat(flatMap(v.bigints, function (bigint) { return [ [bigint, bigint], [bigint, {}], [{}, bigint], [3, bigint], [bigint, 3], ['', bigint], [bigint, ''] ]; })); forEach(willThrow, function (nums) { t['throws'](function () { return ES.SameValueNonNumeric.apply(ES, nums); }, TypeError, 'value must be same type and non-number/bigint: got ' + debug(nums[0]) + ' and ' + debug(nums[1])); }); forEach(v.objects.concat(v.nonNumberPrimitives), function (val) { t.equal(val === val, ES.SameValueNonNumeric(val, val), debug(val) + ' is SameValueNonNumeric to itself'); }); t.end(); }); test('StringToBigInt', function (t) { test('actual BigInts', { skip: !hasBigInts }, function (st) { forEach(v.bigints, function (bigint) { st.equal( ES.StringToBigInt(String(bigint)), bigint, debug(String(bigint)) + ' becomes ' + debug(bigint) ); }); forEach(v.integerNumbers, function (int) { var bigint = safeBigInt(int); st.equal( ES.StringToBigInt(String(int)), bigint, debug(String(int)) + ' becomes ' + debug(bigint) ); }); forEach(v.nonIntegerNumbers, function (nonInt) { st.equal( ES.StringToBigInt(String(nonInt)), NaN, debug(String(nonInt)) + ' becomes NaN' ); }); st.end(); }); forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.StringToBigInt(nonString); }, TypeError, debug(nonString) + ' is not a string' ); }); t.end(); }); test('StringPad', function (t) { t.equal(ES.StringPad('a', 3, undefined, 'start'), ' a'); t.equal(ES.StringPad('a', 3, undefined, 'end'), 'a '); t.equal(ES.StringPad('a', 3, '0', 'start'), '00a'); t.equal(ES.StringPad('a', 3, '0', 'end'), 'a00'); t.equal(ES.StringPad('a', 3, '012', 'start'), '01a'); t.equal(ES.StringPad('a', 3, '012', 'end'), 'a01'); t.equal(ES.StringPad('a', 7, '012', 'start'), '012012a'); t.equal(ES.StringPad('a', 7, '012', 'end'), 'a012012'); t.end(); }); test('thisBigIntValue', function (t) { test('actual BigInts', { skip: !hasBigInts }, function (st) { st.equal(ES.thisBigIntValue(BigInt(42)), BigInt(42)); st.equal(ES.thisBigIntValue(Object(BigInt(42))), BigInt(42)); st.end(); }); forEach(v.nonBigInts, function (nonBigInt) { t['throws']( function () { ES.thisBigIntValue(nonBigInt); }, TypeError, debug(nonBigInt) + ' is not a BigInt' ); }); t.end(); }); test('ToBigInt', function (t) { t['throws']( function () { ES.ToBigInt(); }, hasBigInts ? TypeError : SyntaxError, 'undefined throws' ); t['throws']( function () { ES.ToBigInt(null); }, hasBigInts ? TypeError : SyntaxError, 'null throws' ); forEach(v.symbols, function (sym) { t['throws']( function () { ES.ToBigInt(sym); }, hasBigInts ? TypeError : SyntaxError, debug(sym) + ' throws' ); }); test('actual BigInts', { skip: !hasBigInts }, function (st) { st.equal(ES.ToBigInt(true), BigInt(1), 'true becomes 1n'); st.equal(ES.ToBigInt(false), BigInt(0), 'true becomes 0n'); forEach(v.bigints, function (bigint) { st.equal( ES.ToBigInt(bigint), bigint, debug(bigint) + ' remains ' + debug(bigint) ); st.equal( ES.ToBigInt(String(bigint)), bigint, debug(String(bigint)) + ' becomes ' + debug(bigint) ); }); forEach(v.numbers, function (number) { st['throws']( function () { ES.ToBigInt(number); }, TypeError, debug(number) + ' throws' ); }); forEach(v.integerNumbers, function (int) { st.equal( ES.ToBigInt(String(int)), safeBigInt(int), debug(String(int)) + ' becomes ' + debug(safeBigInt(int)) ); }); forEach(v.nonIntegerNumbers, function (nonInt) { st['throws']( function () { ES.ToBigInt(nonInt); }, TypeError, debug(nonInt) + ' is not an integer' ); }); st.end(); }); t.end(); }); test('ToBigInt64', { skip: !hasBigInts }, function (t) { var twoSixtyThreeMinusOne = twoSixtyThree - BigInt(1); var negTwoSixtyThreeMinusOne = -twoSixtyThree - BigInt(1); t.equal(ES.ToBigInt64(twoSixtyThreeMinusOne), twoSixtyThreeMinusOne, debug(twoSixtyThreeMinusOne) + ' returns itself'); t.equal(ES.ToBigInt64(-twoSixtyThree), -twoSixtyThree, debug(-twoSixtyThree) + ' returns itself'); t.equal( ES.ToBigInt64(twoSixtyThree), twoSixtyThree - twoSixtyFour, debug(twoSixtyThree) + ' returns ' + debug(twoSixtyThree - twoSixtyFour) ); t.equal( ES.ToBigInt64(negTwoSixtyThreeMinusOne), twoSixtyFour - twoSixtyThree - BigInt(1), debug(negTwoSixtyThreeMinusOne) + ' returns ' + debug(twoSixtyFour - twoSixtyThree - BigInt(1)) ); t.end(); }); test('ToBigUint64', { skip: !hasBigInts }, function (t) { var twoSixtyFourMinusOne = twoSixtyFour - BigInt(1); var twoSixtyThreeMinusOne = twoSixtyThree - BigInt(1); var negTwoSixtyThreeMinusOne = -twoSixtyThree - BigInt(1); t.equal(ES.ToBigUint64(twoSixtyThreeMinusOne), twoSixtyThreeMinusOne, debug(twoSixtyThreeMinusOne) + ' returns itself'); t.equal(ES.ToBigUint64(twoSixtyThree), twoSixtyThree, debug(twoSixtyThree) + ' returns itself'); t.equal(ES.ToBigUint64(twoSixtyFourMinusOne), twoSixtyFourMinusOne, debug(twoSixtyFourMinusOne) + ' returns itself'); t.equal(ES.ToBigUint64(-twoSixtyThree), twoSixtyThree, debug(-twoSixtyThree) + ' returns ' + debug(twoSixtyThree)); t.equal( ES.ToBigUint64(twoSixtyFour), BigInt(0), debug(twoSixtyFour) + ' returns 0n' ); t.equal( ES.ToBigUint64(negTwoSixtyThreeMinusOne), twoSixtyFour - twoSixtyThree - BigInt(1), debug(negTwoSixtyThreeMinusOne) + ' returns ' + debug(twoSixtyFour - twoSixtyThree - BigInt(1)) ); t.end(); }); test('ToInteger', function (t) { forEach([0, -0, NaN], function (num) { t.equal(ES.ToInteger(num), +0, debug(num) + ' returns +0'); }); forEach([Infinity, 42], function (num) { t.equal(ES.ToInteger(num), num, debug(num) + ' returns itself'); t.equal(ES.ToInteger(-num), -num, '-' + debug(num) + ' returns itself'); }); t.equal(ES.ToInteger(Math.PI), 3, 'pi returns 3'); t.equal(ES.ToInteger(-0.1), +0, '-0.1 truncates to +0, not -0'); t['throws'](function () { return ES.ToInteger(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); t.end(); }); test('ToNumber', function (t) { testToNumber(t, ES, ES.ToNumber); forEach(v.bigints, function (bigInt) { t['throws']( function () { ES.ToNumber(bigInt); }, TypeError, 'ToNumber of ' + debug(bigInt) + ' throws' ); var boxed = Object(bigInt); t['throws']( function () { ES.ToNumber(boxed); }, TypeError, 'ToNumber of ' + debug(boxed) + ' throws' ); }); t.end(); }); test('UTF16DecodeSurrogatePair', function (t) { t['throws']( function () { ES.UTF16DecodeSurrogatePair('a'.charCodeAt(0), trailingPoo.charCodeAt(0)); }, TypeError, '"a" is not a leading surrogate' ); t['throws']( function () { ES.UTF16DecodeSurrogatePair(leadingPoo.charCodeAt(0), 'b'.charCodeAt(0)); }, TypeError, '"b" is not a trailing surrogate' ); t.equal(ES.UTF16DecodeSurrogatePair(leadingPoo.charCodeAt(0), trailingPoo.charCodeAt(0)), wholePoo); t.end(); }); test('NumberBitwiseOp', function (t) { t['throws']( function () { ES.NumberBitwiseOp('invalid', 0, 0); }, TypeError, 'throws with an invalid op' ); forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.NumberBitwiseOp('&', nonNumber, 0); }, TypeError, 'x: ' + debug(nonNumber) + ' is not a Number' ); t['throws']( function () { ES.NumberBitwiseOp('&', 0, nonNumber); }, TypeError, 'y: ' + debug(nonNumber) + ' is not a Number' ); }); t.equal(ES.NumberBitwiseOp('&', 1, 2), 1 & 2); t.equal(ES.NumberBitwiseOp('|', 1, 2), 1 | 2); t.equal(ES.NumberBitwiseOp('^', 1, 2), 1 ^ 2); t.end(); }); test('ToNumeric', function (t) { testToNumber(t, ES, ES.ToNumeric); t.test('BigInts', { skip: !hasBigInts }, function (st) { st.equal(ES.ToNumeric(BigInt(42)), BigInt(42), debug(BigInt(42)) + ' is ' + debug(BigInt(42))); st.equal(ES.ToNumeric(Object(BigInt(42))), BigInt(42), debug(Object(BigInt(42))) + ' is ' + debug(BigInt(42))); var valueOf = { valueOf: function () { return BigInt(7); } }; st.equal(ES.ToNumeric(valueOf), valueOf.valueOf(), debug(valueOf) + ' is ' + debug(valueOf.valueOf())); var toPrimitive = {}; var value = BigInt(-2); toPrimitive[Symbol.toPrimitive] = function () { return value; }; st.equal(ES.ToNumeric(toPrimitive), value, debug(toPrimitive) + ' is ' + debug(value)); st.end(); }); t.end(); }); test('UTF16DecodeString', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.UTF16DecodeString(nonString); }, TypeError, debug(nonString) + ' is not a String' ); }); t.deepEqual(ES.UTF16DecodeString('abc'), ['a', 'b', 'c'], 'code units get split'); t.deepEqual(ES.UTF16DecodeString('a' + wholePoo + 'c'), ['a', wholePoo, 'c'], 'code points get split too'); t.end(); }); }; var es2021 = function ES2021(ES, ops, expectedMissing, skips) { es2020(ES, ops, expectedMissing, assign({}, skips, { IsInteger: true, IsNonNegativeInteger: true, SetFunctionLength: true, ToInteger: true, UTF16DecodeString: true, UTF16DecodeSurrogatePair: true, UTF16Encoding: true })); var test = makeTest(ES, skips); test('AddToKeptObjects', function (t) { forEach(v.primitives, function (nonObject) { t['throws']( function () { ES.AddToKeptObjects(nonObject); }, debug(nonObject) + ' is not an Object' ); }); t.equal(ES.AddToKeptObjects({}), undefined, 'returns nothing'); t.end(); }); test('ApplyStringOrNumericBinaryOperator', function (t) { forEach(v.nonStrings.concat('', '^^', '//', '***'), function (nonOp) { t['throws']( function () { ES.ApplyStringOrNumericBinaryOperator(null, nonOp, null); }, TypeError, 'opText must be a valid operation: ' + debug(nonOp) + ' is not an operation' ); }); var obj = { toString: function () { return 'abc'; } }; forEach(v.strings, function (string) { t.equal( ES.ApplyStringOrNumericBinaryOperator(string, '+', v.toStringOnlyObject), string + '7', debug(string) + ' + ' + debug(v.toStringOnlyObject) + ' is ' + debug(string + '7') ); t.equal( ES.ApplyStringOrNumericBinaryOperator(v.toStringOnlyObject, '+', string), '7' + string, debug(v.toStringOnlyObject) + ' + ' + debug(string) + ' is ' + debug('7' + v.toStringOnlyObject) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(string, '+', string), string + string, debug(string) + ' + ' + debug(string) + ' is ' + debug(string + string) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(string, '+', obj), string + 'abc', debug(string) + ' + ' + debug(obj) + ' is ' + debug(string + 'abc') ); t.equal( ES.ApplyStringOrNumericBinaryOperator(obj, '+', string), 'abc' + string, debug(obj) + ' + ' + debug(string) + ' is ' + debug('abc' + string) ); }); t.equal( ES.ApplyStringOrNumericBinaryOperator(obj, '+', obj), 'abcabc', debug(obj) + ' + ' + debug(obj) + ' is ' + debug('abcabc') ); t.equal( ES.ApplyStringOrNumericBinaryOperator(v.toStringOnlyObject, '+', v.toStringOnlyObject), 14, debug(v.toStringOnlyObject) + ' + ' + debug(v.toStringOnlyObject) + ' is 14' ); forEach(v.numbers, function (number) { t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '+', number), number + number, debug(number) + ' + itself is ' + debug(number + number) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '-', number), number - number, debug(number) + ' - itself is ' + debug(number + number) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '*', number), number * number, debug(number) + ' * itself is ' + debug(number + number) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '**', number), Math.pow(number, number), debug(number) + ' ** itself is ' + debug(Math.pow(number, number)) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '/', number), number / number, debug(number) + ' / itself is ' + debug(number / number) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '%', number), number % number, debug(number) + ' % itself is ' + debug(number % number) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '<<', number), number << number, debug(number) + ' << itself is ' + debug(number << number) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '>>', number), number >> number, debug(number) + ' >> itself is ' + debug(number >> number) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '>>>', number), number >>> number, debug(number) + ' >>> itself is ' + debug(number >>> number) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '&', number), number & number, debug(number) + ' & itself is ' + debug(number & number) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '^', number), number ^ number, debug(number) + ' ^ itself is ' + debug(number ^ number) ); t.equal( ES.ApplyStringOrNumericBinaryOperator(number, '|', number), number | number, debug(number) + ' | itself is ' + debug(number | number) ); }); t.end(); }); test('ByteListBitwiseOp', function (t) { t['throws']( function () { ES.ByteListBitwiseOp('+', [], []); }, TypeError, 'op must be &, ^, or |' ); forEach(v.nonArrays, function (nonArray) { t['throws']( function () { ES.ByteListBitwiseOp('&', nonArray); }, TypeError, 'xBytes: ' + debug(nonArray) + ' is not a sequence of byte values' ); t['throws']( function () { ES.ByteListBitwiseOp('&', [], nonArray); }, TypeError, 'yBytes: ' + debug(nonArray) + ' is not a sequence of byte values' ); }); t['throws']( function () { ES.ByteListBitwiseOp('&', [0], [0, 0]); }, TypeError, 'byte sequences must be the same length' ); for (var i = 0; i <= 255; i += 1) { var j = i === 0 ? 1 : i - 1; t.deepEqual(ES.ByteListBitwiseOp('&', [i], [j]), [i & j], i + ' & ' + j); t.deepEqual(ES.ByteListBitwiseOp('^', [i], [j]), [i ^ j], i + ' ^ ' + j); t.deepEqual(ES.ByteListBitwiseOp('|', [i], [j]), [i | j], i + ' | ' + j); } t.end(); }); test('ByteListEqual', function (t) { forEach(v.nonArrays, function (nonArray) { t['throws']( function () { ES.ByteListEqual(nonArray); }, TypeError, 'xBytes: ' + debug(nonArray) + ' is not a sequence of byte values' ); t['throws']( function () { ES.ByteListEqual([], nonArray); }, TypeError, 'yBytes: ' + debug(nonArray) + ' is not a sequence of byte values' ); }); t.equal(ES.ByteListEqual([0], [0, 0]), false, 'two sequences of different length are not equal'); for (var i = 0; i <= 255; i += 1) { t.equal(ES.ByteListEqual([i], [i]), true, 'two equal sequences of ' + i + ' are equal'); t.equal(ES.ByteListEqual([i, i === 0 ? 1 : 0], [i === 0 ? 1 : 0, i]), false, 'two inequal sequences of ' + i + ' are not equal'); } t.end(); }); test('clamp', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.clamp(nonNumber, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); }, TypeError, 'argument 1: ' + debug(nonNumber) + ' is not a number' ); t['throws']( function () { ES.clamp(0, nonNumber, MAX_SAFE_INTEGER); }, TypeError, 'argument 2: ' + debug(nonNumber) + ' is not a number' ); t['throws']( function () { ES.clamp(0, -MAX_SAFE_INTEGER, nonNumber); }, TypeError, 'argument 3: ' + debug(nonNumber) + ' is not a number' ); }); t.equal(ES.clamp(-1, 0, 2), 0, 'clamping -1 between 0 and 2 is 0'); t.equal(ES.clamp(0, 0, 2), 0, 'clamping 0 between 0 and 2 is 0'); t.equal(ES.clamp(1, 0, 2), 1, 'clamping 1 between 0 and 2 is 1'); t.equal(ES.clamp(2, 0, 2), 2, 'clamping 2 between 0 and 2 is 2'); t.equal(ES.clamp(3, 0, 2), 2, 'clamping 3 between 0 and 2 is 2'); t.end(); }); test('ClearKeptObjects', function (t) { t.doesNotThrow(ES.ClearKeptObjects, 'appears to be a no-op'); t.end(); }); test('CodePointsToString', function (t) { forEach(v.nonArrays, function (nonArray) { t['throws']( function () { ES.CodePointsToString(nonArray); }, TypeError, debug(nonArray) + ' is not an Array of Code Points' ); }); forEach(v.notNonNegativeIntegers.concat(0x10FFFF + 1), function (nonCodePoint) { t['throws']( function () { ES.CodePointsToString([nonCodePoint]); }, TypeError, debug(nonCodePoint) + ' is not a Code Point' ); }); t.equal(ES.CodePointsToString([0xD83D, 0xDCA9]), wholePoo, 'code points are converted to a string'); t.end(); }); test('GetPromiseResolve', function (t) { forEach(v.nonFunctions.concat(v.nonConstructorFunctions), function (nonConstructor) { t['throws']( function () { ES.GetPromiseResolve(nonConstructor); }, TypeError, debug(nonConstructor) + ' is not a constructor' ); }); forEach(v.nonFunctions, function (nonCallable) { var C = function C() {}; C.resolve = nonCallable; t['throws']( function () { ES.GetPromiseResolve(C); }, TypeError, '`resolve` method: ' + debug(nonCallable) + ' is not callable' ); }); t.test('Promises supported', { skip: typeof Promise !== 'function' }, function (st) { st.equal(ES.GetPromiseResolve(Promise), Promise.resolve, '`GetPromiseResolve(Promise) === Promise.resolve`'); st.end(); }); var C = function () {}; var resolve = function () {}; C.resolve = resolve; t.equal(ES.GetPromiseResolve(C), resolve, 'returns a callable `resolve` property'); t.end(); }); test('IsIntegralNumber', function (t) { for (var i = -100; i < 100; i += 10) { t.equal(true, ES.IsIntegralNumber(i), i + ' is integer'); t.equal(false, ES.IsIntegralNumber(i + 0.2), (i + 0.2) + ' is not integer'); } t.equal(true, ES.IsIntegralNumber(-0), '-0 is integer'); var notInts = v.nonNumbers.concat(v.nonIntegerNumbers, v.infinities, [NaN, [], new Date()]); forEach(notInts, function (notInt) { t.equal(false, ES.IsIntegralNumber(notInt), debug(notInt) + ' is not integer'); }); t.equal(false, ES.IsIntegralNumber(v.uncoercibleObject), 'uncoercibleObject is not integer'); t.end(); }); test('IterableToList', function (t) { // see ES2017 tests for the rest of the IterableToList tests t.deepEqual( ES.IterableToList(['a', 'b', 'c']), ['a', 'b', 'c'], 'method is optional in ES2021+' ); t.end(); }); test('SetFunctionLength', function (t) { forEach(v.nonFunctions, function (nonFunction) { t['throws']( function () { ES.SetFunctionLength(nonFunction, 0); }, TypeError, debug(nonFunction) + ' is not a Function' ); }); t.test('non-extensible function', { skip: !Object.preventExtensions }, function (st) { var F = function F() {}; Object.preventExtensions(F); st['throws']( function () { ES.SetFunctionLength(F, 0); }, TypeError, 'non-extensible function throws' ); st.end(); }); var HasLength = function HasLength(_) { return _; }; t.equal(has(HasLength, 'length'), true, 'precondition: `HasLength` has own length'); t['throws']( function () { ES.SetFunctionLength(HasLength, 0); }, TypeError, 'function with own length throws' ); t.test('no length', { skip: !functionsHaveConfigurableNames }, function (st) { var HasNoLength = function HasNoLength() {}; delete HasNoLength.length; st.equal(has(HasNoLength, 'length'), false, 'precondition: `HasNoLength` has no own length'); forEach(v.nonNumbers, function (nonNumber) { st['throws']( function () { ES.SetFunctionLength(HasNoLength, nonNumber); }, TypeError, debug(nonNumber) + ' is not a Number' ); }); forEach([-1, -42, -Infinity].concat(v.nonIntegerNumbers), function (nonPositiveInteger) { st['throws']( function () { ES.SetFunctionLength(HasNoLength, nonPositiveInteger); }, TypeError, debug(nonPositiveInteger) + ' is not a positive integer Number' ); }); st.end(); }); // TODO: ensure it works with +Infinity // TODO: defines an own configurable non-enum non-write length property t.end(); }); test('ToIntegerOrInfinity', function (t) { forEach([0, -0, NaN], function (num) { t.equal(ES.ToIntegerOrInfinity(num), +0, debug(num) + ' returns +0'); }); forEach([Infinity, 42], function (num) { t.equal(ES.ToIntegerOrInfinity(num), num, debug(num) + ' returns itself'); t.equal(ES.ToIntegerOrInfinity(-num), -num, '-' + debug(num) + ' returns itself'); }); t.equal(ES.ToIntegerOrInfinity(Math.PI), 3, 'pi returns 3'); t.equal(ES.ToIntegerOrInfinity(-0.1), +0, '-0.1 truncates to +0, not -0'); t['throws'](function () { return ES.ToIntegerOrInfinity(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); t.end(); }); test('StringIndexOf', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.StringIndexOf(nonString); }, TypeError, '`string` arg: ' + debug(nonString) + ' is not a String' ); t['throws']( function () { ES.StringIndexOf('', nonString); }, TypeError, '`searchValue` arg: ' + debug(nonString) + ' is not a String' ); }); forEach(v.notNonNegativeIntegers, function (notNonNegativeInteger) { t['throws']( function () { ES.StringIndexOf('', '', notNonNegativeInteger); }, TypeError, '`fromIndex` arg: ' + debug(notNonNegativeInteger) + ' is not a non-negative integer' ); }); var str = 'abc' + wholePoo + 'abc'; t.equal(ES.StringIndexOf(str, 'a', 0), 0, 'a: first index found'); t.equal(ES.StringIndexOf(str, 'a', 1), 5, 'a: second index found'); t.equal(ES.StringIndexOf(str, 'a', 6), -1, 'a: second index not found'); t.equal(ES.StringIndexOf(str, 'b', 0), 1, 'b: first index found'); t.equal(ES.StringIndexOf(str, 'b', 2), 6, 'b: second index found'); t.equal(ES.StringIndexOf(str, 'b', 7), -1, 'b: second index not found'); t.equal(ES.StringIndexOf(str, 'c', 0), 2, 'c: first index found'); t.equal(ES.StringIndexOf(str, 'c', 3), 7, 'c: second index found'); t.equal(ES.StringIndexOf(str, 'c', 8), -1, 'c: second index not found'); t.equal(ES.StringIndexOf(str, leadingPoo, 0), 3, 'first half of ' + wholePoo + ' found'); t.equal(ES.StringIndexOf(str, leadingPoo, 4), -1, 'first half of ' + wholePoo + ' not found'); t.equal(ES.StringIndexOf(str, trailingPoo, 0), 4, 'second half of ' + wholePoo + ' found'); t.equal(ES.StringIndexOf(str, trailingPoo, 5), -1, 'second half of ' + wholePoo + ' not found'); t.equal(ES.StringIndexOf(str, wholePoo, 0), 3, wholePoo + ' found'); t.equal(ES.StringIndexOf(str, wholePoo, 4), -1, wholePoo + ' not found'); t.equal(ES.StringIndexOf('', 'a', 0), -1, 'empty string contains nothing'); for (var i = 0; i < str.length; i += 1) { t.equal(ES.StringIndexOf(str, '', i), i, 'empty string is found at every index: ' + i); } t.end(); }); test('StringToCodePoints', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.StringToCodePoints(nonString); }, TypeError, debug(nonString) + ' is not a String' ); }); t.deepEqual(ES.StringToCodePoints('abc'), ['a', 'b', 'c'], 'code units get split'); t.deepEqual(ES.StringToCodePoints('a' + wholePoo + 'c'), ['a', wholePoo, 'c'], 'code points get split too'); t.end(); }); test('substring', function (t) { forEach(v.nonStrings, function (nonString) { t['throws']( function () { ES.substring(nonString, 0, 0); }, TypeError, debug(nonString) + ' is not a String' ); }); forEach(v.nonNumbers.concat(v.nonIntegerNumbers), function (nonIntegerNumber) { t['throws']( function () { ES.substring('', nonIntegerNumber); }, TypeError, 'inclusiveStart, no end: ' + debug(nonIntegerNumber) + ' is not an integer' ); t['throws']( function () { ES.substring('', nonIntegerNumber, 0); }, TypeError, 'inclusiveStart: ' + debug(nonIntegerNumber) + ' is not an integer' ); t['throws']( function () { ES.substring('', 0, nonIntegerNumber); }, TypeError, 'exclusiveEnd: ' + debug(nonIntegerNumber) + ' is not an integer' ); }); t.equal(ES.substring('abc', 0), 'abc', 'substring of S from 0 works'); t.equal(ES.substring('abc', 1), 'bc', 'substring of S from 1 works'); t.equal(ES.substring('abc', 2), 'c', 'substring of S from 2 works'); t.equal(ES.substring('abc', 3), '', 'substring of S from 3 works'); t.equal(ES.substring('abc', 0, 1), 'a', 'substring of S from 0 to 1 works'); t.equal(ES.substring('abc', 1, 1), '', 'substring of S from 1 to 1 works'); t.equal(ES.substring('abc', 2, 1), '', 'substring of S from 2 to 1 works'); t.equal(ES.substring('abc', 3, 1), '', 'substring of S from 3 to 1 works'); t.equal(ES.substring('abc', 0, 2), 'ab', 'substring of S from 0 to 2 works'); t.equal(ES.substring('abc', 1, 2), 'b', 'substring of S from 1 to 2 works'); t.equal(ES.substring('abc', 2, 2), '', 'substring of S from 2 to 2 works'); t.equal(ES.substring('abc', 3, 2), '', 'substring of S from 3 to 2 works'); t.equal(ES.substring('abc', 0, 3), 'abc', 'substring of S from 0 to 3 works'); t.equal(ES.substring('abc', 1, 3), 'bc', 'substring of S from 1 to 3 works'); t.equal(ES.substring('abc', 2, 3), 'c', 'substring of S from 2 to 3 works'); t.equal(ES.substring('abc', 3, 3), '', 'substring of S from 3 to 3 works'); t.equal(ES.substring('abc', 0, 4), 'abc', 'substring of S from 0 to 4 works'); t.equal(ES.substring('abc', 1, 4), 'bc', 'substring of S from 1 to 4 works'); t.equal(ES.substring('abc', 2, 4), 'c', 'substring of S from 2 to 4 works'); t.equal(ES.substring('abc', 3, 4), '', 'substring of S from 3 to 4 works'); t.end(); }); test('UTF16SurrogatePairToCodePoint', function (t) { t['throws']( function () { ES.UTF16SurrogatePairToCodePoint('a'.charCodeAt(0), trailingPoo.charCodeAt(0)); }, TypeError, '"a" is not a leading surrogate' ); t['throws']( function () { ES.UTF16SurrogatePairToCodePoint(leadingPoo.charCodeAt(0), 'b'.charCodeAt(0)); }, TypeError, '"b" is not a trailing surrogate' ); t.equal(ES.UTF16SurrogatePairToCodePoint(leadingPoo.charCodeAt(0), trailingPoo.charCodeAt(0)), wholePoo); t.end(); }); test('UTF16EncodeCodePoint', function (t) { forEach(v.nonNumbers, function (nonNumber) { t['throws']( function () { ES.UTF16EncodeCodePoint(nonNumber); }, TypeError, debug(nonNumber) + ' is not a Number' ); }); t['throws']( function () { ES.UTF16EncodeCodePoint(-1); }, TypeError, '-1 is < 0' ); t['throws']( function () { ES.UTF16EncodeCodePoint(0x10FFFF + 1); }, TypeError, '0x10FFFF + 1 is > 0x10FFFF' ); t.equal(ES.UTF16EncodeCodePoint(0xd83d), leadingPoo.charAt(0), '0xD83D is the first half of ' + wholePoo); t.equal(ES.UTF16EncodeCodePoint(0xdca9), trailingPoo.charAt(0), '0xD83D is the last half of ' + wholePoo); t.end(); }); test('WeakRefDeref', function (t) { forEach(v.primitives.concat(v.objects), function (nonWeakRef) { t['throws']( function () { ES.WeakRefDeref(nonWeakRef); }, TypeError, debug(nonWeakRef) + ' is not a WeakRef' ); }); t.test('WeakRefs', { skip: typeof WeakRef !== 'function' }, function (st) { var sentinel = {}; var weakRef = new WeakRef({ foo: sentinel }); st.deepEqual(ES.WeakRefDeref(weakRef), { foo: sentinel }, 'weakRef is dereferenced'); st.end(); }); t.end(); }); }; var es2022 = function ES2022(ES, ops, expectedMissing, skips) { es2021(ES, ops, expectedMissing, assign({}, skips, { 'Abstract Equality Comparison': true, 'Abstract Relational Comparison': true, 'Strict Equality Comparison': true, SplitMatch: true })); var test = makeTest(ES, skips); test('CreateNonEnumerableDataPropertyOrThrow', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.CreateNonEnumerableDataPropertyOrThrow(primitive, 'key'); }, TypeError, 'O must be an Object; ' + debug(primitive) + ' is not one' ); }); forEach(v.nonPropertyKeys, function (nonPropertyKey) { t['throws']( function () { ES.CreateNonEnumerableDataPropertyOrThrow({}, nonPropertyKey); }, TypeError, debug(nonPropertyKey) + ' is not a Property Key' ); }); t.test('defines correctly', function (st) { var obj = {}; var key = 'the key'; var value = { foo: 'bar' }; st.equal(ES.CreateNonEnumerableDataPropertyOrThrow(obj, key, value), true, 'defines property successfully'); st.test('property descriptor', { skip: !getOwnPropertyDescriptor }, function (s2t) { s2t.deepEqual( getOwnPropertyDescriptor(obj, key), { configurable: true, enumerable: false, value: value, writable: true }, 'sets the correct property descriptor' ); s2t.end(); }); st.equal(obj[key], value, 'sets the correct value'); st.end(); }); t.test('fails as expected on a frozen object', { skip: !Object.freeze }, function (st) { var obj = Object.freeze({ foo: 'bar' }); st['throws']( function () { ES.CreateNonEnumerableDataPropertyOrThrow(obj, 'foo', { value: 'baz' }); }, TypeError, 'nonconfigurable key can not be defined' ); st.end(); }); t.test('fails as expected on a function with a nonconfigurable name', { skip: !functionsHaveNames || functionsHaveConfigurableNames }, function (st) { st['throws']( function () { ES.CreateNonEnumerableDataPropertyOrThrow(function () {}, 'name', { value: 'baz' }); }, TypeError, 'nonconfigurable function name can not be defined' ); st.end(); }); t.end(); }); test('GetMatchIndexPair', function (t) { forEach(v.nonStrings, function (notString) { t['throws']( function () { return ES.GetMatchIndexPair(notString); }, TypeError, debug(notString) + ' is not a string' ); }); forEach(v.primitives.concat( v.objects, { '[[StartIndex]]': -1 }, { '[[StartIndex]]': 1.2, '[[EndIndex]]': 0 }, { '[[StartIndex]]': 1, '[[EndIndex]]': 0 }, { '[[StartIndex]]': 0, '[[EndIndex]]': 1 } ), function (notMatchRecord) { t['throws']( function () { return ES.GetMatchIndexPair('', notMatchRecord); }, TypeError, debug(notMatchRecord) + ' is not a Match Record' ); }); t.deepEqual( ES.GetMatchIndexPair('', { '[[StartIndex]]': 0, '[[EndIndex]]': 0 }), [0, 0] ); t.deepEqual( ES.GetMatchIndexPair('abc', { '[[StartIndex]]': 1, '[[EndIndex]]': 2 }), [1, 2] ); t.end(); }); test('GetMatchString', function (t) { forEach(v.nonStrings, function (notString) { t['throws']( function () { return ES.GetMatchString(notString); }, TypeError, debug(notString) + ' is not a string' ); }); forEach(v.primitives.concat( v.objects, { '[[StartIndex]]': -1 }, { '[[StartIndex]]': 1.2, '[[EndIndex]]': 0 }, { '[[StartIndex]]': 1, '[[EndIndex]]': 0 }, { '[[StartIndex]]': 0, '[[EndIndex]]': 1 } ), function (notMatchRecord) { t['throws']( function () { return ES.GetMatchString('', notMatchRecord); }, TypeError, debug(notMatchRecord) + ' is not a Match Record' ); }); t.equal( ES.GetMatchString('', { '[[StartIndex]]': 0, '[[EndIndex]]': 0 }), '' ); t.equal( ES.GetMatchString('abc', { '[[StartIndex]]': 1, '[[EndIndex]]': 2 }), 'b' ); t.end(); }); test('GetStringIndex', function (t) { forEach(v.nonStrings, function (notString) { t['throws']( function () { return ES.GetStringIndex(notString); }, TypeError, '`S`: ' + debug(notString) + ' is not a string' ); }); forEach(v.notNonNegativeIntegers, function (nonNonNegativeInteger) { t['throws']( function () { ES.GetStringIndex('', nonNonNegativeInteger); }, TypeError, '`e`: ' + debug(nonNonNegativeInteger) + ' is not a non-negative integer' ); }); var strWithWholePoo = 'a' + wholePoo + 'c'; t.equal(ES.GetStringIndex(strWithWholePoo, 0), 0, 'index 0 yields 0'); t.equal(ES.GetStringIndex(strWithWholePoo, 1), 1, 'index 1 yields 1'); t.equal(ES.GetStringIndex(strWithWholePoo, 2), 3, 'index 2 yields 3'); t.equal(ES.GetStringIndex(strWithWholePoo, 3), 4, 'index 3 yields 4'); t.end(); }); test('InstallErrorCause', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.CreateNonEnumerableDataPropertyOrThrow(primitive, 'key'); }, TypeError, 'O must be an Object; ' + debug(primitive) + ' is not one' ); }); var obj = {}; ES.InstallErrorCause(obj); t.notOk( 'cause' in obj, 'installs nothing when `options` is omitted' ); ES.InstallErrorCause(obj, {}); t.notOk( 'cause' in obj, 'installs nothing when `cause` is absent' ); ES.InstallErrorCause(obj, { cause: undefined }); t.ok( 'cause' in obj, 'installs `undefined` when `cause` is present and `undefined`' ); t.equal(obj.cause, undefined, 'obj.cause is `undefined`'); var obj2 = {}; ES.InstallErrorCause(obj2, { cause: obj }); t.ok( 'cause' in obj2, 'installs when `cause` is present' ); t.equal(obj2.cause, obj, 'obj2.cause is as expected'); t.end(); }); test('IsStrictlyEqual', function (t) { t.test('same types use ===', function (st) { forEach(v.primitives.concat(v.objects), function (value) { st.equal(ES.IsStrictlyEqual(value, value), value === value, debug(value) + ' is strictly equal to itself'); }); st.end(); }); t.test('different types are not ===', function (st) { var pairs = [ [null, undefined], [3, '3'], [true, '3'], [true, 3], [false, 0], [false, '0'], [3, [3]], ['3', [3]], [true, [1]], [false, [0]], [String(v.coercibleObject), v.coercibleObject], [Number(String(v.coercibleObject)), v.coercibleObject], [Number(v.coercibleObject), v.coercibleObject], [String(Number(v.coercibleObject)), v.coercibleObject] ]; forEach(pairs, function (pair) { var a = pair[0]; var b = pair[1]; st.equal(ES.IsStrictlyEqual(a, b), a === b, debug(a) + ' === ' + debug(b)); st.equal(ES.IsStrictlyEqual(b, a), b === a, debug(b) + ' === ' + debug(a)); }); st.end(); }); t.end(); }); test('IsLooselyEqual', function (t) { t.test('same types use ===', function (st) { forEach(v.primitives.concat(v.objects), function (value) { st.equal(ES.IsLooselyEqual(value, value), value === value, debug(value) + ' is abstractly equal to itself'); }); st.end(); }); t.test('different types coerce', function (st) { var pairs = [ [null, undefined], [3, '3'], [true, '3'], [true, 3], [false, 0], [false, '0'], [3, [3]], ['3', [3]], [true, [1]], [false, [0]], [String(v.coercibleObject), v.coercibleObject], [Number(String(v.coercibleObject)), v.coercibleObject], [Number(v.coercibleObject), v.coercibleObject], [String(Number(v.coercibleObject)), v.coercibleObject] ]; forEach(pairs, function (pair) { var a = pair[0]; var b = pair[1]; // eslint-disable-next-line eqeqeq st.equal(ES.IsLooselyEqual(a, b), a == b, debug(a) + ' == ' + debug(b)); // eslint-disable-next-line eqeqeq st.equal(ES.IsLooselyEqual(b, a), b == a, debug(b) + ' == ' + debug(a)); }); st.end(); }); t.end(); }); test('IsLessThan', function (t) { t.test('at least one operand is NaN', function (st) { st.equal(ES.IsLessThan(NaN, {}, true), undefined, 'LeftFirst: first is NaN, returns undefined'); st.equal(ES.IsLessThan({}, NaN, true), undefined, 'LeftFirst: second is NaN, returns undefined'); st.equal(ES.IsLessThan(NaN, {}, false), undefined, '!LeftFirst: first is NaN, returns undefined'); st.equal(ES.IsLessThan({}, NaN, false), undefined, '!LeftFirst: second is NaN, returns undefined'); st.end(); }); forEach(v.nonBooleans, function (nonBoolean) { t['throws']( function () { ES.IsLessThan(3, 4, nonBoolean); }, TypeError, debug(nonBoolean) + ' is not a Boolean' ); }); forEach(v.zeroes, function (zero) { t.equal(ES.IsLessThan(zero, 1, true), true, 'LeftFirst: ' + debug(zero) + ' is less than 1'); t.equal(ES.IsLessThan(zero, 1, false), true, '!LeftFirst: ' + debug(zero) + ' is less than 1'); t.equal(ES.IsLessThan(1, zero, true), false, 'LeftFirst: 1 is not less than ' + debug(zero)); t.equal(ES.IsLessThan(1, zero, false), false, '!LeftFirst: 1 is not less than ' + debug(zero)); t.equal(ES.IsLessThan(zero, zero, true), false, 'LeftFirst: ' + debug(zero) + ' is not less than ' + debug(zero)); t.equal(ES.IsLessThan(zero, zero, false), false, '!LeftFirst: ' + debug(zero) + ' is not less than ' + debug(zero)); }); t.equal(ES.IsLessThan(Infinity, -Infinity, true), false, 'LeftFirst: ∞ is not less than -∞'); t.equal(ES.IsLessThan(Infinity, -Infinity, false), false, '!LeftFirst: ∞ is not less than -∞'); t.equal(ES.IsLessThan(-Infinity, Infinity, true), true, 'LeftFirst: -∞ is less than ∞'); t.equal(ES.IsLessThan(-Infinity, Infinity, false), true, '!LeftFirst: -∞ is less than ∞'); t.equal(ES.IsLessThan(-Infinity, 0, true), true, 'LeftFirst: -∞ is less than +0'); t.equal(ES.IsLessThan(-Infinity, 0, false), true, '!LeftFirst: -∞ is less than +0'); t.equal(ES.IsLessThan(0, -Infinity, true), false, 'LeftFirst: +0 is not less than -∞'); t.equal(ES.IsLessThan(0, -Infinity, false), false, '!LeftFirst: +0 is not less than -∞'); t.equal(ES.IsLessThan(3, 4, true), true, 'LeftFirst: 3 is less than 4'); t.equal(ES.IsLessThan(4, 3, true), false, 'LeftFirst: 3 is not less than 4'); t.equal(ES.IsLessThan(3, 4, false), true, '!LeftFirst: 3 is less than 4'); t.equal(ES.IsLessThan(4, 3, false), false, '!LeftFirst: 3 is not less than 4'); t.equal(ES.IsLessThan('3', '4', true), true, 'LeftFirst: "3" is less than "4"'); t.equal(ES.IsLessThan('4', '3', true), false, 'LeftFirst: "3" is not less than "4"'); t.equal(ES.IsLessThan('3', '4', false), true, '!LeftFirst: "3" is less than "4"'); t.equal(ES.IsLessThan('4', '3', false), false, '!LeftFirst: "3" is not less than "4"'); t.equal(ES.IsLessThan('a', 'abc', true), true, 'LeftFirst: "a" is less than "abc"'); t.equal(ES.IsLessThan('abc', 'a', true), false, 'LeftFirst: "abc" is not less than "a"'); t.equal(ES.IsLessThan('a', 'abc', false), true, '!LeftFirst: "a" is less than "abc"'); t.equal(ES.IsLessThan('abc', 'a', false), false, '!LeftFirst: "abc" is not less than "a"'); t.equal(ES.IsLessThan(v.coercibleObject, 42, true), true, 'LeftFirst: coercible object is less than 42'); t.equal(ES.IsLessThan(42, v.coercibleObject, true), false, 'LeftFirst: 42 is not less than coercible object'); t.equal(ES.IsLessThan(v.coercibleObject, 42, false), true, '!LeftFirst: coercible object is less than 42'); t.equal(ES.IsLessThan(42, v.coercibleObject, false), false, '!LeftFirst: 42 is not less than coercible object'); t.equal(ES.IsLessThan(v.coercibleObject, '3', true), false, 'LeftFirst: coercible object is not less than "3"'); t.equal(ES.IsLessThan('3', v.coercibleObject, true), false, 'LeftFirst: "3" is not less than coercible object'); t.equal(ES.IsLessThan(v.coercibleObject, '3', false), false, '!LeftFirst: coercible object is not less than "3"'); t.equal(ES.IsLessThan('3', v.coercibleObject, false), false, '!LeftFirst: "3" is not less than coercible object'); t.end(); }); test('IsStringWellFormedUnicode', function (t) { forEach(v.nonStrings, function (notString) { t['throws']( function () { return ES.IsStringWellFormedUnicode(notString); }, TypeError, debug(notString) + ' is not a string' ); }); forEach(v.strings.concat(wholePoo), function (string) { t.equal(ES.IsStringWellFormedUnicode(string), true, debug(string) + ' is well-formed unicode'); }); forEach([leadingPoo, trailingPoo], function (badString) { t.equal(ES.IsStringWellFormedUnicode(badString), false, debug(badString) + ' is not well-formed unicode'); }); t.end(); }); test('MakeMatchIndicesIndexPairArray', function (t) { forEach(v.nonStrings, function (notString) { t['throws']( function () { return ES.MakeMatchIndicesIndexPairArray(notString); }, TypeError, '`S`: ' + debug(notString) + ' is not a string' ); }); forEach(v.nonArrays, function (nonArray) { t['throws']( function () { return ES.MakeMatchIndicesIndexPairArray('', nonArray); }, TypeError, '`indices`: ' + debug(nonArray) + ' is not a List' ); t['throws']( function () { return ES.MakeMatchIndicesIndexPairArray('', [undefined], nonArray); }, TypeError, '`groupNames`: ' + debug(nonArray) + ' is not a List' ); }); forEach(v.nonBooleans, function (nonBoolean) { t['throws']( function () { ES.MakeMatchIndicesIndexPairArray('', [undefined], [], nonBoolean); }, TypeError, '`hasGroups`: ' + debug(nonBoolean) + ' is not a Boolean' ); }); t.deepEqual( ES.MakeMatchIndicesIndexPairArray( 'abc', [undefined, { '[[StartIndex]]': 0, '[[EndIndex]]': 1 }, { '[[StartIndex]]': 1, '[[EndIndex]]': 3 }], [undefined, undefined], false ), assign([undefined, [0, 1], [1, 3]], { groups: undefined }), 'no groups' ); t.test('has groups', { skip: !Object.create && !$setProto }, function (st) { var result = ES.MakeMatchIndicesIndexPairArray( 'abc', [undefined, { '[[StartIndex]]': 0, '[[EndIndex]]': 1 }, { '[[StartIndex]]': 1, '[[EndIndex]]': 3 }], ['G1', 'G2'], true ); st.equal('toString' in {}, true, 'normal objects have toString'); st.equal('toString' in result.groups, false, 'makes a null `groups` object'); st.deepEqual( result, assign( [undefined, [0, 1], [1, 3]], { groups: $setProto({ G1: [0, 1], G2: [1, 3] }, null) } ), 'has groups, no group names' ); st.end(); }); t.test('has groups when no native Object.create', { skip: Object.create || $setProto }, function (st) { st['throws']( function () { ES.MakeMatchIndicesIndexPairArray(null); }, SyntaxError, 'without a native Object.create, can not create null objects' ); st.end(); }); t.end(); }); test('RegExpHasFlag', function (t) { forEach(v.primitives, function (primitive) { t['throws']( function () { ES.RegExpHasFlag(primitive, 'x'); }, TypeError, 'R must be an Object; ' + debug(primitive) + ' is not one' ); }); forEach(v.nonStrings, function (nonString) { t['throws']( function () { return ES.RegExpHasFlag({}, nonString); }, TypeError, debug(nonString) + ' is not a string' ); }); var allFlags = new RegExp('a', supportedRegexFlags.join('')); forEach(supportedRegexFlags, function (flag) { t.equal(ES.RegExpHasFlag(/a/, flag), false, 'regex with no flags does not have flag ' + flag); var r = new RegExp('a', flag); t.equal(ES.RegExpHasFlag(r, flag), true, debug(r) + ' has flag ' + flag); t.equal(ES.RegExpHasFlag(allFlags, flag), true, debug(allFlags) + ' has flag ' + flag); }); t.end(); }); test('SortIndexedProperties', function (t) { /* eslint no-unused-vars: 0 */ var emptySortCompare = function (a, b) {}; forEach(v.primitives, function (primitive) { t['throws']( function () { ES.SortIndexedProperties(primitive, 0, emptySortCompare); }, TypeError, 'obj must be an Object; ' + debug(primitive) + ' is not one' ); }); forEach(v.notNonNegativeIntegers, function (nonNonNegativeInteger) { t['throws']( function () { ES.SortIndexedProperties({}, nonNonNegativeInteger, emptySortCompare); }, TypeError, '`len`: ' + debug(nonNonNegativeInteger) + ' is not a non-negative integer' ); }); forEach( v.nonFunctions.concat( function () {}, function f(a, b) { return 0; }, function (a) { return 0; }, arrowFns.length > 0 ? [ /* eslint no-new-func: 1 */ Function('return () => {}')(), Function('return (a) => {}')(), Function('return (a, b, c) => {}')() ] : [] ), function (nonTwoArgAbstractClosure) { t['throws']( function () { ES.SortIndexedProperties({}, 0, nonTwoArgAbstractClosure); }, TypeError, '`len`: ' + debug(nonTwoArgAbstractClosure) + ' is not an abstract closure taking two args' ); } ); forEach([ function (a, b) { return 0; } ].concat(arrowFns.length > 0 ? [ /* eslint no-new-func: 1 */ Function('return (a, b) => 0')() ] : []), function (ac) { t.doesNotThrow( function () { ES.SortIndexedProperties({}, 0, ac); }, 'an abstract closure taking two args is accepted' ); }); var o = [1, 3, 2, 0]; t.equal( ES.SortIndexedProperties(o, 3, function (a, b) { return a - b; }), o, 'passed object is returned' ); t.deepEqual( o, [1, 2, 3, 0], 'object is sorted up to `len`' ); t.equal( ES.SortIndexedProperties(o, 4, function (a, b) { return a - b; }), o, 'passed object is returned' ); t.deepEqual( o, [0, 1, 2, 3], 'object is again sorted up to `len`' ); t.end(); }); test('StringToNumber', function (t) { testStringToNumber(t, ES, ES.StringToNumber); t.end(); }); test('ToZeroPaddedDecimalString', function (t) { forEach(v.notNonNegativeIntegers, function (notNonNegativeInteger) { t['throws']( function () { ES.ToZeroPaddedDecimalString(notNonNegativeInteger); }, RangeError, debug(notNonNegativeInteger) + ' is not a non-negative integer' ); }); t.equal(ES.ToZeroPaddedDecimalString(1, 1), '1'); t.equal(ES.ToZeroPaddedDecimalString(1, 2), '01'); t.equal(ES.ToZeroPaddedDecimalString(1, 3), '001'); t.end(); }); }; module.exports = { es5: es5, es2015: es2015, es2016: es2016, es2017: es2017, es2018: es2018, es2019: es2019, es2020: es2020, es2021: es2021, es2022: es2022 };