MES手机端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

20 lines
776 B

  1. 'use strict';
  2. var aSet = require('../internals/a-set');
  3. var has = require('../internals/set-helpers').has;
  4. var size = require('../internals/set-size');
  5. var getSetRecord = require('../internals/get-set-record');
  6. var iterateSimple = require('../internals/iterate-simple');
  7. var iteratorClose = require('../internals/iterator-close');
  8. // `Set.prototype.isSupersetOf` method
  9. // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSupersetOf
  10. module.exports = function isSupersetOf(other) {
  11. var O = aSet(this);
  12. var otherRec = getSetRecord(other);
  13. if (size(O) < otherRec.size) return false;
  14. var iterator = otherRec.getIterator();
  15. return iterateSimple(iterator, function (e) {
  16. if (!has(O, e)) return iteratorClose(iterator, 'normal', false);
  17. }) !== false;
  18. };