* 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)
| 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. |
no outgoing calls
no test coverage detected