Methods
(static) getValByKeyPath(obj, path, defaultVal) → {*}
get strict object's value by path
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | strict object (json-like) |
path |
string | the key path like `a.b.c`, if the path is an empty string, return obj itself |
defaultVal |
* | if the path exists and the value is undefined, will return defaultVal |
- Source:
Returns:
return value/defaultVal, but if the path is not exists, return null
- Type
- *
(static) setValByKeyPath(obj, path, defaultVal) → {void|null}
set strict object's value by path
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | strict object (json-like) |
path |
string | the key path like `a.b.c` |
defaultVal |
* | if the path exists and the value is undefined, will return defaultVal |
- Source:
Returns:
return null if the partial path (not whole path) is not found
- Type
- void | null
(inner) if isConcatFn is true, concat function if isConcatArr is true, concat array(target, source, opts) → {any}
mixin strict object
Parameters:
Name | Type | Description |
---|---|---|
target |
object | |
source |
object | |
opts |
object | { isConcatFn, isConcatArr } |
- Source:
Returns:
return the target
- Type
- any