Sha256: 729f2cf99ea486229d2b940243e32ca17ccdad94e802bc77c40a353abd1374a1

Contents?: true

Size: 736 Bytes

Versions: 153

Compression:

Stored size: 736 Bytes

Contents

var baseCallback = require('./baseCallback'),
    baseForOwn = require('./baseForOwn');

/**
 * Creates a function for `_.mapKeys` or `_.mapValues`.
 *
 * @private
 * @param {boolean} [isMapKeys] Specify mapping keys instead of values.
 * @returns {Function} Returns the new map function.
 */
function createObjectMapper(isMapKeys) {
  return function(object, iteratee, thisArg) {
    var result = {};
    iteratee = baseCallback(iteratee, thisArg, 3);

    baseForOwn(object, function(value, key, object) {
      var mapped = iteratee(value, key, object);
      key = isMapKeys ? mapped : key;
      value = isMapKeys ? value : mapped;
      result[key] = value;
    });
    return result;
  };
}

module.exports = createObjectMapper;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createObjectMapper.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createObjectMapper.js