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.
17 lines
606 B
17 lines
606 B
4 weeks ago
|
'use strict';
|
||
|
var uncurryThis = require('../internals/function-uncurry-this');
|
||
|
var iterateSimple = require('../internals/iterate-simple');
|
||
|
var MapHelpers = require('../internals/map-helpers');
|
||
|
|
||
|
var Map = MapHelpers.Map;
|
||
|
var MapPrototype = MapHelpers.proto;
|
||
|
var forEach = uncurryThis(MapPrototype.forEach);
|
||
|
var entries = uncurryThis(MapPrototype.entries);
|
||
|
var next = entries(new Map()).next;
|
||
|
|
||
|
module.exports = function (map, fn, interruptible) {
|
||
|
return interruptible ? iterateSimple({ iterator: entries(map), next: next }, function (entry) {
|
||
|
return fn(entry[1], entry[0]);
|
||
|
}) : forEach(map, fn);
|
||
|
};
|