Current File : //home/tradevaly/www/node_modules/collect.js/src/methods/map.js
'use strict';

module.exports = function map(fn) {
  if (Array.isArray(this.items)) {
    return new this.constructor(this.items.map(fn));
  }

  const collection = {};

  Object.keys(this.items).forEach((key) => {
    collection[key] = fn(this.items[key], key);
  });

  return new this.constructor(collection);
};