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