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
419 B

var addMapEntry = require('./_addMapEntry'),
arrayReduce = require('./_arrayReduce'),
mapToArray = require('./_mapToArray');
/**
* Creates a clone of `map`.
*
* @private
* @param {Object} map The map to clone.
* @returns {Object} Returns the cloned map.
*/
function cloneMap(map) {
var Ctor = map.constructor;
return arrayReduce(mapToArray(map), addMapEntry, new Ctor);
}
module.exports = cloneMap;