UNPKG

750 BJavaScriptView Raw
1'use strict';
2var getBuiltIn = require('../internals/get-built-in');
3
4var 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
20module.exports = function (name) {
21 var Set = getBuiltIn('Set');
22 try {
23 new Set()[name](createSetLike(0));
24 try {
25 // late spec change, early WebKit ~ Safari 17.0 beta implementation does not pass it
26 // https://github.com/tc39/proposal-set-methods/pull/88
27 new Set()[name](createSetLike(-1));
28 return false;
29 } catch (error2) {
30 return true;
31 }
32 } catch (error) {
33 return false;
34 }
35};