amis-rpc-design/node_modules/core-js/internals/set-method-accept-set-like.js

36 lines
750 B
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
'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;
}
};