npm

seque

1.2.1 • Public • Published

Stories in Ready Build Status Test Coverage Code Climate npm version bower version Dev Status

Sauce Test Status

seque

chainable control flow methods for javascript

what?

let arr = [1, 2, 3, 4, 5, 6];
let useEvens = Math.random() > .5;
arr
  .if(useEvens)
  .filter(x => x % 2 == 0)
  .else()
  .filter(x => x % 2)
  .endif()
  // at this point we have either [2,4,6] or [1,3,5] depending on the value
  // of useEvens

see also: https://skeate.github.io/2015/07/17/Seque-What-It-Is-and-How-It-Works.html

why?

why not

the catch

unless your platform supports proxies (check compatibility with kangax's compat-table) this won't work completely seamlessly. if a link in a chain returns an object with a method not on the link in the chain right before a seque method, and you then try to call that method, things'll break, unless you deliberately specify that method's name in the seque method call.

Package Sidebar

Install

npm i seque

Weekly Downloads

10

Version

1.2.1

License

MIT

Last publish

Collaborators

  • skeate