Sha256: 8fb9d43290025ff2ed2c6bec15bbe70d908644b4ca954fecec1299295a3dc957

Contents?: true

Size: 1.1 KB

Versions: 213

Compression:

Stored size: 1.1 KB

Contents

var constant = require('./constant'),
    createInverter = require('./_createInverter'),
    identity = require('./identity');

/** Used for built-in method references. */
var objectProto = Object.prototype;

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */
var nativeObjectToString = objectProto.toString;

/**
 * Creates an object composed of the inverted keys and values of `object`.
 * If `object` contains duplicate values, subsequent values overwrite
 * property assignments of previous values.
 *
 * @static
 * @memberOf _
 * @since 0.7.0
 * @category Object
 * @param {Object} object The object to invert.
 * @returns {Object} Returns the new inverted object.
 * @example
 *
 * var object = { 'a': 1, 'b': 2, 'c': 1 };
 *
 * _.invert(object);
 * // => { '1': 'c', '2': 'b' }
 */
var invert = createInverter(function(result, value, key) {
  if (value != null &&
      typeof value.toString != 'function') {
    value = nativeObjectToString.call(value);
  }

  result[value] = key;
}, constant(identity));

module.exports = invert;

Version data entries

213 entries across 212 versions & 23 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/lodash/invert.js
immosquare-cleaner-0.1.59 node_modules/lodash/invert.js
immosquare-cleaner-0.1.58 node_modules/lodash/invert.js
immosquare-cleaner-0.1.57 node_modules/lodash/invert.js
immosquare-cleaner-0.1.56 node_modules/lodash/invert.js
immosquare-cleaner-0.1.55 node_modules/lodash/invert.js
immosquare-cleaner-0.1.54 node_modules/lodash/invert.js
immosquare-cleaner-0.1.53 node_modules/lodash/invert.js
immosquare-cleaner-0.1.52 node_modules/lodash/invert.js
trusty-cms-6.3.1 node_modules/lodash/invert.js
immosquare-cleaner-0.1.51 node_modules/lodash/invert.js
boring_generators-0.15.0 tmp/templates/app_template/node_modules/lodash/invert.js
clapton-0.0.26 lib/clapton/javascripts/node_modules/lodash/invert.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/lodash/invert.js
immosquare-cleaner-0.1.50 node_modules/lodash/invert.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/lodash/invert.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/lodash/invert.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/lodash/invert.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/lodash/invert.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/lodash/invert.js