PromoCursed/node_modules/core-js/internals/set-method-accept-set-like.js
2024-08-20 23:25:37 +04:00

36 lines
750 B
JavaScript

'use strict';
var getBuiltIn = require('../internals/get-built-in');
var createSetLike = function (size) {
return {
size: size,
has: function () {
return false;
},
keys: function () {
return {
next: function () {
return { done: true };
}
};
}
};
};
module.exports = function (name) {
var Set = getBuiltIn('Set');
try {
new Set()[name](createSetLike(0));
try {
// late spec change, early WebKit ~ Safari 17.0 beta implementation does not pass it
// https://github.com/tc39/proposal-set-methods/pull/88
new Set()[name](createSetLike(-1));
return false;
} catch (error2) {
return true;
}
} catch (error) {
return false;
}
};