Miscellaneous utility methods for Node-RED node classes.
- Source:
Methods
(static) defaultIfEmpty(value, defaultValue)
Return a default value if the supplied value is "empty" -- undefined, null, a zero-length string, or a string containing only whitespace characters.
Parameters:
Name | Type | Description |
---|---|---|
value |
The value to check |
|
defaultValue |
The value to return if the value is "empty". |
- Source:
Returns:
Supplied value or defaultValue.
(static) extractProperty(obj, key)
Remove a property from an object and return the property's value.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | Object from which to extract a property. |
key |
String | Name of the key for the property to extract. |
- Source:
Returns:
The value for the property.
(static) isEmpty(value) → {boolean}
Return whether the supplied value is empty.
Parameters:
Name | Type | Description |
---|---|---|
value |
String | The value. |
- Source:
Returns:
true if the value is undefined, null, a zero-length string, or a string containing only whitespace characters. Otherwise, false.
- Type
- boolean
(static) removeProperties(obj, keys)
Remove properties from the supplied object.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | Object to remove properties from. |
keys |
Array.<String> | Names of the keys for the properties to remove. |
- Source: