Node-Red configuration
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.

set-is-disjoint-from.js 924B

12345678910111213141516171819202122
  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 iterateSet = require('../internals/set-iterate');
  7. var iterateSimple = require('../internals/iterate-simple');
  8. var iteratorClose = require('../internals/iterator-close');
  9. // `Set.prototype.isDisjointFrom` method
  10. // https://tc39.github.io/proposal-set-methods/#Set.prototype.isDisjointFrom
  11. module.exports = function isDisjointFrom(other) {
  12. var O = aSet(this);
  13. var otherRec = getSetRecord(other);
  14. if (size(O) <= otherRec.size) return iterateSet(O, function (e) {
  15. if (otherRec.includes(e)) return false;
  16. }, true) !== false;
  17. var iterator = otherRec.getIterator();
  18. return iterateSimple(iterator, function (e) {
  19. if (has(O, e)) return iteratorClose(iterator, 'normal', false);
  20. }) !== false;
  21. };