Add _.toPlainObject.

This commit is contained in:
John-David Dalton
2015-01-14 22:47:00 -08:00
committed by jdalton
parent d70b5a9886
commit ae9ac3b439

View File

@@ -6606,6 +6606,21 @@
: arrayCopy(collection);
}
/**
* Converts `value` to a plain object.
*
* @static
* @memberOf _
* @category Collection
* @param {*} value The value to convert.
* @returns {Object} Returns the converted object.
*/
function toPlainObject(value) {
return (isArray(value) || isArguments(value) || isTypedArray(value))
? arrayToObject(value)
: baseCopy(value, keysIn(value));
}
/**
* Performs a deep comparison between each element in `collection` and the
* source object, returning an array of all elements that have equivalent
@@ -10624,6 +10639,7 @@
lodash.thru = thru;
lodash.times = times;
lodash.toArray = toArray;
lodash.toPlainObject = toPlainObject;
lodash.transform = transform;
lodash.union = union;
lodash.uniq = uniq;