main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var getBuiltIn = require('../internals/get-built-in');
|
---|
3 |
|
---|
4 | var createSetLike = function (size) {
|
---|
5 | return {
|
---|
6 | size: size,
|
---|
7 | has: function () {
|
---|
8 | return false;
|
---|
9 | },
|
---|
10 | keys: function () {
|
---|
11 | return {
|
---|
12 | next: function () {
|
---|
13 | return { done: true };
|
---|
14 | }
|
---|
15 | };
|
---|
16 | }
|
---|
17 | };
|
---|
18 | };
|
---|
19 |
|
---|
20 | var createSetLikeWithInfinitySize = function (size) {
|
---|
21 | return {
|
---|
22 | size: size,
|
---|
23 | has: function () {
|
---|
24 | return true;
|
---|
25 | },
|
---|
26 | keys: function () {
|
---|
27 | throw new Error('e');
|
---|
28 | }
|
---|
29 | };
|
---|
30 | };
|
---|
31 |
|
---|
32 | module.exports = function (name, callback) {
|
---|
33 | var Set = getBuiltIn('Set');
|
---|
34 | try {
|
---|
35 | new Set()[name](createSetLike(0));
|
---|
36 | try {
|
---|
37 | // late spec change, early WebKit ~ Safari 17.0 beta implementation does not pass it
|
---|
38 | // https://github.com/tc39/proposal-set-methods/pull/88
|
---|
39 | new Set()[name](createSetLike(-1));
|
---|
40 | return false;
|
---|
41 | } catch (error2) {
|
---|
42 | if (!callback) return true;
|
---|
43 | // early V8 implementation bug
|
---|
44 | // https://issues.chromium.org/issues/351332634
|
---|
45 | try {
|
---|
46 | new Set()[name](createSetLikeWithInfinitySize(-Infinity));
|
---|
47 | return false;
|
---|
48 | } catch (error) {
|
---|
49 | var set = new Set();
|
---|
50 | set.add(1);
|
---|
51 | set.add(2);
|
---|
52 | return callback(set[name](createSetLikeWithInfinitySize(Infinity)));
|
---|
53 | }
|
---|
54 | }
|
---|
55 | } catch (error) {
|
---|
56 | return false;
|
---|
57 | }
|
---|
58 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.