polyfill-library 4.6.0 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -4
- package/README.md +41 -0
- package/package.json +10 -21
- package/polyfills/__dist/Array.prototype.sort/meta.json +1 -1
- package/polyfills/__dist/Array.prototype.sort/min.js +1 -1
- package/polyfills/__dist/Array.prototype.sort/raw.js +20 -9
- package/polyfills/__dist/Array.prototype.toReversed/meta.json +1 -0
- package/polyfills/__dist/Array.prototype.toReversed/min.js +1 -0
- package/polyfills/__dist/Array.prototype.toReversed/raw.js +29 -0
- package/polyfills/__dist/Array.prototype.toSorted/meta.json +1 -0
- package/polyfills/__dist/Array.prototype.toSorted/min.js +1 -0
- package/polyfills/__dist/Array.prototype.toSorted/raw.js +37 -0
- package/polyfills/__dist/Array.prototype.toSpliced/meta.json +1 -0
- package/polyfills/__dist/Array.prototype.toSpliced/min.js +1 -0
- package/polyfills/__dist/Array.prototype.toSpliced/raw.js +96 -0
- package/polyfills/__dist/Array.prototype.with/meta.json +1 -0
- package/polyfills/__dist/Array.prototype.with/min.js +1 -0
- package/polyfills/__dist/Array.prototype.with/raw.js +60 -0
- package/polyfills/__dist/DocumentFragment.prototype.replaceChildren/meta.json +1 -0
- package/polyfills/__dist/DocumentFragment.prototype.replaceChildren/min.js +1 -0
- package/polyfills/__dist/DocumentFragment.prototype.replaceChildren/raw.js +15 -0
- package/polyfills/__dist/Element.prototype.replaceChildren/meta.json +1 -0
- package/polyfills/__dist/Element.prototype.replaceChildren/min.js +1 -0
- package/polyfills/__dist/Element.prototype.replaceChildren/raw.js +8 -0
- package/polyfills/__dist/HTMLFormElement.prototype.requestSubmit/meta.json +1 -0
- package/polyfills/__dist/HTMLFormElement.prototype.requestSubmit/min.js +1 -0
- package/polyfills/__dist/HTMLFormElement.prototype.requestSubmit/raw.js +116 -0
- package/polyfills/__dist/IntersectionObserver/meta.json +1 -1
- package/polyfills/__dist/IntersectionObserver/min.js +1 -1
- package/polyfills/__dist/IntersectionObserver/raw.js +2 -1
- package/polyfills/__dist/IntersectionObserverEntry/meta.json +1 -1
- package/polyfills/__dist/Intl.DateTimeFormat.~locale.en-US-POSIX/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.he/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.id/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.jv/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.sr-Latn/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.sr-Latn-BA/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.sr-Latn-ME/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.sr-Latn-XK/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.en-US-POSIX/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.he/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.id/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.jv/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.sr-Latn/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.sr-Latn-BA/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.sr-Latn-ME/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.sr-Latn-XK/meta.json +1 -1
- package/polyfills/__dist/Map/meta.json +1 -1
- package/polyfills/__dist/Map/min.js +1 -1
- package/polyfills/__dist/Map/raw.js +5 -2
- package/polyfills/__dist/ResizeObserver/min.js +1 -1
- package/polyfills/__dist/ResizeObserver/raw.js +5 -5
- package/polyfills/__dist/TypedArray.prototype.@@toStringTag/raw.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.at/raw.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.entries/meta.json +1 -1
- package/polyfills/__dist/TypedArray.prototype.entries/min.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.entries/raw.js +21 -25
- package/polyfills/__dist/TypedArray.prototype.findLast/meta.json +1 -1
- package/polyfills/__dist/TypedArray.prototype.findLast/min.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.findLast/raw.js +12 -11
- package/polyfills/__dist/TypedArray.prototype.findLastIndex/meta.json +1 -1
- package/polyfills/__dist/TypedArray.prototype.findLastIndex/min.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.findLastIndex/raw.js +12 -11
- package/polyfills/__dist/TypedArray.prototype.keys/meta.json +1 -1
- package/polyfills/__dist/TypedArray.prototype.keys/min.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.keys/raw.js +21 -25
- package/polyfills/__dist/TypedArray.prototype.sort/meta.json +1 -0
- package/polyfills/__dist/TypedArray.prototype.sort/min.js +1 -0
- package/polyfills/__dist/TypedArray.prototype.sort/raw.js +71 -0
- package/polyfills/__dist/TypedArray.prototype.toReversed/meta.json +1 -0
- package/polyfills/__dist/TypedArray.prototype.toReversed/min.js +1 -0
- package/polyfills/__dist/TypedArray.prototype.toReversed/raw.js +50 -0
- package/polyfills/__dist/TypedArray.prototype.toSorted/meta.json +1 -0
- package/polyfills/__dist/TypedArray.prototype.toSorted/min.js +1 -0
- package/polyfills/__dist/TypedArray.prototype.toSorted/raw.js +59 -0
- package/polyfills/__dist/TypedArray.prototype.with/meta.json +1 -0
- package/polyfills/__dist/TypedArray.prototype.with/min.js +1 -0
- package/polyfills/__dist/TypedArray.prototype.with/raw.js +83 -0
- package/polyfills/__dist/_ESAbstract.IsValidIntegerIndex/meta.json +1 -0
- package/polyfills/__dist/_ESAbstract.IsValidIntegerIndex/min.js +1 -0
- package/polyfills/__dist/_ESAbstract.IsValidIntegerIndex/raw.js +16 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreate/meta.json +1 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreate/min.js +1 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreate/raw.js +20 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreateSameType/meta.json +1 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreateSameType/min.js +1 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreateSameType/raw.js +41 -0
- package/polyfills/__dist/aliases.json +1 -1
- package/polyfills/__dist/atob/meta.json +1 -1
- package/polyfills/__dist/atob/min.js +1 -1
- package/polyfills/__dist/atob/raw.js +22 -16
- package/polyfills/__dist/structuredClone/meta.json +1 -0
- package/polyfills/__dist/structuredClone/min.js +1 -0
- package/polyfills/__dist/structuredClone/raw.js +279 -0
@@ -1 +1 @@
|
|
1
|
-
{"aliases":["es2023"],"dependencies":["_ESAbstract.Call","_ESAbstract.CreateMethodProperty","_ESAbstract.Get","_ESAbstract.IsCallable","_ESAbstract.ToBoolean","_ESAbstract.ToString","ArrayBuffer"],"spec":"https://tc39.es/ecma262/#sec-%typedarray%.prototype.findlastindex","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/findLastIndex","browsers":{"android":"*","bb":"*","chrome":"<97","edge":"*","edge_mob":"*","firefox":"<104","firefox_mob":"<104","ie":"*","ie_mob":"*","opera":"<83","op_mob":"<68","op_mini":"*","safari":"<15.4","ios_saf":"<15.4","samsung_mob":"<18.0"},"detectSource":"\"Int8Array\"in self&&\"findLastIndex\"in self.Int8Array.prototype\n","baseDir":"TypedArray/prototype/findLastIndex","hasTests":true,"isTestable":true,"isPublic":true,"size":
|
1
|
+
{"aliases":["es2023"],"dependencies":["_ESAbstract.Call","_ESAbstract.CreateMethodProperty","_ESAbstract.Get","_ESAbstract.IsCallable","_ESAbstract.ToBoolean","_ESAbstract.ToString","ArrayBuffer"],"spec":"https://tc39.es/ecma262/#sec-%typedarray%.prototype.findlastindex","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/findLastIndex","browsers":{"android":"*","bb":"*","chrome":"<97","edge":"*","edge_mob":"*","firefox":"<104","firefox_mob":"<104","ie":"*","ie_mob":"*","opera":"<83","op_mob":"<68","op_mini":"*","safari":"<15.4","ios_saf":"<15.4","samsung_mob":"<18.0"},"detectSource":"\"Int8Array\"in self&&\"findLastIndex\"in self.Int8Array.prototype\n","baseDir":"TypedArray/prototype/findLastIndex","hasTests":true,"isTestable":true,"isPublic":true,"size":888}
|
@@ -1 +1 @@
|
|
1
|
-
!function(){function
|
1
|
+
!function(){function r(r){var t=this,e=t.length;if(!IsCallable(r))throw TypeError();for(var o=e-1;o>=0;){var p=ToString(o),y=Get(t,p);if(ToBoolean(Call(r,arguments.length>1?arguments[1]:void 0,[y,o,t])))return o;o-=1}return-1}var t="findLastIndex";"__proto__"in self.Int8Array.prototype&&self.Int8Array.prototype.__proto__!==Object.prototype?CreateMethodProperty(self.Int8Array.prototype.__proto__,t,r):(CreateMethodProperty(self.Int8Array.prototype,t,r),CreateMethodProperty(self.Uint8Array.prototype,t,r),CreateMethodProperty(self.Uint8ClampedArray.prototype,t,r),CreateMethodProperty(self.Int16Array.prototype,t,r),CreateMethodProperty(self.Uint16Array.prototype,t,r),CreateMethodProperty(self.Int32Array.prototype,t,r),CreateMethodProperty(self.Uint32Array.prototype,t,r),CreateMethodProperty(self.Float32Array.prototype,t,r),CreateMethodProperty(self.Float64Array.prototype,t,r))}();
|
@@ -33,20 +33,21 @@
|
|
33
33
|
return -1;
|
34
34
|
}
|
35
35
|
|
36
|
+
var fnName = 'findLastIndex'
|
36
37
|
// in IE11, `Int8Array.prototype` inherits directly from `Object.prototype`
|
37
|
-
// in that case, don't define
|
38
|
+
// in that case, don't define it on the parent; define it directly on the prototype
|
38
39
|
if ('__proto__' in self.Int8Array.prototype && self.Int8Array.prototype.__proto__ !== Object.prototype) {
|
39
40
|
// set this on the underlying "TypedArrayPrototype", which is shared with all "TypedArray" subclasses
|
40
|
-
CreateMethodProperty(self.Int8Array.prototype.__proto__,
|
41
|
+
CreateMethodProperty(self.Int8Array.prototype.__proto__, fnName, findLastIndex);
|
41
42
|
} else {
|
42
|
-
CreateMethodProperty(self.Int8Array.prototype,
|
43
|
-
CreateMethodProperty(self.Uint8Array.prototype,
|
44
|
-
CreateMethodProperty(self.Uint8ClampedArray.prototype,
|
45
|
-
CreateMethodProperty(self.Int16Array.prototype,
|
46
|
-
CreateMethodProperty(self.Uint16Array.prototype,
|
47
|
-
CreateMethodProperty(self.Int32Array.prototype,
|
48
|
-
CreateMethodProperty(self.Uint32Array.prototype,
|
49
|
-
CreateMethodProperty(self.Float32Array.prototype,
|
50
|
-
CreateMethodProperty(self.Float64Array.prototype,
|
43
|
+
CreateMethodProperty(self.Int8Array.prototype, fnName, findLastIndex);
|
44
|
+
CreateMethodProperty(self.Uint8Array.prototype, fnName, findLastIndex);
|
45
|
+
CreateMethodProperty(self.Uint8ClampedArray.prototype, fnName, findLastIndex);
|
46
|
+
CreateMethodProperty(self.Int16Array.prototype, fnName, findLastIndex);
|
47
|
+
CreateMethodProperty(self.Uint16Array.prototype, fnName, findLastIndex);
|
48
|
+
CreateMethodProperty(self.Int32Array.prototype, fnName, findLastIndex);
|
49
|
+
CreateMethodProperty(self.Uint32Array.prototype, fnName, findLastIndex);
|
50
|
+
CreateMethodProperty(self.Float32Array.prototype, fnName, findLastIndex);
|
51
|
+
CreateMethodProperty(self.Float64Array.prototype, fnName, findLastIndex);
|
51
52
|
}
|
52
53
|
})();
|
@@ -1 +1 @@
|
|
1
|
-
{"aliases":["es6","es2015"],"dependencies":["_ArrayIterator","_ESAbstract.CreateMethodProperty","ArrayBuffer"],"license":"MIT","spec":"https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/keys","browsers":{"android":"*","chrome":"<38","edge":"<14","edge_mob":"<14","firefox":"<37","firefox_mob":"<37","ie":"*","ie_mob":"*","opera":"<25","op_mob":"<25","safari":"<10.0","ios_saf":"<10.0","samsung_mob":"<3.0"},"detectSource":"\"Int8Array\"in self&&\"keys\"in self.Int8Array.prototype\n","baseDir":"TypedArray/prototype/keys","hasTests":true,"isTestable":true,"isPublic":true,"size":
|
1
|
+
{"aliases":["es6","es2015"],"dependencies":["_ArrayIterator","_ESAbstract.CreateMethodProperty","ArrayBuffer"],"license":"MIT","spec":"https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/keys","browsers":{"android":"*","chrome":"<38","edge":"<14","edge_mob":"<14","firefox":"<37","firefox_mob":"<37","ie":"*","ie_mob":"*","opera":"<25","op_mob":"<25","safari":"<10.0","ios_saf":"<10.0","samsung_mob":"<3.0"},"detectSource":"\"Int8Array\"in self&&\"keys\"in self.Int8Array.prototype\n","baseDir":"TypedArray/prototype/keys","hasTests":true,"isTestable":true,"isPublic":true,"size":760}
|
@@ -1 +1 @@
|
|
1
|
-
!function(){
|
1
|
+
!function(){function e(){var e=this;return new ArrayIterator(e,"key")}"__proto__"in self.Int8Array.prototype&&self.Int8Array.prototype.__proto__!==Object.prototype?CreateMethodProperty(self.Int8Array.prototype.__proto__,"keys",e):(CreateMethodProperty(self.Int8Array.prototype,"keys",e),CreateMethodProperty(self.Uint8Array.prototype,"keys",e),CreateMethodProperty(self.Uint8ClampedArray.prototype,"keys",e),CreateMethodProperty(self.Int16Array.prototype,"keys",e),CreateMethodProperty(self.Uint16Array.prototype,"keys",e),CreateMethodProperty(self.Int32Array.prototype,"keys",e),CreateMethodProperty(self.Uint32Array.prototype,"keys",e),CreateMethodProperty(self.Float32Array.prototype,"keys",e),CreateMethodProperty(self.Float64Array.prototype,"keys",e))}();
|
@@ -3,30 +3,7 @@
|
|
3
3
|
/* global CreateMethodProperty, ArrayIterator */
|
4
4
|
// 23.2.3.19 %TypedArray%.prototype.keys ( )
|
5
5
|
(function () {
|
6
|
-
|
7
|
-
|
8
|
-
function createMethodProperties (fn) {
|
9
|
-
var fnName = 'keys'
|
10
|
-
|
11
|
-
// in IE11, `Int8Array.prototype` inherits directly from `Object.prototype`
|
12
|
-
// in that case, don't define it on the parent; define it directly on the prototype
|
13
|
-
if ('__proto__' in self.Int8Array.prototype && self.Int8Array.prototype.__proto__ !== Object.prototype) {
|
14
|
-
// set this on the underlying "TypedArrayPrototype", which is shared with all "TypedArray" subclasses
|
15
|
-
CreateMethodProperty(self.Int8Array.prototype.__proto__, fnName, fn);
|
16
|
-
} else {
|
17
|
-
CreateMethodProperty(self.Int8Array.prototype, fnName, fn);
|
18
|
-
CreateMethodProperty(self.Uint8Array.prototype, fnName, fn);
|
19
|
-
CreateMethodProperty(self.Uint8ClampedArray.prototype, fnName, fn);
|
20
|
-
CreateMethodProperty(self.Int16Array.prototype, fnName, fn);
|
21
|
-
CreateMethodProperty(self.Uint16Array.prototype, fnName, fn);
|
22
|
-
CreateMethodProperty(self.Int32Array.prototype, fnName, fn);
|
23
|
-
CreateMethodProperty(self.Uint32Array.prototype, fnName, fn);
|
24
|
-
CreateMethodProperty(self.Float32Array.prototype, fnName, fn);
|
25
|
-
CreateMethodProperty(self.Float64Array.prototype, fnName, fn);
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
createMethodProperties(function keys () {
|
6
|
+
function keys() {
|
30
7
|
// 1. Let O be the this value.
|
31
8
|
var O = this;
|
32
9
|
// 2. Perform ? ValidateTypedArray(O).
|
@@ -34,5 +11,24 @@
|
|
34
11
|
// 3. Return CreateArrayIterator(O, key).
|
35
12
|
// TODO: Add CreateArrayIterator
|
36
13
|
return new ArrayIterator(O, 'key');
|
37
|
-
}
|
14
|
+
}
|
15
|
+
|
16
|
+
// use "Int8Array" as a proxy for support of "TypedArray" subclasses
|
17
|
+
var fnName = 'keys'
|
18
|
+
// in IE11, `Int8Array.prototype` inherits directly from `Object.prototype`
|
19
|
+
// in that case, don't define it on the parent; define it directly on the prototype
|
20
|
+
if ('__proto__' in self.Int8Array.prototype && self.Int8Array.prototype.__proto__ !== Object.prototype) {
|
21
|
+
// set this on the underlying "TypedArrayPrototype", which is shared with all "TypedArray" subclasses
|
22
|
+
CreateMethodProperty(self.Int8Array.prototype.__proto__, fnName, keys);
|
23
|
+
} else {
|
24
|
+
CreateMethodProperty(self.Int8Array.prototype, fnName, keys);
|
25
|
+
CreateMethodProperty(self.Uint8Array.prototype, fnName, keys);
|
26
|
+
CreateMethodProperty(self.Uint8ClampedArray.prototype, fnName, keys);
|
27
|
+
CreateMethodProperty(self.Int16Array.prototype, fnName, keys);
|
28
|
+
CreateMethodProperty(self.Uint16Array.prototype, fnName, keys);
|
29
|
+
CreateMethodProperty(self.Int32Array.prototype, fnName, keys);
|
30
|
+
CreateMethodProperty(self.Uint32Array.prototype, fnName, keys);
|
31
|
+
CreateMethodProperty(self.Float32Array.prototype, fnName, keys);
|
32
|
+
CreateMethodProperty(self.Float64Array.prototype, fnName, keys);
|
33
|
+
}
|
38
34
|
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.IsCallable","ArrayBuffer"],"license":"MIT","spec":"https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/sort","browsers":{"android":"*","bb":"*","chrome":"<45","edge":"<12","edge_mob":"<12","firefox":"<46","firefox_mob":"<46","ie":"*","ie_mob":"*","opera":"<32","op_mob":"<32","op_mini":"*","safari":"<10.0","ios_saf":"<10.0","samsung_mob":"<5.0"},"detectSource":"\"Int8Array\"in self&&\"sort\"in self.Int8Array.prototype\n","baseDir":"TypedArray/prototype/sort","hasTests":true,"isTestable":true,"isPublic":true,"size":1034}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){function r(r){function t(t,e){return t!==t&&e!==e?0:t!==t?1:e!==e?-1:void 0!==r?r(t,e):t<e?-1:t>e?1:0}if(void 0!==r&&!1===IsCallable(r))throw new TypeError("The comparison function must be either a function or undefined");for(var e=this,o=e.length,p=Array(o),y=0;y<o;y++)p[y]=e[y];p.sort(t);for(var a=0;a<o;)e[a]=p[a],a+=1;return e}"__proto__"in self.Int8Array.prototype&&self.Int8Array.prototype.__proto__!==Object.prototype?CreateMethodProperty(self.Int8Array.prototype.__proto__,"sort",r):(CreateMethodProperty(self.Int8Array.prototype,"sort",r),CreateMethodProperty(self.Uint8Array.prototype,"sort",r),CreateMethodProperty(self.Uint8ClampedArray.prototype,"sort",r),CreateMethodProperty(self.Int16Array.prototype,"sort",r),CreateMethodProperty(self.Uint16Array.prototype,"sort",r),CreateMethodProperty(self.Int32Array.prototype,"sort",r),CreateMethodProperty(self.Uint32Array.prototype,"sort",r),CreateMethodProperty(self.Float32Array.prototype,"sort",r),CreateMethodProperty(self.Float64Array.prototype,"sort",r))}();
|
@@ -0,0 +1,71 @@
|
|
1
|
+
|
2
|
+
// TypedArray.prototype.sort
|
3
|
+
/* global CreateMethodProperty, IsCallable */
|
4
|
+
// 23.2.3.29 %TypedArray%.prototype.sort ( comparefn )
|
5
|
+
(function () {
|
6
|
+
function sort(comparefn) {
|
7
|
+
// 1. If comparefn is not undefined and IsCallable(comparefn) is false, throw a TypeError exception.
|
8
|
+
if (comparefn !== undefined && IsCallable(comparefn) === false) {
|
9
|
+
throw new TypeError(
|
10
|
+
"The comparison function must be either a function or undefined"
|
11
|
+
);
|
12
|
+
}
|
13
|
+
// 2. Let obj be the this value.
|
14
|
+
var obj = this;
|
15
|
+
// 3. Perform ? ValidateTypedArray(obj).
|
16
|
+
// TODO: Add ValidateTypedArray
|
17
|
+
// 4. Let len be obj.[[ArrayLength]].
|
18
|
+
var len = obj.length;
|
19
|
+
|
20
|
+
// Polyfill.io - This is based on https://github.com/inexorabletash/polyfill/blob/716a3f36ca10fad032083014faf1a47c638e2502/typedarray.js#L848-L858
|
21
|
+
// 5. NOTE: The following closure performs a numeric comparison rather than the string comparison used in 23.1.3.30.
|
22
|
+
// 6. Let SortCompare be a new Abstract Closure with parameters (x, y) that captures comparefn and performs the following steps when called:
|
23
|
+
// a. Return ? CompareTypedArrayElements(x, y, comparefn).
|
24
|
+
function sortCompare(x, y) {
|
25
|
+
if (x !== x && y !== y) return +0;
|
26
|
+
if (x !== x) return 1;
|
27
|
+
if (y !== y) return -1;
|
28
|
+
if (comparefn !== undefined) {
|
29
|
+
return comparefn(x, y);
|
30
|
+
}
|
31
|
+
if (x < y) return -1;
|
32
|
+
if (x > y) return 1;
|
33
|
+
return +0;
|
34
|
+
}
|
35
|
+
|
36
|
+
// 7. Let sortedList be ? SortIndexedProperties(obj, len, SortCompare, read-through-holes).
|
37
|
+
var sortedList = Array(len);
|
38
|
+
for (var i = 0; i < len; i++) sortedList[i] = obj[i];
|
39
|
+
sortedList.sort(sortCompare);
|
40
|
+
|
41
|
+
// 8. Let j be 0.
|
42
|
+
var j = 0;
|
43
|
+
// 9. Repeat, while j < len,
|
44
|
+
while (j < len) {
|
45
|
+
// a. Perform ! Set(obj, ! ToString(𝔽(j)), sortedList[j], true).
|
46
|
+
obj[j] = sortedList[j];
|
47
|
+
// b. Set j to j + 1.
|
48
|
+
j = j + 1;
|
49
|
+
}
|
50
|
+
|
51
|
+
// 10. Return obj.
|
52
|
+
return obj;
|
53
|
+
}
|
54
|
+
|
55
|
+
// in IE11, `Int8Array.prototype` inherits directly from `Object.prototype`
|
56
|
+
// in that case, don't define it on the parent; define it directly on the prototype
|
57
|
+
if ('__proto__' in self.Int8Array.prototype && self.Int8Array.prototype.__proto__ !== Object.prototype) {
|
58
|
+
// set this on the underlying "TypedArrayPrototype", which is shared with all "TypedArray" subclasses
|
59
|
+
CreateMethodProperty(self.Int8Array.prototype.__proto__, 'sort', sort);
|
60
|
+
} else {
|
61
|
+
CreateMethodProperty(self.Int8Array.prototype, 'sort', sort);
|
62
|
+
CreateMethodProperty(self.Uint8Array.prototype, 'sort', sort);
|
63
|
+
CreateMethodProperty(self.Uint8ClampedArray.prototype, 'sort', sort);
|
64
|
+
CreateMethodProperty(self.Int16Array.prototype, 'sort', sort);
|
65
|
+
CreateMethodProperty(self.Uint16Array.prototype, 'sort', sort);
|
66
|
+
CreateMethodProperty(self.Int32Array.prototype, 'sort', sort);
|
67
|
+
CreateMethodProperty(self.Uint32Array.prototype, 'sort', sort);
|
68
|
+
CreateMethodProperty(self.Float32Array.prototype, 'sort', sort);
|
69
|
+
CreateMethodProperty(self.Float64Array.prototype, 'sort', sort);
|
70
|
+
}
|
71
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2023"],"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.Get","_ESAbstract.ToString","_ESAbstract.TypedArrayCreateSameType","ArrayBuffer"],"license":"MIT","spec":"https://tc39.es/ecma262/#sec-%typedarray%.prototype.toreversed","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/toReversed","browsers":{"android":"*","bb":"*","chrome":"<110","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"<96","op_mob":"<74","op_mini":"*","safari":"<16.3","ios_saf":"<16.3","samsung_mob":"*"},"detectSource":"\"Int8Array\"in self&&\"toReversed\"in self.Int8Array.prototype\n","baseDir":"TypedArray/prototype/toReversed","hasTests":true,"isTestable":true,"isPublic":true,"size":913}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){function e(){for(var e=this,t=e.length,r=TypedArrayCreateSameType(e,[t]),o=0;o<t;){var p=ToString(t-o-1),y=ToString(o),a=Get(e,p);r[y]=a,o+=1}return r}"__proto__"in self.Int8Array.prototype&&self.Int8Array.prototype.__proto__!==Object.prototype?CreateMethodProperty(self.Int8Array.prototype.__proto__,"toReversed",e):(CreateMethodProperty(self.Int8Array.prototype,"toReversed",e),CreateMethodProperty(self.Uint8Array.prototype,"toReversed",e),CreateMethodProperty(self.Uint8ClampedArray.prototype,"toReversed",e),CreateMethodProperty(self.Int16Array.prototype,"toReversed",e),CreateMethodProperty(self.Uint16Array.prototype,"toReversed",e),CreateMethodProperty(self.Int32Array.prototype,"toReversed",e),CreateMethodProperty(self.Uint32Array.prototype,"toReversed",e),CreateMethodProperty(self.Float32Array.prototype,"toReversed",e),CreateMethodProperty(self.Float64Array.prototype,"toReversed",e))}();
|
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
// TypedArray.prototype.toReversed
|
3
|
+
/* global CreateMethodProperty, Get, ToString, TypedArrayCreateSameType */
|
4
|
+
// 23.2.3.32 %TypedArray%.prototype.toReversed ( )
|
5
|
+
(function () {
|
6
|
+
function toReversed() {
|
7
|
+
// 1. Let O be the this value.
|
8
|
+
var O = this;
|
9
|
+
// 2. Perform ? ValidateTypedArray(O).
|
10
|
+
// TODO: Add ValidateTypedArray
|
11
|
+
// 3. Let length be O.[[ArrayLength]].
|
12
|
+
var length = O.length;
|
13
|
+
// 4. Let A be ? TypedArrayCreateSameType(O, « 𝔽(length) »).
|
14
|
+
var A = TypedArrayCreateSameType(O, [ length ]);
|
15
|
+
// 5. Let k be 0.
|
16
|
+
var k = 0;
|
17
|
+
// 6. Repeat, while k < length,
|
18
|
+
while (k < length) {
|
19
|
+
// a. Let from be ! ToString(𝔽(length - k - 1)).
|
20
|
+
var from = ToString(length - k - 1);
|
21
|
+
// b. Let Pk be ! ToString(𝔽(k)).
|
22
|
+
var Pk = ToString(k);
|
23
|
+
// c. Let fromValue be ! Get(O, from).
|
24
|
+
var fromValue = Get(O, from);
|
25
|
+
// d. Perform ! Set(A, Pk, fromValue, true).
|
26
|
+
A[Pk] = fromValue;
|
27
|
+
// e. Set k to k + 1.
|
28
|
+
k = k + 1;
|
29
|
+
}
|
30
|
+
// 7. Return A.
|
31
|
+
return A;
|
32
|
+
}
|
33
|
+
|
34
|
+
// in IE11, `Int8Array.prototype` inherits directly from `Object.prototype`
|
35
|
+
// in that case, don't define it on the parent; define it directly on the prototype
|
36
|
+
if ('__proto__' in self.Int8Array.prototype && self.Int8Array.prototype.__proto__ !== Object.prototype) {
|
37
|
+
// set this on the underlying "TypedArrayPrototype", which is shared with all "TypedArray" subclasses
|
38
|
+
CreateMethodProperty(self.Int8Array.prototype.__proto__, 'toReversed', toReversed);
|
39
|
+
} else {
|
40
|
+
CreateMethodProperty(self.Int8Array.prototype, 'toReversed', toReversed);
|
41
|
+
CreateMethodProperty(self.Uint8Array.prototype, 'toReversed', toReversed);
|
42
|
+
CreateMethodProperty(self.Uint8ClampedArray.prototype, 'toReversed', toReversed);
|
43
|
+
CreateMethodProperty(self.Int16Array.prototype, 'toReversed', toReversed);
|
44
|
+
CreateMethodProperty(self.Uint16Array.prototype, 'toReversed', toReversed);
|
45
|
+
CreateMethodProperty(self.Int32Array.prototype, 'toReversed', toReversed);
|
46
|
+
CreateMethodProperty(self.Uint32Array.prototype, 'toReversed', toReversed);
|
47
|
+
CreateMethodProperty(self.Float32Array.prototype, 'toReversed', toReversed);
|
48
|
+
CreateMethodProperty(self.Float64Array.prototype, 'toReversed', toReversed);
|
49
|
+
}
|
50
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2023"],"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.IsCallable","_ESAbstract.ToString","_ESAbstract.TypedArrayCreateSameType","ArrayBuffer","TypedArray.prototype.sort"],"license":"MIT","spec":"https://tc39.es/ecma262/#sec-%typedarray%.prototype.tosorted","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/toSorted","browsers":{"android":"*","bb":"*","chrome":"<110","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"<96","op_mob":"<74","op_mini":"*","safari":"<16.3","ios_saf":"<16.3","samsung_mob":"*"},"detectSource":"\"Int8Array\"in self&&\"toSorted\"in self.Int8Array.prototype\n","baseDir":"TypedArray/prototype/toSorted","hasTests":true,"isTestable":true,"isPublic":true,"size":999}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){function t(t){if(void 0!==t&&!1===IsCallable(t))throw new TypeError("The comparison function must be either a function or undefined");for(var r=this,e=r.length,o=TypedArrayCreateSameType(r,[e]),p=0;p<e;)o[p]=r[p],p+=1;return void 0!==t?o.sort(t):o.sort(),o}"__proto__"in self.Int8Array.prototype&&self.Int8Array.prototype.__proto__!==Object.prototype?CreateMethodProperty(self.Int8Array.prototype.__proto__,"toSorted",t):(CreateMethodProperty(self.Int8Array.prototype,"toSorted",t),CreateMethodProperty(self.Uint8Array.prototype,"toSorted",t),CreateMethodProperty(self.Uint8ClampedArray.prototype,"toSorted",t),CreateMethodProperty(self.Int16Array.prototype,"toSorted",t),CreateMethodProperty(self.Uint16Array.prototype,"toSorted",t),CreateMethodProperty(self.Int32Array.prototype,"toSorted",t),CreateMethodProperty(self.Uint32Array.prototype,"toSorted",t),CreateMethodProperty(self.Float32Array.prototype,"toSorted",t),CreateMethodProperty(self.Float64Array.prototype,"toSorted",t))}();
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
// TypedArray.prototype.toSorted
|
3
|
+
/* global CreateMethodProperty, IsCallable, TypedArrayCreateSameType */
|
4
|
+
// 23.2.3.33 %TypedArray%.prototype.toSorted ( comparefn )
|
5
|
+
(function () {
|
6
|
+
function toSorted(comparefn) {
|
7
|
+
// 1. If comparefn is not undefined and IsCallable(comparefn) is false, throw a TypeError exception.
|
8
|
+
if (comparefn !== undefined && IsCallable(comparefn) === false) {
|
9
|
+
throw new TypeError(
|
10
|
+
"The comparison function must be either a function or undefined"
|
11
|
+
);
|
12
|
+
}
|
13
|
+
// 2. Let O be the this value.
|
14
|
+
var O = this;
|
15
|
+
// 3. Perform ? ValidateTypedArray(O).
|
16
|
+
// TODO: Add ValidateTypedArray
|
17
|
+
// 4. Let len be O.[[ArrayLength]].
|
18
|
+
var len = O.length;
|
19
|
+
// 5. Let A be ? TypedArrayCreateSameType(O, « 𝔽(len) »).
|
20
|
+
var A = TypedArrayCreateSameType(O, [ len ]);
|
21
|
+
|
22
|
+
// 9. Let j be 0.
|
23
|
+
var j = 0;
|
24
|
+
// 10. Repeat, while j < len,
|
25
|
+
while (j < len) {
|
26
|
+
// a. Perform ! Set(A, ! ToString(𝔽(j)), sortedList[j], true).
|
27
|
+
A[j] = O[j];
|
28
|
+
// b. Set j to j + 1.
|
29
|
+
j = j + 1;
|
30
|
+
}
|
31
|
+
|
32
|
+
// Polyfill.io - These steps are handled by native `%TypedArray%.prototype.sort`, below
|
33
|
+
// 6. NOTE: The following closure performs a numeric comparison rather than the string comparison used in 23.1.3.34.
|
34
|
+
// 7. Let SortCompare be a new Abstract Closure with parameters (x, y) that captures comparefn and performs the following steps when called:
|
35
|
+
// a. Return ? CompareTypedArrayElements(x, y, comparefn).
|
36
|
+
// 8. Let sortedList be ? SortIndexedProperties(O, len, SortCompare, read-through-holes).
|
37
|
+
comparefn !== undefined ? A.sort(comparefn) : A.sort();
|
38
|
+
|
39
|
+
// 11. Return A.
|
40
|
+
return A;
|
41
|
+
}
|
42
|
+
|
43
|
+
// in IE11, `Int8Array.prototype` inherits directly from `Object.prototype`
|
44
|
+
// in that case, don't define it on the parent; define it directly on the prototype
|
45
|
+
if ('__proto__' in self.Int8Array.prototype && self.Int8Array.prototype.__proto__ !== Object.prototype) {
|
46
|
+
// set this on the underlying "TypedArrayPrototype", which is shared with all "TypedArray" subclasses
|
47
|
+
CreateMethodProperty(self.Int8Array.prototype.__proto__, 'toSorted', toSorted);
|
48
|
+
} else {
|
49
|
+
CreateMethodProperty(self.Int8Array.prototype, 'toSorted', toSorted);
|
50
|
+
CreateMethodProperty(self.Uint8Array.prototype, 'toSorted', toSorted);
|
51
|
+
CreateMethodProperty(self.Uint8ClampedArray.prototype, 'toSorted', toSorted);
|
52
|
+
CreateMethodProperty(self.Int16Array.prototype, 'toSorted', toSorted);
|
53
|
+
CreateMethodProperty(self.Uint16Array.prototype, 'toSorted', toSorted);
|
54
|
+
CreateMethodProperty(self.Int32Array.prototype, 'toSorted', toSorted);
|
55
|
+
CreateMethodProperty(self.Uint32Array.prototype, 'toSorted', toSorted);
|
56
|
+
CreateMethodProperty(self.Float32Array.prototype, 'toSorted', toSorted);
|
57
|
+
CreateMethodProperty(self.Float64Array.prototype, 'toSorted', toSorted);
|
58
|
+
}
|
59
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2023"],"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.Get","_ESAbstract.IsValidIntegerIndex","_ESAbstract.ToIntegerOrInfinity","_ESAbstract.ToNumber","_ESAbstract.ToObject","_ESAbstract.ToString","_ESAbstract.TypedArrayCreateSameType","ArrayBuffer","Function.prototype.name"],"license":"MIT","spec":"https://tc39.es/ecma262/#sec-%typedarray%.prototype.with","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/with","browsers":{"android":"*","bb":"*","chrome":"<110","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"<96","op_mob":"<74","op_mini":"*","safari":"<16.3","ios_saf":"<16.3","samsung_mob":"*"},"detectSource":"\"Int8Array\"in self&&\"with\"in self.Int8Array.prototype\n","baseDir":"TypedArray/prototype/with","hasTests":true,"isTestable":true,"isPublic":true,"size":1178}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){function t(t,e){var r=this,o=r.length,p=ToIntegerOrInfinity(t),a=p>=0?p:o+p,y=ToNumber(e);if(!1===IsValidIntegerIndex(r,a))throw new RangeError("Invalid index");for(var n=TypedArrayCreateSameType(r,[o]),i=0;i<o;){var h=ToString(i),l=i===a?y:Get(r,h);n[h]=l,i+=1}return n}(function(){var t=function(){};try{return Object.defineProperty(t,"name",{value:"test"}),!0}catch(t){return!1}})()&&Object.defineProperty(t,"name",{value:"with",writable:!1,enumerable:!1,configurable:!0}),"__proto__"in self.Int8Array.prototype&&self.Int8Array.prototype.__proto__!==Object.prototype?CreateMethodProperty(self.Int8Array.prototype.__proto__,"with",t):(CreateMethodProperty(self.Int8Array.prototype,"with",t),CreateMethodProperty(self.Uint8Array.prototype,"with",t),CreateMethodProperty(self.Uint8ClampedArray.prototype,"with",t),CreateMethodProperty(self.Int16Array.prototype,"with",t),CreateMethodProperty(self.Uint16Array.prototype,"with",t),CreateMethodProperty(self.Int32Array.prototype,"with",t),CreateMethodProperty(self.Uint32Array.prototype,"with",t),CreateMethodProperty(self.Float32Array.prototype,"with",t),CreateMethodProperty(self.Float64Array.prototype,"with",t))}();
|
@@ -0,0 +1,83 @@
|
|
1
|
+
|
2
|
+
// TypedArray.prototype.with
|
3
|
+
/* global CreateMethodProperty, Get, IsValidIntegerIndex, ToIntegerOrInfinity, ToNumber, ToString, TypedArrayCreateSameType */
|
4
|
+
// 23.2.3.36 %TypedArray%.prototype.with ( index, value )
|
5
|
+
(function () {
|
6
|
+
function With(index, value) {
|
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, let actualIndex be relativeIndex.
|
16
|
+
// 6. Else, let actualIndex be len + relativeIndex.
|
17
|
+
var actualIndex = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
|
18
|
+
// 7. If O.[[ContentType]] is BigInt, let numericValue be ? ToBigInt(value).
|
19
|
+
// TODO: Add BigInt support
|
20
|
+
// 8. Else, let numericValue be ? ToNumber(value).
|
21
|
+
var numericValue = ToNumber(value);
|
22
|
+
// 9. If IsValidIntegerIndex(O, 𝔽(actualIndex)) is false, throw a RangeError exception.
|
23
|
+
if (IsValidIntegerIndex(O, actualIndex) === false) {
|
24
|
+
throw new RangeError('Invalid index');
|
25
|
+
}
|
26
|
+
// 10. Let A be ? TypedArrayCreateSameType(O, « 𝔽(len) »).
|
27
|
+
var A = TypedArrayCreateSameType(O, [ len ]);
|
28
|
+
// 11. Let k be 0.
|
29
|
+
var k = 0;
|
30
|
+
// 12. Repeat, while k < len,
|
31
|
+
while (k < len) {
|
32
|
+
// a. Let Pk be ! ToString(𝔽(k)).
|
33
|
+
var Pk = ToString(k);
|
34
|
+
// b. If k is actualIndex, let fromValue be numericValue.
|
35
|
+
// c. Else, let fromValue be ! Get(O, Pk).
|
36
|
+
var fromValue = k === actualIndex ? numericValue : Get(O, Pk);
|
37
|
+
// d. Perform ! Set(A, Pk, fromValue, true).
|
38
|
+
A[Pk] = fromValue;
|
39
|
+
// e. Set k to k + 1.
|
40
|
+
k = k + 1;
|
41
|
+
}
|
42
|
+
// 13. Return A.
|
43
|
+
return A;
|
44
|
+
}
|
45
|
+
|
46
|
+
var supportsDefiningFunctionName = (function () {
|
47
|
+
var fn = function () {};
|
48
|
+
try {
|
49
|
+
Object.defineProperty(fn, 'name', {
|
50
|
+
value: 'test'
|
51
|
+
});
|
52
|
+
return true;
|
53
|
+
} catch (ignore) {
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
})();
|
57
|
+
|
58
|
+
if (supportsDefiningFunctionName) {
|
59
|
+
Object.defineProperty(With, 'name', {
|
60
|
+
value: 'with',
|
61
|
+
writable: false,
|
62
|
+
enumerable: false,
|
63
|
+
configurable: true
|
64
|
+
})
|
65
|
+
}
|
66
|
+
|
67
|
+
// in IE11, `Int8Array.prototype` inherits directly from `Object.prototype`
|
68
|
+
// in that case, don't define it on the parent; define it directly on the prototype
|
69
|
+
if ('__proto__' in self.Int8Array.prototype && self.Int8Array.prototype.__proto__ !== Object.prototype) {
|
70
|
+
// set this on the underlying "TypedArrayPrototype", which is shared with all "TypedArray" subclasses
|
71
|
+
CreateMethodProperty(self.Int8Array.prototype.__proto__, 'with', With);
|
72
|
+
} else {
|
73
|
+
CreateMethodProperty(self.Int8Array.prototype, 'with', With);
|
74
|
+
CreateMethodProperty(self.Uint8Array.prototype, 'with', With);
|
75
|
+
CreateMethodProperty(self.Uint8ClampedArray.prototype, 'with', With);
|
76
|
+
CreateMethodProperty(self.Int16Array.prototype, 'with', With);
|
77
|
+
CreateMethodProperty(self.Uint16Array.prototype, 'with', With);
|
78
|
+
CreateMethodProperty(self.Int32Array.prototype, 'with', With);
|
79
|
+
CreateMethodProperty(self.Uint32Array.prototype, 'with', With);
|
80
|
+
CreateMethodProperty(self.Float32Array.prototype, 'with', With);
|
81
|
+
CreateMethodProperty(self.Float64Array.prototype, 'with', With);
|
82
|
+
}
|
83
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"dependencies":["_ESAbstract.IsInteger"],"spec":"https://tc39.es/ecma262/#sec-isvalidintegerindex","browsers":{"android":"*","bb":"*","chrome":"*","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"*","op_mob":"*","op_mini":"*","safari":"*","ios_saf":"*","samsung_mob":"*"},"detectSource":"","baseDir":"_ESAbstract/IsValidIntegerIndex","hasTests":false,"isTestable":true,"isPublic":false,"size":92}
|
@@ -0,0 +1 @@
|
|
1
|
+
function IsValidIntegerIndex(e,n){return!1!==IsInteger(n)&&(1/n!=-1/0&&!(n<0||n>=e.length))}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
// _ESAbstract.IsValidIntegerIndex
|
3
|
+
/* globals IsInteger */
|
4
|
+
// 10.4.5.9 IsValidIntegerIndex ( O, index )
|
5
|
+
function IsValidIntegerIndex(O, index) { // eslint-disable-line no-unused-vars
|
6
|
+
// 1. If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return false.
|
7
|
+
// 2. If IsIntegralNumber(index) is false, return false.
|
8
|
+
if (IsInteger(index) === false) return false;
|
9
|
+
// 3. If index is -0𝔽, return false.
|
10
|
+
// eslint-disable-next-line no-compare-neg-zero
|
11
|
+
if (1 / index === -Infinity) return false;
|
12
|
+
// 4. If ℝ(index) < 0 or ℝ(index) ≥ O.[[ArrayLength]], return false.
|
13
|
+
if (index < 0 || index >= O.length) return false;
|
14
|
+
// 5. Return true.
|
15
|
+
return true;
|
16
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"dependencies":["_ESAbstract.Construct"],"spec":"https://tc39.es/ecma262/#typedarray-create","browsers":{"android":"*","bb":"*","chrome":"*","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"*","op_mob":"*","op_mini":"*","safari":"*","ios_saf":"*","samsung_mob":"*"},"detectSource":"","baseDir":"_ESAbstract/TypedArrayCreate","hasTests":false,"isTestable":true,"isPublic":false,"size":164}
|
@@ -0,0 +1 @@
|
|
1
|
+
function TypedArrayCreate(e,r){var t="object"==typeof e?new e(r[0]):Construct(e,r);if(1===r.length&&"number"==typeof r[0]&&t.length<r[0])throw TypeError();return t}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
// _ESAbstract.TypedArrayCreate
|
3
|
+
/* global Construct */
|
4
|
+
// 23.2.4.2 TypedArrayCreate ( constructor, argumentList )
|
5
|
+
function TypedArrayCreate(constructor, argumentList) { // eslint-disable-line no-unused-vars
|
6
|
+
// 1. Let newTypedArray be ? Construct(constructor, argumentList).
|
7
|
+
var newTypedArray = typeof constructor === 'object'
|
8
|
+
// TODO: Remove this once we drop support for Safari <10, which does not consider `Int8Array` as a constructor (`typeof Int8Array === 'object'`)
|
9
|
+
? new constructor(argumentList[0])
|
10
|
+
: Construct(constructor, argumentList);
|
11
|
+
// 2. Perform ? ValidateTypedArray(newTypedArray).
|
12
|
+
// TODO: Add ValidateTypedArray
|
13
|
+
// 3. If the number of elements in argumentList is 1 and argumentList[0] is a Number, then
|
14
|
+
if (argumentList.length === 1 && typeof argumentList[0] === 'number') {
|
15
|
+
// a. If newTypedArray.[[ArrayLength]] < ℝ(argumentList[0]), throw a TypeError exception.
|
16
|
+
if (newTypedArray.length < argumentList[0]) throw TypeError();
|
17
|
+
}
|
18
|
+
// 4. Return newTypedArray.
|
19
|
+
return newTypedArray;
|
20
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"dependencies":["_ESAbstract.TypedArrayCreate","Function.prototype.name"],"spec":"https://tc39.es/ecma262/#sec-typedarray-create-same-type","browsers":{"android":"*","bb":"*","chrome":"*","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"*","op_mob":"*","op_mini":"*","safari":"*","ios_saf":"*","samsung_mob":"*"},"detectSource":"","baseDir":"_ESAbstract/TypedArrayCreateSameType","hasTests":false,"isTestable":true,"isPublic":false,"size":689}
|
@@ -0,0 +1 @@
|
|
1
|
+
function TypedArrayCreateSameType(r,a){var t={Int8Array:self.Int8Array,Uint8Array:self.Uint8Array,Uint8ClampedArray:self.Uint8ClampedArray,Int16Array:self.Int16Array,Uint16Array:self.Uint16Array,Int32Array:self.Int32Array,Uint32Array:self.Uint32Array,Float32Array:self.Float32Array,Float64Array:self.Float64Array}[r&&r.constructor&&r.constructor.name];if(!t){var e=Object.getPrototypeOf(Object(r));t={packI8:self.Int8Array,packU8:self.Uint8Array,packU8Clamped:self.Uint8ClampedArray,packI16:self.Int16Array,packU16:self.Uint16Array,packI32:self.Int32Array,packU32:self.Uint32Array,packF32:self.Float32Array,packF64:self.Float64Array}[e&&e._pack&&e._pack.name]}return TypedArrayCreate(t,a)}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
// _ESAbstract.TypedArrayCreateSameType
|
3
|
+
/* global TypedArrayCreate */
|
4
|
+
// 23.2.4.3 TypedArrayCreateSameType ( exemplar, argumentList )
|
5
|
+
function TypedArrayCreateSameType(exemplar, argumentList) { // eslint-disable-line no-unused-vars
|
6
|
+
// 1. Let constructor be the intrinsic object associated with the constructor name exemplar.[[TypedArrayName]] in Table 68.
|
7
|
+
var constructor = {
|
8
|
+
Int8Array: self.Int8Array,
|
9
|
+
Uint8Array: self.Uint8Array,
|
10
|
+
Uint8ClampedArray: self.Uint8ClampedArray,
|
11
|
+
Int16Array: self.Int16Array,
|
12
|
+
Uint16Array: self.Uint16Array,
|
13
|
+
Int32Array: self.Int32Array,
|
14
|
+
Uint32Array: self.Uint32Array,
|
15
|
+
Float32Array: self.Float32Array,
|
16
|
+
Float64Array: self.Float64Array
|
17
|
+
}[exemplar && exemplar.constructor && exemplar.constructor.name];
|
18
|
+
|
19
|
+
// Polyfill.io - the `ArrayBuffer` polyfill does not expose a proper `constructor.name`
|
20
|
+
if (!constructor) {
|
21
|
+
var proto = Object.getPrototypeOf(Object(exemplar));
|
22
|
+
constructor = {
|
23
|
+
packI8: self.Int8Array,
|
24
|
+
packU8: self.Uint8Array,
|
25
|
+
packU8Clamped: self.Uint8ClampedArray,
|
26
|
+
packI16: self.Int16Array,
|
27
|
+
packU16: self.Uint16Array,
|
28
|
+
packI32: self.Int32Array,
|
29
|
+
packU32: self.Uint32Array,
|
30
|
+
packF32: self.Float32Array,
|
31
|
+
packF64: self.Float64Array
|
32
|
+
}[proto && proto._pack && proto._pack.name];
|
33
|
+
}
|
34
|
+
|
35
|
+
// 2. Let result be ? TypedArrayCreate(constructor, argumentList).
|
36
|
+
var result = TypedArrayCreate(constructor, argumentList);
|
37
|
+
// 3. Assert: result has [[TypedArrayName]] and [[ContentType]] internal slots.
|
38
|
+
// 4. Assert: result.[[ContentType]] is exemplar.[[ContentType]].
|
39
|
+
// 5. Return result.
|
40
|
+
return result;
|
41
|
+
}
|