MCPcopy
hub / github.com/stemkoski/stemkoski.github.com / invert

Function invert

MathBox/mathbox-bundle.js:37333–37344  ·  view source on GitHub ↗

* Creates an object composed of the inverted keys and values of the given object. * * @static * @memberOf _ * @category Objects * @param {Object} object The object to invert. * @returns {Object} Returns the created inverted object. * @example * * _.invert

(object)

Source from the content-addressed store, hash-verified

37331 * // => { 'fred': 'first', 'barney': 'second' }
37332 */
37333 function invert(object) {
37334 var index = -1,
37335 props = keys(object),
37336 length = props.length,
37337 result = {};
37338
37339 while (++index < length) {
37340 var key = props[index];
37341 result[object[key]] = key;
37342 }
37343 return result;
37344 }
37345
37346 /**
37347 * Checks if `value` is a boolean value.

Callers 3

mathbox-core.jsFile · 0.85
runInContextFunction · 0.85
mathbox-bundle.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected