main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
924 bytes
|
Line | |
---|
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 |
|
---|
10 | // `Set.prototype.isDisjointFrom` method
|
---|
11 | // https://tc39.github.io/proposal-set-methods/#Set.prototype.isDisjointFrom
|
---|
12 | module.exports = function isDisjointFrom(other) {
|
---|
13 | var O = aSet(this);
|
---|
14 | var otherRec = getSetRecord(other);
|
---|
15 | if (size(O) <= otherRec.size) return iterateSet(O, function (e) {
|
---|
16 | if (otherRec.includes(e)) return false;
|
---|
17 | }, true) !== false;
|
---|
18 | var iterator = otherRec.getIterator();
|
---|
19 | return iterateSimple(iterator, function (e) {
|
---|
20 | if (has(O, e)) return iteratorClose(iterator, 'normal', false);
|
---|
21 | }) !== false;
|
---|
22 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.