_.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
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' }
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .