es-set
Version:
An ES-spec-compliant Set shim/polyfill/replacement that works as far down as ES3
17 lines (13 loc) • 476 B
JavaScript
;
var SLOT = require('internal-slot');
var ToString = require('es-abstract/2024/ToString');
var Type = require('es-abstract/2024/Type');
var isSet = function isSet(set) {
return SLOT.has(set, '[[es6set]]');
};
exports.isSet = isSet;
exports.requireSetSlot = function requireSetSlot(set, method) {
if (Type(set) !== 'Object' || !isSet(set)) {
throw new TypeError('Method Set.prototype.' + method + ' called on incompatible receiver ' + ToString(set));
}
};