0.1.2 • Published 7 years ago

@betafcc/suss v0.1.2

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

TODO

  • Make a working starting point
  • Convert to bundled entry point
  • Add Tests
  • Convert to TypeScript
  • Release

süß/JS

süß   /zyːs/ adj sweet, cute noun the sound iteration makes over pure functional pipes

Install

npm install @betafcc/suss

Usage

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)),
);