dot-property
v0.0.1
Published
Easy dot-path get/set/remove/has for any object with reasonable defaults.
Downloads
2
Readme
node-dot-property
get/set/remove/has for any object using dot-notation path with reasonable defaults.
"API"
set (obj, path, val)
Set
val
atpath
ofobj
. Will create last entry of path if it does not exist.
get (obj, path)
Get
val
atpath
ofobj
. Will return undefined for a nonexistent path.
has (obj, path)
Check if
obj
has aval
atpath
. Will return false for a nonexistent path.
remove (obj, path)
Remove
val
atpath
ofobj
. Will do nothing for a nonexistent path.
obj
is the Object
, path
is the dot-notation path to a property, and val
is the value to set for the property.