1 var assignValue = require(
'./_assignValue'),
2 castPath = require(
'./_castPath'),
3 isIndex = require(
'./_isIndex'),
4 isObject = require(
'./isObject'),
5 toKey = require(
'./_toKey');
17 function baseSet(
object, path, value, customizer) {
18 if (!isObject(
object)) {
21 path = castPath(path,
object);
25 lastIndex = length - 1,
28 while (nested != null && ++index < length) {
29 var key = toKey(path[index]),
32 if (index != lastIndex) {
33 var objValue = nested[key];
34 newValue = customizer ? customizer(objValue, key, nested) : undefined;
35 if (newValue === undefined) {
36 newValue = isObject(objValue)
38 : (isIndex(path[index + 1]) ? [] : {});
41 assignValue(nested, key, newValue);
47 module.exports = baseSet;