UNPKG

539 BJavaScriptView Raw
1'use strict';
2var uncurryThis = require('../internals/function-uncurry-this');
3var iterateSimple = require('../internals/iterate-simple');
4var SetHelpers = require('../internals/set-helpers');
5
6var Set = SetHelpers.Set;
7var SetPrototype = SetHelpers.proto;
8var forEach = uncurryThis(SetPrototype.forEach);
9var keys = uncurryThis(SetPrototype.keys);
10var next = keys(new Set()).next;
11
12module.exports = function (set, fn, interruptible) {
13 return interruptible ? iterateSimple({ iterator: keys(set), next: next }, fn) : forEach(set, fn);
14};