0.2.3 • Published 2 years ago

tsducer v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

tsducer

npm GitHub Workflow Status

Example

import * as tsd from 'tsducer';

const xf = tsd.compose(
  tsd.filter((x: number) => x % 2 !== 0),
  tsd.map((x) => x * 2),
  tsd.map((x) => x.toString()),
  tsd.take(2)
);
const tTransform = tsd.transduce(xf, tsd.append, [] as string[]);
const iTransform = tsd.into([], xf);

tTransform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); // -> ['2', '6']
iTransform([], xf)([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) // -> ['2', '6']
[...tsd.sequence(xf, [1 ,2, 3, 4, 5, 6, 7, 8, 9, 10])] // -> ['2', '6']

References

https://clojure.org/reference/transducers

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.0.1

2 years ago