main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
583 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 | var aSet = require('../internals/a-set');
|
---|
| 3 | var add = require('../internals/set-helpers').add;
|
---|
| 4 | var clone = require('../internals/set-clone');
|
---|
| 5 | var getSetRecord = require('../internals/get-set-record');
|
---|
| 6 | var iterateSimple = require('../internals/iterate-simple');
|
---|
| 7 |
|
---|
| 8 | // `Set.prototype.union` method
|
---|
| 9 | // https://github.com/tc39/proposal-set-methods
|
---|
| 10 | module.exports = function union(other) {
|
---|
| 11 | var O = aSet(this);
|
---|
| 12 | var keysIter = getSetRecord(other).getIterator();
|
---|
| 13 | var result = clone(O);
|
---|
| 14 | iterateSimple(keysIter, function (it) {
|
---|
| 15 | add(result, it);
|
---|
| 16 | });
|
---|
| 17 | return result;
|
---|
| 18 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.