Simplify _.set for plain keys.

This commit is contained in:
jdalton
2015-04-06 12:59:39 -06:00
parent c066e655dc
commit e0dc2daf54

View File

@@ -9964,13 +9964,7 @@
* // => 5
*/
function set(object, path, value) {
if (isKey(path, object)) {
if (isObject(object)) {
object[path] = value;
}
return object;
}
path = toPath(path);
path = isKey(path, object) ? [path] : toPath(path);
var index = -1,
length = path.length,