amis-rpc-design/node_modules/core-js/internals/set-is-superset-of.js
2023-10-07 19:42:30 +08:00

20 lines
776 B
JavaScript

'use strict';
var aSet = require('../internals/a-set');
var has = require('../internals/set-helpers').has;
var size = require('../internals/set-size');
var getSetRecord = require('../internals/get-set-record');
var iterateSimple = require('../internals/iterate-simple');
var iteratorClose = require('../internals/iterator-close');
// `Set.prototype.isSupersetOf` method
// https://tc39.github.io/proposal-set-methods/#Set.prototype.isSupersetOf
module.exports = function isSupersetOf(other) {
var O = aSet(this);
var otherRec = getSetRecord(other);
if (size(O) < otherRec.size) return false;
var iterator = otherRec.getIterator();
return iterateSimple(iterator, function (e) {
if (!has(O, e)) return iteratorClose(iterator, 'normal', false);
}) !== false;
};