So
The most straightforward co-routine library for Node.JS ever.
Provides predictable composable async/await
from C#5.0 style
co-routines for everyday use since you can live in a Harmony.
Inspired by @ForbesLindesay's great presentation: http://pag.forbeslindesay.co.uk/#/
and @visionmedia co
.
As of co-4.0
that was rewritten to use promises, so-1.0
can be compared with co.wrap
and represents its more light and strict version.
Platform Compatibility
When using node 0.11.x or greater, you must use the --harmony-generators
flag or just --harmony
to get access to generators.
When using node 0.10.x and lower or browsers without generator support, you must use gnode and/or regenerator.
Also as of so-1.0
you should ensure existence of Promise either by using --harmony
or any available polyfill.
Installation
$ npm install so
Usage
var so = ;var fs = ; var readJSON = ; var main = ; ;
or for CoffeeScript
so = require 'so'fs = require 'then-fs' readJSON = so JSONparse yield fsreadFile path'utf8' main = so -> a = yield readJSON 'a.json' b = yield readJSON 'b.json' consolelog ab maincatch consolelog estack ? emessage ? e