@hamgom95/objtools
Object helper methods.
API Documentation
Functions
- setDefault(key, defaultValue) ⇒
-
Get value for key in object or set default.
- getPath(...levels) ⇒
-
Get value at path in object.
- setPath(value, ...levels) ⇒
-
Set value at path in object.
- register(cls) ⇒
-
Register object methods to cls.
setDefault(key, defaultValue) ⇒
Get value for key in object or set default.
Kind: global function
Returns: Value for property in object.
Param | Description |
---|---|
key | Key in object. |
defaultValue | Default value to set if property not found. |
getPath(...levels) ⇒
Get value at path in object.
Kind: global function
Returns: Value at path.
Param | Description |
---|---|
...levels | Path in object. |
setPath(value, ...levels) ⇒
Set value at path in object.
Kind: global function
Returns: Set value at path.
Param | Description |
---|---|
value | Value to set at path. |
...levels | Path in object. |
register(cls) ⇒
Register object methods to cls.
Kind: global function
Returns: Mixed in class.
Param | Description |
---|---|
cls | Class to add methods to. |