object-keys
Syntax
- object-keys
Description
The object-keys operation takes an object value and emits an array of its keys. If the incoming value is an
array, the operation emits an array of its numeric indexes ([0, 1, 2, ...]). For any other value type (numbers,
strings, null), the value is passed through unchanged.
This operation is most useful for extracting the list of property names from a structured value, so that the names can be further processed by operations like map or reject.
Examples
- AdapterScript
var1:
- source: sensor-readings
- object-keys
info
In the above example, sensor-readings is an identifier from another part of the adapter script that produces an
object like { temp: 72.4, pressure: 101.3, humidity: 45 }. The variable var1 will emit ['temp', 'pressure', 'humidity'].