UNPKG
@r1tsu/payload
Version:
latest (3.0.0-beta.31)
3.0.0-beta.31
3.0.0-beta.28
3.0.0-beta.26
3.0.0-beta.25
3.0.0-beta.24
3.0.0-beta.23
3.0.0-beta.22
3.0.0-beta.21
3.0.0-beta.20
3.0.0-beta.15
3.0.0-beta.11
@r1tsu/payload
/
dist
/
utilities
/
getObjectDotNotation.js
7 lines
(6 loc)
•
282 B
JavaScript
View Raw
1
2
3
4
5
6
7
export
const
getObjectDotNotation
= (
obj, path, defaultValue
)=>{
if
(!path || !obj)
return
defaultValue;
const
result = path.
split
(
'.'
).
reduce
(
(
o, i
)=>
o?.[i], obj);
return
result ===
undefined
? defaultValue : result; };
//# sourceMappingURL=getObjectDotNotation.js.map