utils
Core Utilities for Sockbot
License: MIT
utils.logExtended(level, message, [data])
Write an extended log entry
Kind: static method of utils
Param | Type | Description |
---|---|---|
level | number |
Log Level |
message | string |
Log Message |
[data] | * |
Optional extended log data |
utils.cloneData(original) ⇒ *
Clone object
Kind: static method of utils
Returns: *
- Cloned original
data
Param | Type | Description |
---|---|---|
original | * |
Data to clone |
utils.mergeObjects([mergeArrays], ...mixin) ⇒ object
Merge multiple objects into one object
Later objects override earlier objects
Kind: static method of utils
Returns: object
- object constructed by merging mixin
s from left to right
Param | Type | Description |
---|---|---|
[mergeArrays] | boolean |
Merge arrays instead of concatenating them |
...mixin | object |
Objects to merge |
utils.mapGet(obj, [key]) ⇒ *
Get value from WeakMap store
Kind: static method of utils
Returns: *
- Stored value
Param | Type | Description |
---|---|---|
obj | * |
Object key for weakmap store |
[key] | string |
Object key to retrieve from stored value |
utils.mapSet(obj, key, [value])
Store values in weakmap store
If value
is omitted key
is stored instead
Kind: static method of utils
Param | Type | Description |
---|---|---|
obj | * |
Object key for weakmap store |
key | string | * |
Key to store value under or value object to store |
[value] | * |
Value to store for key |
utils.parseJSON(json) ⇒ object
Parse JSON data to object
Kind: static method of utils
Returns: object
- Parsed object
Param | Type | Description |
---|---|---|
json | string | object |
stringified object to parse |
utils~mergeInner(base, mixin, [mergeArrays])
Recursively merge objects
Kind: inner method of utils
Param | Type | Description |
---|---|---|
base | object |
Base object to merge mixin into |
mixin | object |
Mixin object to merge into base |
[mergeArrays] | boolean |
Merge arrays instead of concatenating them |
utils~mergeHelper(base, mixin, name, [mergeArrays])
Merge helper - FOR INTERNAL USE ONLY
Kind: inner method of utils
Param | Type | Description |
---|---|---|
base | object |
Base object to merge mixin into |
mixin | object |
Mixin object to merge into base |
name | string |
Name of property to merge |
[mergeArrays] | boolean |
Merge arrays instead of concatenating them |