- Source:
Methods
(inner) clone(obj) → {Object}
Returns a deep clone of obj
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | the object to clone |
- Source:
Returns:
- Type
- Object
(inner) defined(obj) → {boolean}
Returns true if obj is a defined value
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | the value to test |
- Source:
Returns:
- Type
- boolean
(inner) isObject(obj) → {boolean}
Returns true if obj is a non-null object
Checking for typeof 'object' without checking for nulls
is a very common source of bugs
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | the value to test |
- Source:
Returns:
- Type
- boolean
(inner) merge(defaults, overrides) → {Object}
Returns a new object combining the two parameters
Parameters:
Name | Type | Description |
---|---|---|
defaults |
Object | The base object |
overrides |
Object | The object to merge from. Where the same property exists in both defaults |
- Source:
Returns:
- Type
- Object
(inner) objFilter(obj, filter) → {Object}
Remove specific key and value from object
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | Object to filter |
filter |
Array | Object | String | keys to remove |
- Source:
Returns:
- Type
- Object
(inner) setDeep(obj, path, value) → {undefined}
Sets a value of nested key string descriptor inside a Object.
It changes the passed object.
Ex:
let obj = {a: {b:{c:'initial'}}}
setNestedKey(obj, ['a', 'b', 'c'], 'changed-value')
assert(obj === {a: {b:{c:'changed-value'}}})
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | Object to set the nested key |
path |
Array | An array to describe the path(Ex: ['a', 'b', 'c']) |
value |
Object | Any value |
- Source:
Returns:
from https://stackoverflow.com/a/49754647
- Type
- undefined
(inner) socketName(socket) → {string}
Returns the text used for logging purposes related to this socket
Parameters:
Name | Type | Description |
---|---|---|
socket |
Object | the socket |
- Source:
Returns:
- Type
- string