polyfill-library 3.109.0 → 3.110.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -1937
- package/lib/index.js +2 -2
- package/lib/sources.js +6 -2
- package/package.json +7 -5
- package/polyfills/__dist/AggregateError/meta.json +1 -0
- package/polyfills/__dist/AggregateError/min.js +1 -0
- package/polyfills/__dist/AggregateError/raw.js +30 -0
- package/polyfills/__dist/Array.prototype.at/meta.json +1 -0
- package/polyfills/__dist/Array.prototype.at/min.js +1 -0
- package/polyfills/__dist/Array.prototype.at/raw.js +21 -0
- package/polyfills/__dist/ArrayBuffer.isView/meta.json +1 -0
- package/polyfills/__dist/ArrayBuffer.isView/min.js +1 -0
- package/polyfills/__dist/ArrayBuffer.isView/raw.js +13 -0
- package/polyfills/__dist/Promise.allSettled/meta.json +1 -0
- package/polyfills/__dist/Promise.allSettled/min.js +1 -0
- package/polyfills/__dist/Promise.allSettled/raw.js +41 -0
- package/polyfills/__dist/Promise.any/meta.json +1 -0
- package/polyfills/__dist/Promise.any/min.js +1 -0
- package/polyfills/__dist/Promise.any/raw.js +45 -0
- package/polyfills/__dist/String.prototype.at/meta.json +1 -0
- package/polyfills/__dist/String.prototype.at/min.js +1 -0
- package/polyfills/__dist/String.prototype.at/raw.js +23 -0
- package/polyfills/__dist/TypedArray.prototype.at/meta.json +1 -0
- package/polyfills/__dist/TypedArray.prototype.at/min.js +1 -0
- package/polyfills/__dist/TypedArray.prototype.at/raw.js +40 -0
- package/polyfills/__dist/_ESAbstract.IterableToList/meta.json +1 -0
- package/polyfills/__dist/_ESAbstract.IterableToList/min.js +1 -0
- package/polyfills/__dist/_ESAbstract.IterableToList/raw.js +31 -0
- package/polyfills/__dist/_ESAbstract.LengthOfArrayLike/meta.json +1 -0
- package/polyfills/__dist/_ESAbstract.LengthOfArrayLike/min.js +1 -0
- package/polyfills/__dist/_ESAbstract.LengthOfArrayLike/raw.js +8 -0
- package/polyfills/__dist/_ESAbstract.ToIntegerOrInfinity/meta.json +1 -0
- package/polyfills/__dist/_ESAbstract.ToIntegerOrInfinity/min.js +1 -0
- package/polyfills/__dist/_ESAbstract.ToIntegerOrInfinity/raw.js +20 -0
- package/polyfills/__dist/aliases.json +1 -1
package/lib/index.js
CHANGED
@@ -119,7 +119,7 @@ async function getPolyfills(options_) {
|
|
119
119
|
const options = getOptions(options_);
|
120
120
|
let ua = getNormalisedUA(options.uaString);
|
121
121
|
const featureNames = new Set(Object.keys(options.features));
|
122
|
-
const targetedFeatures =
|
122
|
+
const targetedFeatures = Object.create(null);
|
123
123
|
|
124
124
|
/*
|
125
125
|
A feature would be removed in these scenarios:
|
@@ -137,7 +137,7 @@ async function getPolyfills(options_) {
|
|
137
137
|
}
|
138
138
|
|
139
139
|
function addFeature(featureName, featureFlags, featureProperties) {
|
140
|
-
targetedFeatures[featureName] = Object.assign(
|
140
|
+
targetedFeatures[featureName] = Object.assign(Object.create(null), featureFlags, featureProperties);
|
141
141
|
featureNames.add(featureName);
|
142
142
|
}
|
143
143
|
|
package/lib/sources.js
CHANGED
@@ -48,8 +48,12 @@ function listPolyfills() {
|
|
48
48
|
}
|
49
49
|
|
50
50
|
const _aliases = (async function() {
|
51
|
-
const
|
52
|
-
|
51
|
+
const aliasesFile = await readFile(path.join(polyfillDirectory, "aliases.json"), 'utf-8');
|
52
|
+
const result = Object.create(null);
|
53
|
+
for (const [aliasName, aliasValue] of Object.entries(JSON.parse(aliasesFile))) {
|
54
|
+
result[aliasName] = aliasValue;
|
55
|
+
}
|
56
|
+
return result;
|
53
57
|
}());
|
54
58
|
|
55
59
|
/**
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "polyfill-library",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.110.0",
|
4
4
|
"description": "A polyfill combinator",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"contributors": [
|
@@ -58,9 +58,9 @@
|
|
58
58
|
"dependencies": {
|
59
59
|
"@financial-times/polyfill-useragent-normaliser": "^1.10.1",
|
60
60
|
"from2-string": "^1.1.0",
|
61
|
-
"graceful-fs": "^4.
|
61
|
+
"graceful-fs": "^4.2.8",
|
62
62
|
"merge2": "^1.0.3",
|
63
|
-
"mnemonist": "^0.38.
|
63
|
+
"mnemonist": "^0.38.5",
|
64
64
|
"stream-from-promise": "^1.0.0",
|
65
65
|
"stream-to-string": "^1.1.0",
|
66
66
|
"toposort": "^2.0.2"
|
@@ -78,15 +78,16 @@
|
|
78
78
|
"@iarna/toml": "^2.2.3",
|
79
79
|
"@juggle/resize-observer": "^3.3.1",
|
80
80
|
"@webcomponents/template": "^1.4.0",
|
81
|
-
"Base64": "^1.0.0",
|
82
81
|
"abort-controller": "^3.0.0",
|
83
82
|
"apicache": "^1.5.3",
|
84
83
|
"array.prototype.flatmap": "^1.2.1",
|
85
84
|
"audio-context-polyfill": "^1.0.0",
|
86
85
|
"auto-changelog": "^2.2.1",
|
86
|
+
"Base64": "^1.0.0",
|
87
87
|
"bluebird": "^3.7.2",
|
88
88
|
"browserstack": "1.6.1",
|
89
89
|
"browserstack-local": "^1.4.5",
|
90
|
+
"chai": "^4.3.4",
|
90
91
|
"cli-color": "^2.0.0",
|
91
92
|
"compression": "^1.7.4",
|
92
93
|
"current-script-polyfill": "^1.0.0",
|
@@ -137,6 +138,7 @@
|
|
137
138
|
"yaml": "^1.1.0"
|
138
139
|
},
|
139
140
|
"volta": {
|
140
|
-
"node": "12.22.
|
141
|
+
"node": "12.22.7",
|
142
|
+
"npm": "6.13.4"
|
141
143
|
}
|
142
144
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2021"],"dependencies":["_ESAbstract.CreateDataPropertyOrThrow","_ESAbstract.IterableToList","Array.isArray","Object.create"],"license":"MIT","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError","browsers":{"android":"<85","bb":"*","chrome":"<85","firefox":"<79","ios_saf":"<14","edge":"<85","edge_mob":"<85","ie":"*","ie_mob":"*","opera":"*","op_mini":"*","safari":"<14","firefox_mob":"<79","samsung_mob":"<14"},"detectSource":"\"AggregateError\"in self\n","baseDir":"AggregateError","hasTests":true,"isTestable":true,"isPublic":true,"size":485}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){function r(r,e){var t=void 0===e?new Error:new Error(e);CreateDataPropertyOrThrow(this,"name","AggregateError"),CreateDataPropertyOrThrow(this,"message",t.message),CreateDataPropertyOrThrow(this,"stack",t.stack);var o;if(Array.isArray(r))o=r.slice();else try{o=IterableToList(r)}catch(a){throw new TypeError("Argument is not iterable")}CreateDataPropertyOrThrow(this,"errors",o)}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,self.AggregateError=r}();
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
// AggregateError
|
3
|
+
/* global CreateDataPropertyOrThrow, IterableToList */
|
4
|
+
(function () {
|
5
|
+
function AggregateError (errors, message) {
|
6
|
+
var temp = typeof message === 'undefined' ? new Error() : new Error(message);
|
7
|
+
|
8
|
+
CreateDataPropertyOrThrow(this, 'name', 'AggregateError');
|
9
|
+
CreateDataPropertyOrThrow(this, 'message', temp.message);
|
10
|
+
CreateDataPropertyOrThrow(this, 'stack', temp.stack);
|
11
|
+
|
12
|
+
var errorsList;
|
13
|
+
if (Array.isArray(errors)) {
|
14
|
+
errorsList = errors.slice();
|
15
|
+
} else {
|
16
|
+
try {
|
17
|
+
errorsList = IterableToList(errors);
|
18
|
+
} catch (_error) {
|
19
|
+
throw new TypeError('Argument is not iterable');
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
CreateDataPropertyOrThrow(this, 'errors', errorsList);
|
24
|
+
}
|
25
|
+
|
26
|
+
AggregateError.prototype = Object.create(Error.prototype);
|
27
|
+
AggregateError.prototype.constructor = AggregateError;
|
28
|
+
|
29
|
+
self.AggregateError = AggregateError;
|
30
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2022"],"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.Get","_ESAbstract.LengthOfArrayLike","_ESAbstract.ToIntegerOrInfinity","_ESAbstract.ToObject","_ESAbstract.ToString"],"spec":"https://tc39.es/ecma262/#sec-array.prototype.at","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at","browsers":{"android":"*","bb":"*","chrome":"< 92","edge":"< 92","edge_mob":"< 92","firefox":"< 90","firefox_mob":"< 90","ie":"*","ie_mob":"*","ios_chr":"*","ios_saf":"*","op_mini":"*","op_mob":"*","opera":"< 78","safari":"*","samsung_mob":"< 16"},"detectSource":"\"at\"in Array.prototype\n","baseDir":"Array/prototype/at","hasTests":true,"isTestable":true,"isPublic":true,"size":186}
|
@@ -0,0 +1 @@
|
|
1
|
+
CreateMethodProperty(Array.prototype,"at",function t(e){var r=ToObject(this),n=LengthOfArrayLike(r),o=ToIntegerOrInfinity(e),i=o>=0?o:n+o;return i<0||i>=n?undefined:Get(r,ToString(i))});
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
// Array.prototype.at
|
3
|
+
/* global CreateMethodProperty, Get, LengthOfArrayLike, ToIntegerOrInfinity, ToObject, ToString */
|
4
|
+
// 23.1.3.1. Array.prototype.at ( index )
|
5
|
+
CreateMethodProperty(Array.prototype, 'at', function at(index) {
|
6
|
+
// 1. Let O be ? ToObject(this value).
|
7
|
+
var O = ToObject(this);
|
8
|
+
// 2. Let len be ? LengthOfArrayLike(O).
|
9
|
+
var len = LengthOfArrayLike(O);
|
10
|
+
// 3. Let relativeIndex be ? ToIntegerOrInfinity(index).
|
11
|
+
var relativeIndex = ToIntegerOrInfinity(index);
|
12
|
+
// 4. If relativeIndex ≥ 0, then
|
13
|
+
// 4.a. Let k be relativeIndex.
|
14
|
+
// 5. Else,
|
15
|
+
// 5.a. Let k be len + relativeIndex.
|
16
|
+
var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
|
17
|
+
// 6. If k < 0 or k ≥ len, return undefined.
|
18
|
+
if (k < 0 || k >= len) return undefined;
|
19
|
+
// 7. Return ? Get(O, ! ToString(𝔽(k))).
|
20
|
+
return Get(O, ToString(k));
|
21
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.Type","ArrayBuffer"],"spec":"https://tc39.github.io/ecma262/#sec-arraybuffer.isview","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView","browsers":{"android":"<37","bb":"*","chrome":"<32","edge":"<12","edge_mob":"<14","firefox":"<29","firefox_mob":"<44","ie":"<11","ie_mob":"<11","ios_chr":"<7","ios_saf":"<7","op_mini":"*","op_mob":"<19","opera":"<19","safari":"<7","samsung_mob":"<2"},"detectSource":"\"ArrayBuffer\"in self&&\"isView\"in self.ArrayBuffer\n","baseDir":"ArrayBuffer/isView","hasTests":true,"isTestable":true,"isPublic":true,"size":116}
|
@@ -0,0 +1 @@
|
|
1
|
+
CreateMethodProperty(ArrayBuffer,"isView",function e(r){return"object"===Type(r)&&r.buffer instanceof ArrayBuffer});
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
// ArrayBuffer.isView
|
3
|
+
/* global ArrayBuffer, CreateMethodProperty, Type */
|
4
|
+
// 25.1.4.1 ArrayBuffer.isView ( arg )
|
5
|
+
CreateMethodProperty(ArrayBuffer, 'isView', function isView (arg) {
|
6
|
+
// 1. If Type(arg) is not Object, return false.
|
7
|
+
if (Type(arg) !== 'object') {
|
8
|
+
return false;
|
9
|
+
}
|
10
|
+
// 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
|
11
|
+
// 3. Return false.
|
12
|
+
return arg.buffer instanceof ArrayBuffer;
|
13
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2020"],"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.IterableToList","_ESAbstract.Type","Array.isArray","Array.prototype.map","Promise"],"license":"MIT","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled","browsers":{"android":"<76","bb":"*","chrome":"<76","firefox":"<71","ios_saf":"<13","edge":"<79","edge_mob":"<79","ie":"*","ie_mob":"*","opera":"<63","op_mini":"*","safari":"<13","firefox_mob":"<79","samsung_mob":"<12"},"detectSource":"\"Promise\"in self&&\"allSettled\"in self.Promise\n","baseDir":"Promise/allSettled","hasTests":true,"isTestable":true,"isPublic":true,"size":528}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){CreateMethodProperty(Promise,"allSettled",function e(r){var t=this;if("object"!==Type(t))throw new TypeError("`this` value must be an object");var n;if(Array.isArray(r))n=r;else try{n=IterableToList(r)}catch(o){return Promise.reject(new TypeError("Argument of Promise.allSettled is not iterable"))}var a=n.map(function(e){var r=function(e){return{status:"fulfilled",value:e}},n=function(e){return{status:"rejected",reason:e}},a=t.resolve(e);try{return a.then(r,n)}catch(o){return t.reject(o)}});return t.all(a)})}();
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
// Promise.allSettled
|
3
|
+
/* global CreateMethodProperty, IterableToList, Promise, Type */
|
4
|
+
(function () {
|
5
|
+
// Based on https://github.com/es-shims/Promise.allSettled/blob/main/implementation.js
|
6
|
+
|
7
|
+
CreateMethodProperty(Promise, 'allSettled', function allSettled (iterable) {
|
8
|
+
var C = this;
|
9
|
+
if (Type(C) !== 'object') {
|
10
|
+
throw new TypeError('`this` value must be an object');
|
11
|
+
}
|
12
|
+
|
13
|
+
var arr;
|
14
|
+
if (Array.isArray(iterable)) {
|
15
|
+
arr = iterable;
|
16
|
+
} else {
|
17
|
+
try {
|
18
|
+
arr = IterableToList(iterable);
|
19
|
+
} catch (_error) {
|
20
|
+
return Promise.reject(new TypeError('Argument of Promise.allSettled is not iterable'));
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
var promises = arr.map(function (promise) {
|
25
|
+
var onFulfill = function (value) {
|
26
|
+
return { status: 'fulfilled', value: value };
|
27
|
+
};
|
28
|
+
var onReject = function (reason) {
|
29
|
+
return { status: 'rejected', reason: reason };
|
30
|
+
};
|
31
|
+
var itemPromise = C.resolve(promise);
|
32
|
+
try {
|
33
|
+
return itemPromise.then(onFulfill, onReject);
|
34
|
+
} catch (e) {
|
35
|
+
return C.reject(e);
|
36
|
+
}
|
37
|
+
});
|
38
|
+
|
39
|
+
return C.all(promises);
|
40
|
+
});
|
41
|
+
}());
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2021"],"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.IterableToList","_ESAbstract.Type","AggregateError","Array.isArray","Array.prototype.map","Promise"],"license":"MIT","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any","browsers":{"android":"<85","bb":"*","chrome":"<85","firefox":"<79","ios_saf":"<14","edge":"<85","edge_mob":"<85","ie":"*","ie_mob":"*","opera":"*","op_mini":"*","safari":"<14","firefox_mob":"<79","samsung_mob":"<14"},"detectSource":"\"Promise\"in self&&\"any\"in self.Promise\n","baseDir":"Promise/any","hasTests":true,"isTestable":true,"isPublic":true,"size":540}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){var r=function(r){return r};CreateMethodProperty(Promise,"any",function e(t){var n=this;if("object"!==Type(n))throw new TypeError("`this` value must be an object");var o;if(Array.isArray(t))o=t;else try{o=IterableToList(t)}catch(c){return Promise.reject(new TypeError("Argument of Promise.any is not iterable"))}var a=function(r){return n.reject(r)},i=o.map(function(e){var t=n.resolve(e);try{return t.then(a,r)}catch(o){return o}});return n.all(i).then(function(r){throw new AggregateError(r,"Every promise rejected")},r)})}();
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
// Promise.any
|
3
|
+
/* global AggregateError, CreateMethodProperty, IterableToList, Promise, Type */
|
4
|
+
(function () {
|
5
|
+
// Based on https://github.com/es-shims/Promise.any/blob/master/implementation.js
|
6
|
+
|
7
|
+
var identity = function (x) {
|
8
|
+
return x;
|
9
|
+
}
|
10
|
+
|
11
|
+
CreateMethodProperty(Promise, 'any', function any (iterable) {
|
12
|
+
var C = this;
|
13
|
+
if (Type(C) !== 'object') {
|
14
|
+
throw new TypeError('`this` value must be an object');
|
15
|
+
}
|
16
|
+
|
17
|
+
var arr;
|
18
|
+
if (Array.isArray(iterable)) {
|
19
|
+
arr = iterable;
|
20
|
+
} else {
|
21
|
+
try {
|
22
|
+
arr = IterableToList(iterable);
|
23
|
+
} catch (_error) {
|
24
|
+
return Promise.reject(new TypeError('Argument of Promise.any is not iterable'));
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
var thrower = function (value) {
|
29
|
+
return C.reject(value);
|
30
|
+
};
|
31
|
+
|
32
|
+
var promises = arr.map(function (promise) {
|
33
|
+
var itemPromise = C.resolve(promise);
|
34
|
+
try {
|
35
|
+
return itemPromise.then(thrower, identity);
|
36
|
+
} catch (e) {
|
37
|
+
return e;
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
return C.all(promises).then(function (errors) {
|
42
|
+
throw new AggregateError(errors, 'Every promise rejected')
|
43
|
+
}, identity);
|
44
|
+
});
|
45
|
+
}());
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2022"],"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.RequireObjectCoercible","_ESAbstract.ToIntegerOrInfinity","_ESAbstract.ToString"],"spec":"https://tc39.es/ecma262/#sec-string.prototype.at","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/at","browsers":{"android":"*","bb":"*","chrome":"< 92","edge":"*","edge_mob":"*","firefox":"< 90","firefox_mob":"< 90","ie":"*","ie_mob":"*","ios_chr":"*","ios_saf":"*","op_mini":"*","op_mob":"*","opera":"< 78","safari":"*","samsung_mob":"< 16"},"detectSource":"\"at\"in String.prototype\n","baseDir":"String/prototype/at","hasTests":true,"isTestable":true,"isPublic":true,"size":203}
|
@@ -0,0 +1 @@
|
|
1
|
+
CreateMethodProperty(String.prototype,"at",function e(t){var r=RequireObjectCoercible(this),n=ToString(r),i=n.length,o=ToIntegerOrInfinity(t),g=o>=0?o:i+o;return g<0||g>=i?undefined:n.substring(g,g+1)});
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
// String.prototype.at
|
3
|
+
/* global CreateMethodProperty, RequireObjectCoercible, ToIntegerOrInfinity, ToString */
|
4
|
+
// 22.1.3.1. String.prototype.at ( index )
|
5
|
+
CreateMethodProperty(String.prototype, 'at', function at(index) {
|
6
|
+
// 1. Let O be ? RequireObjectCoercible(this value).
|
7
|
+
var O = RequireObjectCoercible(this);
|
8
|
+
// 2. Let S be ? ToString(O).
|
9
|
+
var S = ToString(O);
|
10
|
+
// 3. Let len be the length of S.
|
11
|
+
var len = S.length;
|
12
|
+
// 4. Let relativeIndex be ? ToIntegerOrInfinity(index).
|
13
|
+
var relativeIndex = ToIntegerOrInfinity(index);
|
14
|
+
// 5. If relativeIndex ≥ 0, then
|
15
|
+
// 5.a. Let k be relativeIndex.
|
16
|
+
// 6. Else,
|
17
|
+
// 6.a. Let k be len + relativeIndex.
|
18
|
+
var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
|
19
|
+
// 7. If k < 0 or k ≥ len, return undefined.
|
20
|
+
if (k < 0 || k >= len) return undefined;
|
21
|
+
// 8. Return the substring of S from k to k + 1.
|
22
|
+
return S.substring(k, k + 1);
|
23
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2022"],"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.Get","_ESAbstract.ToIntegerOrInfinity","_ESAbstract.ToString","ArrayBuffer"],"spec":"https://tc39.es/ecma262/#sec-%typedarray%.prototype.at","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at","browsers":{"android":"*","bb":"*","chrome":"< 92","edge":"*","edge_mob":"*","firefox":"< 90","firefox_mob":"< 90","ie":"*","ie_mob":"*","ios_chr":"*","ios_saf":"*","op_mini":"*","op_mob":"*","opera":"< 78","safari":"*","samsung_mob":"< 16"},"detectSource":"\"Int8Array\"in self&&\"at\"in self.Int8Array.prototype\n","baseDir":"TypedArray/prototype/at","hasTests":true,"isTestable":true,"isPublic":true,"size":747}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){function t(t){var r=this,e=r.length,o=ToIntegerOrInfinity(t),a=o>=0?o:e+o;return a<0||a>=e?undefined:Get(r,ToString(a))}"__proto__"in self.Int8Array.prototype?CreateMethodProperty(self.Int8Array.prototype.__proto__,"at",t):(CreateMethodProperty(self.Int8Array.prototype,"at",t),CreateMethodProperty(self.Uint8Array.prototype,"at",t),CreateMethodProperty(self.Uint8ClampedArray.prototype,"at",t),CreateMethodProperty(self.Int16Array.prototype,"at",t),CreateMethodProperty(self.Uint16Array.prototype,"at",t),CreateMethodProperty(self.Int32Array.prototype,"at",t),CreateMethodProperty(self.Uint32Array.prototype,"at",t),CreateMethodProperty(self.Float32Array.prototype,"at",t),CreateMethodProperty(self.Float64Array.prototype,"at",t))}();
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
// TypedArray.prototype.at
|
3
|
+
/* global CreateMethodProperty, Get, ToIntegerOrInfinity, ToString */
|
4
|
+
// 23.2.3.1. %TypedArray%.prototype.at ( index )
|
5
|
+
(function () {
|
6
|
+
function at(index) {
|
7
|
+
// 1. Let O be the this value.
|
8
|
+
var O = this;
|
9
|
+
// 2. Perform ? ValidateTypedArray(O).
|
10
|
+
// TODO: Add ValidateTypedArray
|
11
|
+
// 3. Let len be O.[[ArrayLength]].
|
12
|
+
var len = O.length;
|
13
|
+
// 4. Let relativeIndex be ? ToIntegerOrInfinity(index).
|
14
|
+
var relativeIndex = ToIntegerOrInfinity(index);
|
15
|
+
// 5. If relativeIndex ≥ 0, then
|
16
|
+
// 5.a. Let k be relativeIndex.
|
17
|
+
// 6. Else,
|
18
|
+
// 6.a. Let k be len + relativeIndex.
|
19
|
+
var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
|
20
|
+
// 7. If k < 0 or k ≥ len, return undefined.
|
21
|
+
if (k < 0 || k >= len) return undefined;
|
22
|
+
// 8. Return ! Get(O, ! ToString(𝔽(k))).
|
23
|
+
return Get(O, ToString(k));
|
24
|
+
}
|
25
|
+
|
26
|
+
if ('__proto__' in self.Int8Array.prototype) {
|
27
|
+
// set this on the underlying "TypedArrayPrototype", which is shared with all "TypedArray" subclasses
|
28
|
+
CreateMethodProperty(self.Int8Array.prototype.__proto__, 'at', at);
|
29
|
+
} else {
|
30
|
+
CreateMethodProperty(self.Int8Array.prototype, 'at', at);
|
31
|
+
CreateMethodProperty(self.Uint8Array.prototype, 'at', at);
|
32
|
+
CreateMethodProperty(self.Uint8ClampedArray.prototype, 'at', at);
|
33
|
+
CreateMethodProperty(self.Int16Array.prototype, 'at', at);
|
34
|
+
CreateMethodProperty(self.Uint16Array.prototype, 'at', at);
|
35
|
+
CreateMethodProperty(self.Int32Array.prototype, 'at', at);
|
36
|
+
CreateMethodProperty(self.Uint32Array.prototype, 'at', at);
|
37
|
+
CreateMethodProperty(self.Float32Array.prototype, 'at', at);
|
38
|
+
CreateMethodProperty(self.Float64Array.prototype, 'at', at);
|
39
|
+
}
|
40
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"dependencies":["_ESAbstract.GetIterator","_ESAbstract.IteratorStep","_ESAbstract.IteratorValue"],"spec":"https://tc39.github.io/ecma262/#sec-iterabletolist","browsers":{"android":"*","bb":"*","chrome":"*","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","ios_chr":"*","ios_saf":"*","op_mini":"*","op_mob":"*","opera":"*","safari":"*","samsung_mob":"*"},"detectSource":"","baseDir":"_ESAbstract/IterableToList","hasTests":false,"isTestable":true,"isPublic":false,"size":188}
|
@@ -0,0 +1 @@
|
|
1
|
+
function IterableToList(t){for(var r=arguments.length>1?GetIterator(t,arguments[1]):GetIterator(t),e=[],a=!0;!1!==a;)if(!1!==(a=IteratorStep(r))){var o=IteratorValue(a);e.push(o)}return e}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
// _ESAbstract.IterableToList
|
3
|
+
/* global GetIterator, IteratorStep, IteratorValue */
|
4
|
+
// 7.4.11 IterableToList ( items [ , method ] )
|
5
|
+
function IterableToList(items /*, method */) { // eslint-disable-line no-unused-vars
|
6
|
+
// 1. If method is present, then
|
7
|
+
// 1.a. Let iteratorRecord be ? GetIterator(items, sync, method).
|
8
|
+
// 2. Else,
|
9
|
+
// 2.a. Let iteratorRecord be ? GetIterator(items, sync).
|
10
|
+
var iteratorRecord = arguments.length > 1
|
11
|
+
? GetIterator(items, arguments[1])
|
12
|
+
: GetIterator(items);
|
13
|
+
// 3. Let values be a new empty List.
|
14
|
+
var values = [];
|
15
|
+
// 4. Let next be true.
|
16
|
+
var next = true;
|
17
|
+
// 5. Repeat, while next is not false,
|
18
|
+
while (next !== false) {
|
19
|
+
// 5.a. Set next to ? IteratorStep(iteratorRecord).
|
20
|
+
next = IteratorStep(iteratorRecord);
|
21
|
+
// 5.b. If next is not false, then
|
22
|
+
if (next !== false) {
|
23
|
+
// 5.b.i. Let nextValue be ? IteratorValue(next).
|
24
|
+
var nextValue = IteratorValue(next);
|
25
|
+
// 5.b.ii. Append nextValue to the end of the List values.
|
26
|
+
values.push(nextValue);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
// 6. Return values.
|
30
|
+
return values;
|
31
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"dependencies":["_ESAbstract.Get","_ESAbstract.ToLength"],"spec":"https://tc39.github.io/ecma262/#sec-lengthofarraylike","browsers":{"android":"*","bb":"*","chrome":"*","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","ios_chr":"*","ios_saf":"*","op_mini":"*","op_mob":"*","opera":"*","safari":"*","samsung_mob":"*"},"detectSource":"","baseDir":"_ESAbstract/LengthOfArrayLike","hasTests":false,"isTestable":true,"isPublic":false,"size":63}
|
@@ -0,0 +1 @@
|
|
1
|
+
function LengthOfArrayLike(e){return ToLength(Get(e,"length"))}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
|
2
|
+
// _ESAbstract.LengthOfArrayLike
|
3
|
+
/* global Get, ToLength */
|
4
|
+
// 7.3.19. LengthOfArrayLike ( obj )
|
5
|
+
function LengthOfArrayLike(obj) { // eslint-disable-line no-unused-vars
|
6
|
+
// 1. Return ℝ(? ToLength(? Get(obj, "length"))).
|
7
|
+
return ToLength(Get(obj, 'length'));
|
8
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"dependencies":["_ESAbstract.ToNumber"],"spec":"https://tc39.github.io/ecma262/#sec-tointegerorinfinity","browsers":{"android":"*","bb":"*","chrome":"*","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","ios_chr":"*","ios_saf":"*","op_mini":"*","op_mob":"*","opera":"*","safari":"*","samsung_mob":"*"},"detectSource":"","baseDir":"_ESAbstract/ToIntegerOrInfinity","hasTests":false,"isTestable":true,"isPublic":false,"size":210}
|
@@ -0,0 +1 @@
|
|
1
|
+
function ToIntegerOrInfinity(n){var i=ToNumber(n);if(isNaN(i)||0===i||1/i==-Infinity)return 0;if(i===Infinity)return Infinity;if(i===-Infinity)return-Infinity;var r=Math.floor(Math.abs(i));return i<0&&(r=-r),r}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
// _ESAbstract.ToIntegerOrInfinity
|
3
|
+
/* global ToNumber */
|
4
|
+
// 7.1.5. ToIntegerOrInfinity ( argument )
|
5
|
+
function ToIntegerOrInfinity(argument) { // eslint-disable-line no-unused-vars
|
6
|
+
// 1. Let number be ? ToNumber(argument).
|
7
|
+
var number = ToNumber(argument);
|
8
|
+
// 2. If number is NaN, +0𝔽, or -0𝔽, return 0.
|
9
|
+
if (isNaN(number) || number === 0 || 1/number === -Infinity) return 0;
|
10
|
+
// 3. If number is +∞𝔽, return +∞.
|
11
|
+
if (number === Infinity) return Infinity;
|
12
|
+
// 4. If number is -∞𝔽, return -∞.
|
13
|
+
if (number === -Infinity) return -Infinity;
|
14
|
+
// 5. Let integer be floor(abs(ℝ(number))).
|
15
|
+
var integer = Math.floor(Math.abs(number));
|
16
|
+
// 6. If number < +0𝔽, set integer to -integer.
|
17
|
+
if (number < 0) integer = -integer;
|
18
|
+
// 7. Return integer.
|
19
|
+
return integer;
|
20
|
+
}
|