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 * // => 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,