es-abstract
Advanced tools
Comparing version 1.14.2 to 1.15.0
@@ -0,1 +1,16 @@ | ||
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 | ||
@@ -2,0 +17,0 @@ ================= |
@@ -20,3 +20,3 @@ 'use strict'; | ||
var $RegExp = GetIntrinsic('%RegExp%'); | ||
var $Promise = GetIntrinsic('%Promise%', true); | ||
var $Date = GetIntrinsic('%Date%'); | ||
var $preventExtensions = $Object.preventExtensions; | ||
@@ -30,3 +30,3 @@ | ||
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; | ||
var MAX_SAFE_INTEGER = $Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; | ||
var MAX_SAFE_INTEGER = require('./helpers/maxSafeInteger'); | ||
@@ -42,25 +42,27 @@ var assign = require('./helpers/assign'); | ||
var parseInteger = parseInt; | ||
var callBind = require('./helpers/callBind'); | ||
var $PromiseThen = $Promise ? callBind(GetIntrinsic('%PromiseProto_then%')) : null; | ||
var arraySlice = callBind($Array.prototype.slice); | ||
var strSlice = callBind($String.prototype.slice); | ||
var isBinary = callBind($RegExp.prototype.test, /^0b[01]+$/i); | ||
var isOctal = callBind($RegExp.prototype.test, /^0o[0-7]+$/i); | ||
var isDigit = callBind($RegExp.prototype.test, /^[0-9]$/); | ||
var regexExec = callBind($RegExp.prototype.exec); | ||
var callBound = require('./helpers/callBound'); | ||
var regexTester = require('./helpers/regexTester'); | ||
var $PromiseThen = callBound('Promise.prototype.then', true); | ||
var arraySlice = callBound('Array.prototype.slice'); | ||
var strSlice = callBound('String.prototype.slice'); | ||
var isBinary = regexTester(/^0b[01]+$/i); | ||
var isOctal = regexTester(/^0o[0-7]+$/i); | ||
var isDigit = regexTester(/^[0-9]$/); | ||
var regexExec = callBound('RegExp.prototype.exec'); | ||
var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); | ||
var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); | ||
var hasNonWS = callBind($RegExp.prototype.test, nonWSregex); | ||
var invalidHexLiteral = /^[-+]0x[0-9a-f]+$/i; | ||
var isInvalidHexLiteral = callBind($RegExp.prototype.test, invalidHexLiteral); | ||
var $charCodeAt = callBind($String.prototype.charCodeAt); | ||
var $isEnumerable = callBind($Object.prototype.propertyIsEnumerable); | ||
var hasNonWS = regexTester(nonWSregex); | ||
var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i); | ||
var $charCodeAt = callBound('String.prototype.charCodeAt'); | ||
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); | ||
var toStr = callBind($Object.prototype.toString); | ||
var toStr = callBound('Object.prototype.toString'); | ||
var $NumberValueOf = callBind(GetIntrinsic('%NumberPrototype%').valueOf); | ||
var $BooleanValueOf = callBind(GetIntrinsic('%BooleanPrototype%').valueOf); | ||
var $StringValueOf = callBind(GetIntrinsic('%StringPrototype%').valueOf); | ||
var $DateValueOf = callBind(GetIntrinsic('%DatePrototype%').valueOf); | ||
var $SymbolToString = hasSymbols && callBind(GetIntrinsic('%SymbolPrototype%').toString); | ||
var $NumberValueOf = callBound('Number.prototype.valueOf'); | ||
var $BooleanValueOf = callBound('Boolean.prototype.valueOf'); | ||
var $StringValueOf = callBound('String.prototype.valueOf'); | ||
var $DateValueOf = callBound('Date.prototype.valueOf'); | ||
var $SymbolToString = callBound('Symbol.prototype.toString', true); | ||
@@ -119,3 +121,3 @@ var $floor = Math.floor; | ||
var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); | ||
var $replace = callBind($String.prototype.replace); | ||
var $replace = callBound('String.prototype.replace'); | ||
var trim = function (value) { | ||
@@ -986,3 +988,3 @@ return $replace(value, trimRegex, ''); | ||
} | ||
if (!$Promise) { // Promises are not supported | ||
if (!$PromiseThen) { // Promises are not supported | ||
return false; | ||
@@ -1382,2 +1384,13 @@ } | ||
return result; | ||
}, | ||
// https://ecma-international.org/ecma-262/6.0/#sec-todatestring | ||
ToDateString: function ToDateString(tv) { | ||
if (this.Type(tv) !== 'Number') { | ||
throw new $TypeError('Assertion failed: `tv` must be a Number'); | ||
} | ||
if ($isNaN(tv)) { | ||
return 'Invalid Date'; | ||
} | ||
return $Date(tv); | ||
} | ||
@@ -1384,0 +1397,0 @@ }); |
'use strict'; | ||
var GetIntrinsic = require('./GetIntrinsic'); | ||
var $Array = GetIntrinsic('%Array%'); | ||
var hasSymbols = require('has-symbols')(); | ||
@@ -11,8 +7,9 @@ | ||
var assign = require('./helpers/assign'); | ||
var callBind = require('./helpers/callBind'); | ||
var $arrayPush = callBind($Array.prototype.push); | ||
var $arraySlice = callBind($Array.prototype.slice); | ||
var $arrayJoin = callBind($Array.prototype.join); | ||
var callBound = require('./helpers/callBound'); | ||
var $arrayPush = callBound('Array.prototype.push'); | ||
var $arraySlice = callBound('Array.prototype.slice'); | ||
var $arrayJoin = callBound('Array.prototype.join'); | ||
var ES2016 = assign(assign({}, ES2015), { | ||
@@ -19,0 +16,0 @@ // https://www.ecma-international.org/ecma-262/7.0/#sec-samevaluenonnumber |
@@ -11,6 +11,6 @@ 'use strict'; | ||
var $TypeError = GetIntrinsic('%TypeError%'); | ||
var $Array = GetIntrinsic('%Array%'); | ||
var $isEnumerable = callBind(GetIntrinsic('%ObjectPrototype%').propertyIsEnumerable); | ||
var $pushApply = callBind.apply(GetIntrinsic('%ArrayPrototype%').push); | ||
var $arrayPush = callBind($Array.prototype.push); | ||
var callBound = require('./helpers/callBound'); | ||
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); | ||
var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%')); | ||
var $arrayPush = callBound('Array.prototype.push'); | ||
@@ -17,0 +17,0 @@ var ES2017 = assign(assign({}, ES2016), { |
@@ -13,24 +13,32 @@ 'use strict'; | ||
var every = require('./helpers/every'); | ||
var isPrefixOf = require('./helpers/isPrefixOf'); | ||
var $String = GetIntrinsic('%String%'); | ||
var $Object = GetIntrinsic('%Object%'); | ||
var $TypeError = GetIntrinsic('%TypeError%'); | ||
var $RegExp = GetIntrinsic('%RegExp%'); | ||
var $SymbolProto = GetIntrinsic('%SymbolPrototype%', true); | ||
var $SymbolValueOf = $SymbolProto ? callBind($SymbolProto.valueOf) : null; | ||
var $StringProto = GetIntrinsic('%StringPrototype%'); | ||
var $charAt = callBind($StringProto.charAt); | ||
var strSlice = callBind($StringProto.slice); | ||
var $indexOf = callBind($StringProto.indexOf); | ||
var callBound = require('./helpers/callBound'); | ||
var regexTester = require('./helpers/regexTester'); | ||
var $isNaN = require('./helpers/isNaN'); | ||
var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true); | ||
// var $charAt = callBound('String.prototype.charAt'); | ||
var $strSlice = callBound('String.prototype.slice'); | ||
var $indexOf = callBound('String.prototype.indexOf'); | ||
var $parseInt = parseInt; | ||
var isDigit = callBind($RegExp.prototype.test, /^[0-9]$/); | ||
var $PromiseResolveOrig = GetIntrinsic('%Promise_resolve%', true); | ||
var $PromiseResolve = $PromiseResolveOrig ? callBind($PromiseResolveOrig) : null; | ||
var isDigit = regexTester(/^[0-9]$/); | ||
var $isEnumerable = callBind(GetIntrinsic('%ObjectPrototype%').propertyIsEnumerable); | ||
var $pushApply = callBind.apply(GetIntrinsic('%ArrayPrototype%').push); | ||
var $gOPS = $SymbolValueOf ? $Object.getOwnPropertySymbols : null; | ||
var $PromiseResolve = callBound('Promise.resolve', true); | ||
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); | ||
var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%')); | ||
var $gOPS = $SymbolValueOf ? GetIntrinsic('%Object.getOwnPropertySymbols%') : null; | ||
var padTimeComponent = function padTimeComponent(c, count) { | ||
return $strSlice('00' + c, -(count || 2)); | ||
}; | ||
var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; | ||
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | ||
var OwnPropertyKeys = function OwnPropertyKeys(ES, source) { | ||
@@ -68,2 +76,4 @@ var ownKeys = keys(source); | ||
return isPrefixOf(p, q); | ||
/* | ||
if (p === q || p === '') { | ||
@@ -87,2 +97,3 @@ return true; | ||
return true; | ||
*/ | ||
}, | ||
@@ -203,6 +214,6 @@ | ||
} else if (next === '`') { | ||
result += position === 0 ? '' : strSlice(str, 0, position - 1); | ||
result += position === 0 ? '' : $strSlice(str, 0, position - 1); | ||
i += 1; | ||
} else if (next === "'") { | ||
result += tailPos >= stringLength ? '' : strSlice(str, tailPos); | ||
result += tailPos >= stringLength ? '' : $strSlice(str, tailPos); | ||
i += 1; | ||
@@ -233,3 +244,3 @@ } else { | ||
if (endIndex > -1) { | ||
var groupName = strSlice(replacement, i, endIndex); | ||
var groupName = $strSlice(replacement, i, endIndex); | ||
var capture = this.Get(namedCaptures, groupName); | ||
@@ -253,2 +264,25 @@ // eslint-disable-next-line max-depth | ||
return result; | ||
}, | ||
// https://www.ecma-international.org/ecma-262/9.0/#sec-datestring | ||
DateString: function DateString(tv) { | ||
if (this.Type(tv) !== 'Number' || $isNaN(tv)) { | ||
throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); | ||
} | ||
var weekday = weekdays[this.WeekDay(tv)]; | ||
var month = months[this.MonthFromTime(tv)]; | ||
var day = padTimeComponent(this.DateFromTime(tv)); | ||
var year = padTimeComponent(this.YearFromTime(tv), 4); | ||
return weekday + '\x20' + month + '\x20' + day + '\x20' + year; | ||
}, | ||
// https://www.ecma-international.org/ecma-262/9.0/#sec-timestring | ||
TimeString: function TimeString(tv) { | ||
if (this.Type(tv) !== 'Number' || $isNaN(tv)) { | ||
throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); | ||
} | ||
var hour = this.HourFromTime(tv); | ||
var minute = this.MinFromTime(tv); | ||
var second = this.SecFromTime(tv); | ||
return padTimeComponent(hour) + ':' + padTimeComponent(minute) + ':' + padTimeComponent(second) + '\x20GMT'; | ||
} | ||
@@ -255,0 +289,0 @@ }); |
@@ -9,2 +9,3 @@ 'use strict'; | ||
var assign = require('./helpers/assign'); | ||
var MAX_SAFE_INTEGER = require('./helpers/maxSafeInteger'); | ||
@@ -14,4 +15,2 @@ var GetIntrinsic = require('./GetIntrinsic'); | ||
var $TypeError = GetIntrinsic('%TypeError%'); | ||
var $Number = GetIntrinsic('%Number%'); | ||
var MAX_SAFE_INTEGER = $Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; | ||
@@ -18,0 +17,0 @@ var ES2019 = assign(assign({}, ES2018), { |
254
es5.js
@@ -6,5 +6,10 @@ 'use strict'; | ||
var $Object = GetIntrinsic('%Object%'); | ||
var $EvalError = GetIntrinsic('%EvalError%'); | ||
var $TypeError = GetIntrinsic('%TypeError%'); | ||
var $String = GetIntrinsic('%String%'); | ||
var $Date = GetIntrinsic('%Date%'); | ||
var $Number = GetIntrinsic('%Number%'); | ||
var $floor = GetIntrinsic('%Math.floor%'); | ||
var $DateUTC = GetIntrinsic('%Date.UTC%'); | ||
var $abs = GetIntrinsic('%Math.abs%'); | ||
@@ -15,5 +20,6 @@ var assertRecord = require('./helpers/assertRecord'); | ||
var $isFinite = require('./helpers/isFinite'); | ||
var sign = require('./helpers/sign'); | ||
var mod = require('./helpers/mod'); | ||
var isPrefixOf = require('./helpers/isPrefixOf'); | ||
var callBound = require('./helpers/callBound'); | ||
@@ -25,14 +31,11 @@ var IsCallable = require('is-callable'); | ||
var callBind = require('./helpers/callBind'); | ||
var strSlice = callBind($String.prototype.slice); | ||
var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); | ||
var isPrefixOf = function isPrefixOf(prefix, string) { | ||
if (prefix === string) { | ||
return true; | ||
} | ||
if (prefix.length > string.length) { | ||
return false; | ||
} | ||
return strSlice(string, 0, prefix.length) === prefix; | ||
}; | ||
var HoursPerDay = 24; | ||
var MinutesPerHour = 60; | ||
var SecondsPerMinute = 60; | ||
var msPerSecond = 1e3; | ||
var msPerMinute = msPerSecond * SecondsPerMinute; | ||
var msPerHour = msPerMinute * MinutesPerHour; | ||
var msPerDay = 86400000; | ||
@@ -90,3 +93,3 @@ // https://es5.github.io/#x9 | ||
// https://www.ecma-international.org/ecma-262/5.1/#sec-8 | ||
// https://ecma-international.org/ecma-262/5.1/#sec-8 | ||
Type: function Type(x) { | ||
@@ -230,3 +233,3 @@ if (x === null) { | ||
// https://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3 | ||
// https://ecma-international.org/ecma-262/5.1/#sec-11.9.3 | ||
'Abstract Equality Comparison': function AbstractEqualityComparison(x, y) { | ||
@@ -262,3 +265,3 @@ var xType = this.Type(x); | ||
// https://www.ecma-international.org/ecma-262/5.1/#sec-11.9.6 | ||
// https://ecma-international.org/ecma-262/5.1/#sec-11.9.6 | ||
'Strict Equality Comparison': function StrictEqualityComparison(x, y) { | ||
@@ -276,3 +279,3 @@ var xType = this.Type(x); | ||
// https://www.ecma-international.org/ecma-262/5.1/#sec-11.8.5 | ||
// https://ecma-international.org/ecma-262/5.1/#sec-11.8.5 | ||
// eslint-disable-next-line max-statements | ||
@@ -326,2 +329,221 @@ 'Abstract Relational Comparison': function AbstractRelationalComparison(x, y, LeftFirst) { | ||
return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.10 | ||
msFromTime: function msFromTime(t) { | ||
return mod(t, msPerSecond); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.10 | ||
SecFromTime: function SecFromTime(t) { | ||
return mod($floor(t / msPerSecond), SecondsPerMinute); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.10 | ||
MinFromTime: function MinFromTime(t) { | ||
return mod($floor(t / msPerMinute), MinutesPerHour); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.10 | ||
HourFromTime: function HourFromTime(t) { | ||
return mod($floor(t / msPerHour), HoursPerDay); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.2 | ||
Day: function Day(t) { | ||
return $floor(t / msPerDay); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.2 | ||
TimeWithinDay: function TimeWithinDay(t) { | ||
return mod(t, msPerDay); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.3 | ||
DayFromYear: function DayFromYear(y) { | ||
return (365 * (y - 1970)) + $floor((y - 1969) / 4) - $floor((y - 1901) / 100) + $floor((y - 1601) / 400); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.3 | ||
TimeFromYear: function TimeFromYear(y) { | ||
return msPerDay * this.DayFromYear(y); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.3 | ||
YearFromTime: function YearFromTime(t) { | ||
// largest y such that this.TimeFromYear(y) <= t | ||
return $getUTCFullYear(new $Date(t)); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.6 | ||
WeekDay: function WeekDay(t) { | ||
return mod(this.Day(t) + 4, 7); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.3 | ||
DaysInYear: function DaysInYear(y) { | ||
if (mod(y, 4) !== 0) { | ||
return 365; | ||
} | ||
if (mod(y, 100) !== 0) { | ||
return 366; | ||
} | ||
if (mod(y, 400) !== 0) { | ||
return 365; | ||
} | ||
return 366; | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.3 | ||
InLeapYear: function InLeapYear(t) { | ||
var days = this.DaysInYear(this.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); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.4 | ||
DayWithinYear: function DayWithinYear(t) { | ||
return this.Day(t) - this.DayFromYear(this.YearFromTime(t)); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.4 | ||
MonthFromTime: function MonthFromTime(t) { | ||
var day = this.DayWithinYear(t); | ||
if (0 <= day && day < 31) { | ||
return 0; | ||
} | ||
var leap = this.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; | ||
} | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.5 | ||
DateFromTime: function DateFromTime(t) { | ||
var m = this.MonthFromTime(t); | ||
var d = this.DayWithinYear(t); | ||
if (m === 0) { | ||
return d + 1; | ||
} | ||
if (m === 1) { | ||
return d - 30; | ||
} | ||
var leap = this.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); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.12 | ||
MakeDay: function MakeDay(year, month, date) { | ||
if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { | ||
return NaN; | ||
} | ||
var y = this.ToInteger(year); | ||
var m = this.ToInteger(month); | ||
var dt = this.ToInteger(date); | ||
var ym = y + $floor(m / 12); | ||
var mn = mod(m, 12); | ||
var t = $DateUTC(ym, mn, 1); | ||
if (this.YearFromTime(t) !== ym || this.MonthFromTime(t) !== mn || this.DateFromTime(t) !== 1) { | ||
return NaN; | ||
} | ||
return this.Day(t) + dt - 1; | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.13 | ||
MakeDate: function MakeDate(day, time) { | ||
if (!$isFinite(day) || !$isFinite(time)) { | ||
return NaN; | ||
} | ||
return (day * msPerDay) + time; | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.11 | ||
MakeTime: function MakeTime(hour, min, sec, ms) { | ||
if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { | ||
return NaN; | ||
} | ||
var h = this.ToInteger(hour); | ||
var m = this.ToInteger(min); | ||
var s = this.ToInteger(sec); | ||
var milli = this.ToInteger(ms); | ||
var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; | ||
return t; | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.14 | ||
TimeClip: function TimeClip(time) { | ||
if (!$isFinite(time) || $abs(time) > 8.64e15) { | ||
return NaN; | ||
} | ||
return $Number(new $Date(this.ToNumber(time))); | ||
}, | ||
// https://ecma-international.org/ecma-262/5.1/#sec-5.2 | ||
modulo: function modulo(x, y) { | ||
return mod(x, y); | ||
} | ||
@@ -328,0 +550,0 @@ }; |
@@ -10,7 +10,9 @@ 'use strict'; | ||
var $TypeError = TypeError; | ||
var ThrowTypeError = Object.getOwnPropertyDescriptor | ||
? (function () { return Object.getOwnPropertyDescriptor(arguments, 'callee').get; }()) | ||
: function () { throw new TypeError(); }; | ||
: function () { throw new $TypeError(); }; | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol'; | ||
var hasSymbols = require('has-symbols')(); | ||
@@ -123,4 +125,4 @@ var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto | ||
'$ %TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined, | ||
'$ %TypeError%': TypeError, | ||
'$ %TypeErrorPrototype%': TypeError.prototype, | ||
'$ %TypeError%': $TypeError, | ||
'$ %TypeErrorPrototype%': $TypeError.prototype, | ||
'$ %Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, | ||
@@ -142,7 +144,18 @@ '$ %Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array.prototype, | ||
module.exports = function GetIntrinsic(name, allowMissing) { | ||
if (arguments.length > 1 && typeof allowMissing !== 'boolean') { | ||
throw new TypeError('"allowMissing" argument must be a boolean'); | ||
} | ||
var bind = require('function-bind'); | ||
var $replace = bind.call(Function.call, String.prototype.replace); | ||
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ | ||
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; | ||
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ | ||
var stringToPath = function stringToPath(string) { | ||
var result = []; | ||
$replace(string, rePropName, function (match, number, quote, subString) { | ||
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : (number || match); | ||
}); | ||
return result; | ||
}; | ||
/* end adaptation */ | ||
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { | ||
var key = '$ ' + name; | ||
@@ -155,5 +168,26 @@ if (!(key in INTRINSICS)) { | ||
if (typeof INTRINSICS[key] === 'undefined' && !allowMissing) { | ||
throw new TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); | ||
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); | ||
} | ||
return INTRINSICS[key]; | ||
}; | ||
module.exports = function GetIntrinsic(name, allowMissing) { | ||
if (arguments.length > 1 && typeof allowMissing !== 'boolean') { | ||
throw new TypeError('"allowMissing" argument must be a boolean'); | ||
} | ||
var parts = stringToPath(name); | ||
if (parts.length === 0) { | ||
return getBaseIntrinsic(name, allowMissing); | ||
} | ||
var value = getBaseIntrinsic('%' + parts[0] + '%', allowMissing); | ||
for (var i = 1; i < parts.length; i += 1) { | ||
if (value != null) { | ||
value = value[parts[i]]; | ||
} | ||
} | ||
return value; | ||
}; |
{ | ||
"name": "es-abstract", | ||
"version": "1.14.2", | ||
"version": "1.15.0", | ||
"author": { | ||
@@ -54,4 +54,4 @@ "name": "Jordan Harband", | ||
"object-keys": "^1.1.1", | ||
"string.prototype.trimleft": "^2.0.0", | ||
"string.prototype.trimright": "^2.0.0" | ||
"string.prototype.trimleft": "^2.1.0", | ||
"string.prototype.trimright": "^2.1.0" | ||
}, | ||
@@ -61,4 +61,5 @@ "devDependencies": { | ||
"cheerio": "^1.0.0-rc.3", | ||
"diff": "^4.0.1", | ||
"eclint": "^2.8.1", | ||
"eslint": "^6.3.0", | ||
"eslint": "^6.5.1", | ||
"foreach": "^2.0.5", | ||
@@ -65,0 +66,0 @@ "nyc": "^10.3.2", |
@@ -7,4 +7,4 @@ 'use strict'; | ||
var expectedMissing = ['AddRestrictedFunctionProperties', 'AllocateArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CharacterRange', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateListFromArrayLike', 'CreateListIterator', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'DateFromTime', 'Day', 'DayFromYear', 'DayWithinYear', 'DaysInYear', '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', 'GetPrototypeFromConstructor', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GlobalDeclarationInstantiation', 'HostPromiseRejectionTracker', 'HostReportErrors', 'HostResolveImportedModule', 'HourFromTime', 'HoursPerDay', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InLeapYear', 'InitializeBoundName', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsCompatiblePropertyDescriptor', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsWordChar', 'LocalTime', 'LoopContinues', 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeDate', 'MakeDay', 'MakeMethod', 'MakeSuperPropertyReference', 'MakeTime', 'MinFromTime', 'MinutesPerHour', 'ModuleNamespaceCreate', 'MonthFromTime', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NextJob', 'NormalCompletion', 'ObjectDefineProperties', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryCreateFromConstructor', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryGetPrototypeOf', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'OrdinarySetPrototypeOf', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', 'QuoteJSONString', 'RegExpAlloc', 'RegExpBuiltinExec', 'RegExpCreate', 'RegExpInitialize', 'RejectPromise', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SecFromTime', 'SecondsPerMinute', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetFunctionName', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SortCompare', 'SplitMatch', 'StringCreate', 'TimeClip', 'TimeFromYear', 'TimeWithinDay', 'ToDateString', 'ToString Applied to the Number Type', 'TopLevelModuleEvaluationJob', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UTC', 'UTF16Decode', 'UTF16Encoding', 'UpdateEmpty', 'ValidateTypedArray', 'WeekDay', 'YearFromTime', 'abs', 'floor', 'max', 'min', 'modulo', 'msFromTime', 'msPerDay', 'msPerHour', 'msPerMinute', 'msPerSecond']; | ||
var expectedMissing = ['AddRestrictedFunctionProperties', 'AllocateArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CharacterRange', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateListFromArrayLike', 'CreateListIterator', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', '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', 'GetPrototypeFromConstructor', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GlobalDeclarationInstantiation', 'HostPromiseRejectionTracker', 'HostReportErrors', 'HostResolveImportedModule', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsCompatiblePropertyDescriptor', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsWordChar', 'LocalTime', 'LoopContinues', 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NextJob', 'NormalCompletion', 'ObjectDefineProperties', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryCreateFromConstructor', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryGetPrototypeOf', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'OrdinarySetPrototypeOf', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', 'QuoteJSONString', 'RegExpAlloc', 'RegExpBuiltinExec', 'RegExpCreate', 'RegExpInitialize', 'RejectPromise', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetFunctionName', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SortCompare', 'SplitMatch', 'StringCreate', 'ToString Applied to the Number Type', 'TopLevelModuleEvaluationJob', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UTC', 'UTF16Decode', 'UTF16Encoding', 'UpdateEmpty', 'ValidateTypedArray', 'abs', 'floor', 'max', 'min']; | ||
require('./tests').es2016(ES, ops, expectedMissing); |
@@ -7,4 +7,4 @@ 'use strict'; | ||
var expectedMissing = ['AddRestrictedFunctionProperties', 'AddWaiter', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFunctionAwait', 'AsyncFunctionCreate', 'AsyncFunctionStart', 'AtomicLoad', 'AtomicReadModifyWrite', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CharacterRange', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateListFromArrayLike', 'CreateListIterator', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'DateFromTime', 'Day', 'DayFromYear', 'DayWithinYear', 'DaysInYear', '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', 'GetPrototypeFromConstructor', 'GetReferencedName', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GetWaiterList', 'GlobalDeclarationInstantiation', 'HasPrimitiveBase', 'HostEnsureCanCompileStrings', 'HostEventSet', 'HostPromiseRejectionTracker', 'HostReportErrors', 'HostResolveImportedModule', 'HourFromTime', 'HoursPerDay', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InLeapYear', 'InitializeBoundName', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsCompatiblePropertyDescriptor', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsSharedArrayBuffer', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LoopContinues', 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeDate', 'MakeDay', 'MakeMethod', 'MakeSuperPropertyReference', 'MakeTime', 'MinFromTime', 'MinutesPerHour', 'ModuleNamespaceCreate', 'MonthFromTime', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NormalCompletion', 'NumberToRawBytes', 'ObjectDefineProperties', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryCreateFromConstructor', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryGetPrototypeOf', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'OrdinarySetPrototypeOf', 'OrdinaryToPrimitive', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', 'QuoteJSONString', 'RawBytesToNumber', 'RegExpAlloc', 'RegExpBuiltinExec', 'RegExpCreate', 'RegExpInitialize', 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'RunJobs', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SecFromTime', 'SecondsPerMinute', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetFunctionName', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', 'SplitMatch', 'StringCreate', 'StringGetOwnProperty', 'Suspend', 'TimeClip', 'TimeFromYear', 'TimeWithinDay', 'ToDateString', 'ToString Applied to the Number Type', 'TopLevelModuleEvaluationJob', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UTC', 'UTF16Decode', 'UTF16Encoding', 'UpdateEmpty', 'ValidateAtomicAccess', 'ValidateSharedIntegerTypedArray', 'ValidateTypedArray', 'ValueOfReadEvent', 'WakeWaiter', 'WeekDay', 'WordCharacters', 'YearFromTime', 'abs', 'agent-order', 'floor', 'happens-before', 'host-synchronizes-with', 'max', 'memory-order', 'min', 'modulo', 'msFromTime', 'msPerDay', 'msPerHour', 'msPerMinute', 'msPerSecond', 'reads-bytes-from', 'reads-from', 'synchronizes-with']; | ||
var expectedMissing = ['AddRestrictedFunctionProperties', 'AddWaiter', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFunctionAwait', 'AsyncFunctionCreate', 'AsyncFunctionStart', 'AtomicLoad', 'AtomicReadModifyWrite', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CharacterRange', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'Construct', 'CopyDataBlockBytes', 'CreateArrayFromList', 'CreateArrayIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateListFromArrayLike', 'CreateListIterator', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', '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', 'GetPrototypeFromConstructor', 'GetReferencedName', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GetWaiterList', 'GlobalDeclarationInstantiation', 'HasPrimitiveBase', 'HostEnsureCanCompileStrings', 'HostEventSet', 'HostPromiseRejectionTracker', 'HostReportErrors', 'HostResolveImportedModule', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsCompatiblePropertyDescriptor', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsSharedArrayBuffer', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LoopContinues', 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NormalCompletion', 'NumberToRawBytes', 'ObjectDefineProperties', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryCreateFromConstructor', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryGetPrototypeOf', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySet', 'OrdinarySetPrototypeOf', 'OrdinaryToPrimitive', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', 'QuoteJSONString', 'RawBytesToNumber', 'RegExpAlloc', 'RegExpBuiltinExec', 'RegExpCreate', 'RegExpInitialize', 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'RunJobs', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetFunctionName', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', 'SplitMatch', 'StringCreate', 'StringGetOwnProperty', 'Suspend', 'ToString Applied to the Number Type', 'TopLevelModuleEvaluationJob', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UTC', 'UTF16Decode', 'UTF16Encoding', 'UpdateEmpty', 'ValidateAtomicAccess', 'ValidateSharedIntegerTypedArray', 'ValidateTypedArray', 'ValueOfReadEvent', 'WakeWaiter', 'WordCharacters', 'abs', 'agent-order', 'floor', 'happens-before', 'host-synchronizes-with', 'max', 'memory-order', 'min', 'reads-bytes-from', 'reads-from', 'synchronizes-with']; | ||
require('./tests').es2017(ES, ops, expectedMissing); |
@@ -7,4 +7,4 @@ 'use strict'; | ||
var expectedMissing = ['abs', 'AddRestrictedFunctionProperties', 'AddWaiter', 'agent-order', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFunctionStart', 'AsyncGeneratorEnqueue', 'AsyncGeneratorReject', 'AsyncGeneratorResolve', 'AsyncGeneratorResumeNext', 'AsyncGeneratorStart', 'AsyncGeneratorYield', 'AtomicLoad', 'AtomicReadModifyWrite', 'Await', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CaseClauseIsSelected', 'CharacterRange', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'CopyDataBlockBytes', 'CreateArrayIterator', 'CreateAsyncFromSyncIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'DateFromTime', 'Day', 'DayFromYear', 'DaysInYear', 'DayWithinYear', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnqueueJob', 'EnterCriticalSection', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateNew', 'EventSet', 'floor', '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', 'GetPrototypeFromConstructor', 'GetReferencedName', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GetWaiterList', 'GlobalDeclarationInstantiation', 'happens-before', 'HasPrimitiveBase', 'host-synchronizes-with', 'HostEnsureCanCompileStrings', 'HostEventSet', 'HostPromiseRejectionTracker', 'HostReportErrors', 'HostResolveImportedModule', 'HourFromTime', 'HoursPerDay', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'InLeapYear', 'InnerModuleEvaluation', 'InnerModuleInstantiation', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsCompatiblePropertyDescriptor', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsSharedArrayBuffer', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LoopContinues', 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeDate', 'MakeDay', 'MakeMethod', 'MakeSuperPropertyReference', 'MakeTime', 'max', 'memory-order', 'min', 'MinFromTime', 'MinutesPerHour', 'ModuleDeclarationEnvironmentSetup', 'ModuleExecution', 'ModuleNamespaceCreate', 'modulo', 'MonthFromTime', 'msFromTime', 'msPerDay', 'msPerHour', 'msPerMinute', 'msPerSecond', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NumberToRawBytes', 'ObjectDefineProperties', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryCreateFromConstructor', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryGetPrototypeOf', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySetPrototypeOf', 'OrdinaryToPrimitive', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', 'QuoteJSONString', 'RawBytesToNumber', 'reads-bytes-from', 'reads-from', 'RegExpAlloc', 'RegExpCreate', 'RegExpInitialize', 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'RunJobs', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SecFromTime', 'SecondsPerMinute', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetFunctionName', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', 'SplitMatch', 'StringCreate', 'StringGetOwnProperty', 'Suspend', 'synchronizes-with', 'TimeClip', 'TimeFromYear', 'TimeWithinDay', 'TimeZoneString', 'TopLevelModuleEvaluationJob', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UnicodeEscape', 'UpdateEmpty', 'UTC', 'UTF16Decode', 'UTF16Encoding', 'ValidateAtomicAccess', 'ValidateSharedIntegerTypedArray', 'ValidateTypedArray', 'ValueOfReadEvent', 'WakeWaiter', 'WeekDay', 'WordCharacters', 'YearFromTime', 'AsyncFunctionCreate', 'AsyncGeneratorFunctionCreate', 'AsyncIteratorClose', 'BackreferenceMatcher', 'Construct', 'CreateArrayFromList', 'CreateListFromArrayLike', 'CreateListIteratorRecord', 'DateString', 'NormalCompletion', 'OrdinarySet', 'OrdinarySetWithOwnDescriptor', 'RegExpBuiltinExec', 'SetFunctionLength', 'ThrowCompletion', 'TimeString', 'ToDateString', 'UnicodeMatchProperty', 'UnicodeMatchPropertyValue']; | ||
var expectedMissing = ['abs', 'AddRestrictedFunctionProperties', 'AddWaiter', 'agent-order', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFunctionStart', 'AsyncGeneratorEnqueue', 'AsyncGeneratorReject', 'AsyncGeneratorResolve', 'AsyncGeneratorResumeNext', 'AsyncGeneratorStart', 'AsyncGeneratorYield', 'AtomicLoad', 'AtomicReadModifyWrite', 'Await', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CaseClauseIsSelected', 'CharacterRange', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'CopyDataBlockBytes', 'CreateArrayIterator', 'CreateAsyncFromSyncIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnqueueJob', 'EnterCriticalSection', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateNew', 'EventSet', 'floor', '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', 'GetPrototypeFromConstructor', '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', 'IsCompatiblePropertyDescriptor', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsSharedArrayBuffer', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LoopContinues', 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'max', 'memory-order', 'min', 'ModuleDeclarationEnvironmentSetup', 'ModuleExecution', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NumberToRawBytes', 'ObjectDefineProperties', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryCreateFromConstructor', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryGetPrototypeOf', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySetPrototypeOf', 'OrdinaryToPrimitive', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', 'QuoteJSONString', 'RawBytesToNumber', 'reads-bytes-from', 'reads-from', 'RegExpAlloc', 'RegExpCreate', 'RegExpInitialize', 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'RunJobs', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetFunctionName', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', 'SplitMatch', 'StringCreate', 'StringGetOwnProperty', 'Suspend', 'synchronizes-with', 'TimeZoneString', 'TopLevelModuleEvaluationJob', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UnicodeEscape', 'UpdateEmpty', 'UTC', 'UTF16Decode', 'UTF16Encoding', 'ValidateAtomicAccess', 'ValidateSharedIntegerTypedArray', 'ValidateTypedArray', 'ValueOfReadEvent', 'WakeWaiter', 'WordCharacters', 'AsyncFunctionCreate', 'AsyncGeneratorFunctionCreate', 'AsyncIteratorClose', 'BackreferenceMatcher', 'Construct', 'CreateArrayFromList', 'CreateListFromArrayLike', 'CreateListIteratorRecord', 'NormalCompletion', 'OrdinarySet', 'OrdinarySetWithOwnDescriptor', 'RegExpBuiltinExec', 'SetFunctionLength', 'ThrowCompletion', 'UnicodeMatchProperty', 'UnicodeMatchPropertyValue']; | ||
require('./tests').es2018(ES, ops, expectedMissing); |
@@ -7,4 +7,4 @@ 'use strict'; | ||
var expectedMissing = ['abs', 'AddRestrictedFunctionProperties', 'AddWaiter', 'agent-order', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFunctionStart', 'AsyncGeneratorEnqueue', 'AsyncGeneratorReject', 'AsyncGeneratorResolve', 'AsyncGeneratorResumeNext', 'AsyncGeneratorStart', 'AsyncGeneratorYield', 'AtomicLoad', 'AtomicReadModifyWrite', 'Await', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CaseClauseIsSelected', 'CharacterRange', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'CopyDataBlockBytes', 'CreateArrayIterator', 'CreateAsyncFromSyncIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'DateFromTime', 'Day', 'DayFromYear', 'DaysInYear', 'DayWithinYear', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnqueueJob', 'EnterCriticalSection', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateNew', 'EventSet', 'floor', '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', 'GetPrototypeFromConstructor', 'GetReferencedName', 'GetSuperConstructor', 'GetTemplateObject', 'GetThisEnvironment', 'GetThisValue', 'GetValue', 'GetValueFromBuffer', 'GetViewValue', 'GetWaiterList', 'GlobalDeclarationInstantiation', 'happens-before', 'HasPrimitiveBase', 'host-synchronizes-with', 'HostEnsureCanCompileStrings', 'HostEventSet', 'HostPromiseRejectionTracker', 'HostReportErrors', 'HostResolveImportedModule', 'HourFromTime', 'HoursPerDay', 'IfAbruptRejectPromise', 'ImportedLocalNames', 'InitializeBoundName', 'InitializeHostDefinedRealm', 'InitializeReferencedBinding', 'InLeapYear', 'InnerModuleEvaluation', 'InnerModuleInstantiation', 'IntegerIndexedElementGet', 'IntegerIndexedElementSet', 'IntegerIndexedObjectCreate', 'InternalizeJSONProperty', 'IsAnonymousFunctionDefinition', 'IsCompatiblePropertyDescriptor', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsSharedArrayBuffer', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LoopContinues', 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeDate', 'MakeDay', 'MakeMethod', 'MakeSuperPropertyReference', 'MakeTime', 'max', 'memory-order', 'min', 'MinFromTime', 'MinutesPerHour', 'ModuleDeclarationEnvironmentSetup', 'ModuleExecution', 'ModuleNamespaceCreate', 'modulo', 'MonthFromTime', 'msFromTime', 'msPerDay', 'msPerHour', 'msPerMinute', 'msPerSecond', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NumberToRawBytes', 'ObjectDefineProperties', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryCreateFromConstructor', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryGetPrototypeOf', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySetPrototypeOf', 'OrdinaryToPrimitive', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', 'QuoteJSONString', 'RawBytesToNumber', 'reads-bytes-from', 'reads-from', 'RegExpAlloc', 'RegExpCreate', 'RegExpInitialize', 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'RunJobs', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SecFromTime', 'SecondsPerMinute', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetFunctionName', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', 'SplitMatch', 'StringCreate', 'StringGetOwnProperty', 'Suspend', 'synchronizes-with', 'TimeClip', 'TimeFromYear', 'TimeWithinDay', 'TimeZoneString', 'TopLevelModuleEvaluationJob', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UnicodeEscape', 'UpdateEmpty', 'UTC', 'UTF16Decode', 'UTF16Encoding', 'ValidateAtomicAccess', 'ValidateSharedIntegerTypedArray', 'ValidateTypedArray', 'ValueOfReadEvent', 'WakeWaiter', 'WeekDay', 'WordCharacters', 'YearFromTime', 'AsyncFunctionCreate', 'AsyncGeneratorFunctionCreate', 'AsyncIteratorClose', 'BackreferenceMatcher', 'Construct', 'CreateArrayFromList', 'CreateListFromArrayLike', 'CreateListIteratorRecord', 'DateString', 'NormalCompletion', 'OrdinarySet', 'OrdinarySetWithOwnDescriptor', 'RegExpBuiltinExec', 'SetFunctionLength', 'ThrowCompletion', 'TimeString', 'ToDateString', 'UnicodeMatchProperty', 'UnicodeMatchPropertyValue', 'AsyncFromSyncIteratorContinuation', 'ExecuteModule', 'InitializeEnvironment', 'NotifyWaiter', 'SynchronizeEventSet']; | ||
var expectedMissing = ['abs', 'AddRestrictedFunctionProperties', 'AddWaiter', 'agent-order', 'AgentCanSuspend', 'AgentSignifier', 'AllocateArrayBuffer', 'AllocateSharedArrayBuffer', 'AllocateTypedArray', 'AllocateTypedArrayBuffer', 'AsyncFunctionStart', 'AsyncGeneratorEnqueue', 'AsyncGeneratorReject', 'AsyncGeneratorResolve', 'AsyncGeneratorResumeNext', 'AsyncGeneratorStart', 'AsyncGeneratorYield', 'AtomicLoad', 'AtomicReadModifyWrite', 'Await', 'BlockDeclarationInstantiation', 'BoundFunctionCreate', 'Canonicalize', 'CaseClauseIsSelected', 'CharacterRange', 'CharacterRangeOrUnion', 'CharacterSetMatcher', 'CloneArrayBuffer', 'Completion', 'ComposeWriteEventBytes', 'CopyDataBlockBytes', 'CreateArrayIterator', 'CreateAsyncFromSyncIterator', 'CreateBuiltinFunction', 'CreateByteDataBlock', 'CreateDynamicFunction', 'CreateIntrinsics', 'CreateMapIterator', 'CreateMappedArgumentsObject', 'CreatePerIterationEnvironment', 'CreateRealm', 'CreateResolvingFunctions', 'CreateSetIterator', 'CreateSharedByteDataBlock', 'CreateStringIterator', 'CreateUnmappedArgumentsObject', 'Decode', 'DetachArrayBuffer', 'Encode', 'EnqueueJob', 'EnterCriticalSection', 'EnumerateObjectProperties', 'EscapeRegExpPattern', 'EvalDeclarationInstantiation', 'EvaluateCall', 'EvaluateNew', 'EventSet', 'floor', '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', 'GetPrototypeFromConstructor', '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', 'IsCompatiblePropertyDescriptor', 'IsDetachedBuffer', 'IsInTailPosition', 'IsLabelledFunction', 'IsPropertyReference', 'IsSharedArrayBuffer', 'IsStrictReference', 'IsSuperReference', 'IsUnresolvableReference', 'IsWordChar', 'LeaveCriticalSection', 'LocalTime', 'LoopContinues', 'MakeArgGetter', 'MakeArgSetter', 'MakeClassConstructor', 'MakeConstructor', 'MakeMethod', 'MakeSuperPropertyReference', 'max', 'memory-order', 'min', 'ModuleDeclarationEnvironmentSetup', 'ModuleExecution', 'ModuleNamespaceCreate', 'NewDeclarativeEnvironment', 'NewFunctionEnvironment', 'NewGlobalEnvironment', 'NewModuleEnvironment', 'NewObjectEnvironment', 'NewPromiseCapability', 'NumberToRawBytes', 'ObjectDefineProperties', 'OrdinaryCallBindThis', 'OrdinaryCallEvaluateBody', 'OrdinaryCreateFromConstructor', 'OrdinaryDelete', 'OrdinaryGet', 'OrdinaryGetPrototypeOf', 'OrdinaryIsExtensible', 'OrdinaryOwnPropertyKeys', 'OrdinaryPreventExtensions', 'OrdinarySetPrototypeOf', 'OrdinaryToPrimitive', 'ParseModule', 'ParseScript', 'PerformEval', 'PerformPromiseAll', 'PerformPromiseRace', 'PerformPromiseThen', 'PrepareForOrdinaryCall', 'PrepareForTailCall', 'PromiseReactionJob', 'PromiseResolveThenableJob', 'ProxyCreate', 'PutValue', 'QuoteJSONString', 'RawBytesToNumber', 'reads-bytes-from', 'reads-from', 'RegExpAlloc', 'RegExpCreate', 'RegExpInitialize', 'RejectPromise', 'RemoveWaiter', 'RemoveWaiters', 'RepeatMatcher', 'ResolveBinding', 'ResolveThisBinding', 'ReturnIfAbrupt', 'RunJobs', 'ScriptEvaluation', 'ScriptEvaluationJob', 'SerializeJSONArray', 'SerializeJSONObject', 'SerializeJSONProperty', 'SetDefaultGlobalBindings', 'SetFunctionName', 'SetImmutablePrototype', 'SetRealmGlobalObject', 'SetValueInBuffer', 'SetViewValue', 'SharedDataBlockEventSet', 'SortCompare', 'SplitMatch', 'StringCreate', 'StringGetOwnProperty', 'Suspend', 'synchronizes-with', 'TimeZoneString', 'TopLevelModuleEvaluationJob', 'TriggerPromiseReactions', 'TypedArrayCreate', 'TypedArraySpeciesCreate', 'UnicodeEscape', 'UpdateEmpty', 'UTC', 'UTF16Decode', 'UTF16Encoding', 'ValidateAtomicAccess', 'ValidateSharedIntegerTypedArray', 'ValidateTypedArray', 'ValueOfReadEvent', 'WakeWaiter', 'WordCharacters', 'AsyncFunctionCreate', 'AsyncGeneratorFunctionCreate', 'AsyncIteratorClose', 'BackreferenceMatcher', 'Construct', 'CreateArrayFromList', 'CreateListFromArrayLike', 'CreateListIteratorRecord', 'NormalCompletion', 'OrdinarySet', 'OrdinarySetWithOwnDescriptor', 'RegExpBuiltinExec', 'SetFunctionLength', 'ThrowCompletion', 'UnicodeMatchProperty', 'UnicodeMatchPropertyValue', 'AsyncFromSyncIteratorContinuation', 'ExecuteModule', 'InitializeEnvironment', 'NotifyWaiter', 'SynchronizeEventSet']; | ||
require('./tests').es2019(ES, ops, expectedMissing); |
252
test/es5.js
@@ -531,1 +531,253 @@ 'use strict'; | ||
}); | ||
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('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('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('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.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, 8, i)), i, '2019.09.' + i + ' is date ' + i); | ||
} | ||
for (i = 1; i <= 31; i += 1) { | ||
t.equal(ES.DateFromTime(Date.UTC(2019, 9, i)), i, '2019.10.' + i + ' is date ' + i); | ||
} | ||
t.end(); | ||
}); | ||
test('MakeDay', function (t) { | ||
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.ok(is(ES.MakeDate(nonFiniteNumber, 0), NaN), debug(nonFiniteNumber) + ' is not a finite `day`'); | ||
t.ok(is(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.ok(is(ES.MakeTime(nonFiniteNumber, 0, 0, 0), NaN), debug(nonFiniteNumber) + ' is not a finite `hour`'); | ||
t.ok(is(ES.MakeTime(0, nonFiniteNumber, 0, 0), NaN), debug(nonFiniteNumber) + ' is not a finite `min`'); | ||
t.ok(is(ES.MakeTime(0, 0, nonFiniteNumber, 0), NaN), debug(nonFiniteNumber) + ' is not a finite `sec`'); | ||
t.ok(is(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.ok(is(ES.TimeClip(nonFiniteNumber), NaN), debug(nonFiniteNumber) + ' is not a finite `time`'); | ||
}); | ||
t.ok(is(ES.TimeClip(8.64e15 + 1), NaN), '8.64e15 is the largest magnitude considered "finite"'); | ||
t.ok(is(ES.TimeClip(-8.64e15 - 1), NaN), '-8.64e15 is the largest magnitude considered "finite"'); | ||
forEach(v.zeroes.concat([-10, 10, Date.now()]), function (time) { | ||
t.equal(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(); | ||
}); |
@@ -35,1 +35,15 @@ 'use strict'; | ||
}); | ||
test('base intrinsics', function (t) { | ||
t.equal(GetIntrinsic('%Object%'), Object, '%Object% yields Object'); | ||
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('%Array.prototype.push%'), Array.prototype.push, '%Array.prototype.push% yields Array.prototype.push'); | ||
t.end(); | ||
}); |
@@ -22,3 +22,5 @@ 'use strict'; | ||
var nonIntegerNumbers = [-1.3, 0.2, 1.8, 1 / 3]; | ||
var numbers = [0, -0, Infinity, -Infinity, 42].concat(nonIntegerNumbers); | ||
var zeroes = [0, -0]; | ||
var infinities = [Infinity, -Infinity]; | ||
var numbers = zeroes.concat([42], infinities, nonIntegerNumbers); | ||
var strings = ['', 'foo', 'a\uD83D\uDCA9c']; | ||
@@ -75,2 +77,4 @@ var booleans = [true, false]; | ||
numbers: numbers, | ||
zeroes: zeroes, | ||
infinities: infinities, | ||
strings: strings, | ||
@@ -77,0 +81,0 @@ booleans: booleans, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
0
314911
14
52
6963