mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Add _.toPlainObject.
This commit is contained in:
committed by
jdalton
parent
d70b5a9886
commit
ae9ac3b439
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user