mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Simplify _.set for plain keys.
This commit is contained in:
@@ -9964,13 +9964,7 @@
|
|||||||
* // => 5
|
* // => 5
|
||||||
*/
|
*/
|
||||||
function set(object, path, value) {
|
function set(object, path, value) {
|
||||||
if (isKey(path, object)) {
|
path = isKey(path, object) ? [path] : toPath(path);
|
||||||
if (isObject(object)) {
|
|
||||||
object[path] = value;
|
|
||||||
}
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
path = toPath(path);
|
|
||||||
|
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = path.length,
|
length = path.length,
|
||||||
|
|||||||
Reference in New Issue
Block a user