4.17.11
3.10.1
2.4.2
1.3.1

_.invert(object)

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.

Since

0.7.0

Arguments

argument
object
type
Object
description
The object to invert.

Returns

(array)

Example

var object = { a: 1, b: 2, c: 1 };

_.invert(object);
// => { '1': 'c', '2': 'b' }
var object = { a: 1, b: 2, c: 1 };

_.invert(object);
// => { '1': 'c', '2': 'b' }