function invert(object, multiValue) {
      var index = -1,
          props = keys(object),
          length = props.length,
          result = {};

      while (++index < length) {
        var key = props[index],
            value = object[key];

        if (multiValue) {
          if (hasOwnProperty.call(result, value)) {
            result[value].push(key);
          } else {
            result[value] = [key];
          }
        }
        else {
          result[value] = key;
        }
      }
      return result;
    }
Creates an object composed of the inverted keys and values of the given
object. If the given object contains duplicate values, subsequent values
will overwrite property assignments of previous values unless `multiValue`
is `true`.

@static
@memberOf _
@category Objects
@param {Object} object The object to invert.
@param {boolean} [multiValue=false] Allow multiple values per key.
@returns {Object} Returns the created inverted object.
@example

_.invert({ 'first': 'fred', 'second': 'barney' });
// => { 'fred': 'first', 'barney': 'second' }

// without `multiValue`
_.invert({ 'first': 'fred', 'second': 'barney', 'third': 'fred' });
// => { 'fred': 'third', 'barney': 'second' }

// with `multiValue`
_.invert({ 'first': 'fred', 'second': 'barney', 'third': 'fred' }, true);
// => { 'fred': ['first', 'third'], 'barney': ['second'] }