Identity transform - gives the current datapoint in sequence (or if given argument, a sub-object). Useful when performing comparisons ($ < 5)
The identity transform is a placeholder for the “current datapoint”. It returns whatever is passed from the stream.
Suppose your stream has the following data:
44,18,20,-35,20.23
The $ transform will simply return your data unchanged:
44,18,20,-35,20.23
The identity transform is perhaps the most used transform in all of pipescript.
It is frequently used in comparisons and if
filters.
For example, the transform $ > 20
is a comparison - it checks whether the current datapoint, represented by the identity is greater than 20. The result of this transform would be:
true,false,false,false,true
This is frequently used in filters: if $ > 20
would return
44,20.23
The $ transform accepts an optional argument. Sometimes, a datapoint isn’t just your data - it can be an object:
{"hi": "hello","foo":"bar"}, {"hi":"world","foo":"baz"}
Running this transform:
$("hi")
gives us:
"hello","world"
The $ transform is the main method for accessing sub-elements of a datapoint. It also works for array indices.
One-To-One | Stateless | Peek | Input Schema | Output Schema |
---|---|---|---|---|
True | True | False |
# | Description | Optional | Constant | Hijacked | Default |
---|---|---|---|---|---|
1 | The subobject to return. For use in json-object type data. | True | True | False |