$

Represents the current datapoint. It is the identity transform.

The identity transform is a placeholder for the “current datapoint”. It returns whatever is passed from the timeseries.

Suppose your timeseries has the following data:

[44, 18, 20, -35, 20.23]

The $ transform will simply return your data unchanged:

[44, 18, 20, -35, 20.23]

Usage

The identity transform is perhaps the most used transform in all of pipescript. It is frequently used in comparisons and 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: filter $ > 20 would return

[44, 20.23]

Objects

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"]

Peeking

If given an integer index, the $ transform performs a peek operation - instead of returning the current datapoint, it returns the one at a relative index. For example, you can find the differences between the data of each successive datapoint with the following:

$[1] - $
[-26, 2, -55, 55.23]

Currently, you can only peek forward in the timeseries (i.e. look at future datapoints).


Transform Details

Input SchemaOutput Schema
{}
{}

Arguments

#DescriptionTypeSchemaDefault
1If it is given an integer, peeks to the relative index in array. If string, tries to get the object keyconst
{
 "oneOf": [
  {
   "type": "string"
  },
  {
   "type": "integer"
  }
 ]
}
0