esnext.set.is-disjoint-from.js 721 B

123456789101112131415161718
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var call = require('../internals/function-call');
  4. var aCallable = require('../internals/a-callable');
  5. var anObject = require('../internals/an-object');
  6. var iterate = require('../internals/iterate');
  7. // `Set.prototype.isDisjointFrom` method
  8. // https://tc39.github.io/proposal-set-methods/#Set.prototype.isDisjointFrom
  9. $({ target: 'Set', proto: true, real: true, forced: true }, {
  10. isDisjointFrom: function isDisjointFrom(iterable) {
  11. var set = anObject(this);
  12. var hasCheck = aCallable(set.has);
  13. return !iterate(iterable, function (value, stop) {
  14. if (call(hasCheck, set, value) === true) return stop();
  15. }, { INTERRUPTED: true }).stopped;
  16. }
  17. });