timestream-filters
Filter functions for sequential objectMode data, e.g. timeseries data.
var spigot = var concat = var filters = { return } /*[ { v: 150, foo: 1150 }, { v: 250, foo: 1250 }, { v: 500, foo: 1500 } ] */ /*[ { v: 250, foo: 1250 }, { v: 500, foo: 1500 }, { v: 550, foo: 1550 } ] */ /*[ { v: 50, foo: 150 }, { v: 100, foo: 1100 }, { v: 150, foo: 1150 } ] */ { return recordfoo / 50 % 2 == 0} /*[ { v: 100, foo: 1100 }, { v: 500, foo: 1500 } ] */
API
timestream-filters
provides four filtering transforms for ordered objectMode streams.
- range
- rtrim
- ltrim
- scrub
- filter
range(seqKey, start, end)
Only forward records where the sequence key seqKey
is between start
and end
inclusively to downstream.
rtrim(n)
Trim the stream to n
records from the right, e.g. the latest n
records.
ltrim(n)
Trim the stream to n
records from the left, e.g. the first n
records.
scrub()
Remove any records that are "empty", that is they have no data beyond the timestamp.
filter(fn)
Generically filter the stream. Provide a function fn(record)
that returns true to keep the record for false to discard it.
LICENSE
MIT