süß /zyːs/
adj
sweet, cute
noun
the sound iteration makes over pure functional pipes
npm install @betafcc/suss
Get an iterator/generator/iterable:
// Generate all Natural numbers
function* naturals() {
for (let i = 0; true; i+=1)
yield i;
}
Use the Fluent API:
import {suss} from '@betafcc/suss';
// Log all even squares
suss(naturals())
.map(x => x*x)
.filter(x => x % 2 === 0)
.forEach(el => console.log(el));
Use the flow/pipe API:
import { flow,
map, filter, forEach } from '@betafcc/suss';
// Log all even squares
flow(naturals())(
map(x => x*x),
filter(x => x % 2 === 0),
forEach(el => console.log(el)),
);