/node-dot-property

get/set/remove/has for any object using dot-notation path with reasonable defaults.

Primary LanguageJavaScriptMIT LicenseMIT

node-dot-property

get/set/remove/has for any object using dot-notation path with reasonable defaults.


Travis-CI Build Status Codecov branch Codacy Badge

Dev Dependencies

JavaScript Style Guide


"API"

set (obj, path, val)

Set val at path of obj. Will create last entry of path if it does not exist.


get (obj, path)

Get val at path of obj. Will return undefined for a nonexistent path.


has (obj, path)

Check if obj has a val at path. Will return false for a nonexistent path.


remove (obj, path)

Remove val at path of obj. 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.