mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Remove semicolons.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import assignValue from './assignValue.js';
|
||||
import castPath from './castPath.js';
|
||||
import isIndex from './isIndex.js';
|
||||
import isObject from '../isObject.js';
|
||||
import toKey from './toKey.js';
|
||||
import assignValue from './assignValue.js'
|
||||
import castPath from './castPath.js'
|
||||
import isIndex from './isIndex.js'
|
||||
import isObject from '../isObject.js'
|
||||
import toKey from './toKey.js'
|
||||
|
||||
/**
|
||||
* The base implementation of `set`.
|
||||
@@ -16,33 +16,33 @@ import toKey from './toKey.js';
|
||||
*/
|
||||
function baseSet(object, path, value, customizer) {
|
||||
if (!isObject(object)) {
|
||||
return object;
|
||||
return object
|
||||
}
|
||||
path = castPath(path, object);
|
||||
path = castPath(path, object)
|
||||
|
||||
const length = path.length;
|
||||
const lastIndex = length - 1;
|
||||
const length = path.length
|
||||
const lastIndex = length - 1
|
||||
|
||||
let index = -1;
|
||||
let nested = object;
|
||||
let index = -1
|
||||
let nested = object
|
||||
|
||||
while (nested != null && ++index < length) {
|
||||
const key = toKey(path[index]);
|
||||
let newValue = value;
|
||||
const key = toKey(path[index])
|
||||
let newValue = value
|
||||
|
||||
if (index != lastIndex) {
|
||||
const objValue = nested[key];
|
||||
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
||||
const objValue = nested[key]
|
||||
newValue = customizer ? customizer(objValue, key, nested) : undefined
|
||||
if (newValue === undefined) {
|
||||
newValue = isObject(objValue)
|
||||
? objValue
|
||||
: (isIndex(path[index + 1]) ? [] : {});
|
||||
: (isIndex(path[index + 1]) ? [] : {})
|
||||
}
|
||||
}
|
||||
assignValue(nested, key, newValue);
|
||||
nested = nested[key];
|
||||
assignValue(nested, key, newValue)
|
||||
nested = nested[key]
|
||||
}
|
||||
return object;
|
||||
return object
|
||||
}
|
||||
|
||||
export default baseSet;
|
||||
export default baseSet
|
||||
|
||||
Reference in New Issue
Block a user