<commit_before>node-green-light --- A simple stop and go interface to node-fibers
==================================================================

<img src="http://farm6.static.flickr.com/5123/5213858605_b819267488_m.jpg"> (cc by-nc-nd) http://www.flickr.com/photos/mcdemoura/

This wrapper to [node-fibers](https://github.com/laverdet/node-fibers) aims to
ease calling existing asynchronous code from a synchronous context. A
greenlight fiber gets two functions, red and green.  The first is for pausing
the other for resumes. Call them anyway you like red/green, pause/resume,
stop/go etc..

Calling an asynchronous function is as simple as handing it the green function
as callback and calling the red function yourself to wait for green to be
called.  Red returns either one of the arguments passed to green, all arguments
as array or a table with the arguments (see below).

Since the call to the asynchronous function is almost standard, its this
pointer is unaffected too. Red and green must always be called in pairs,
red-green or green-red.  In some cases some asynchronous function might call
its callback before returning, so in that case a call to green before red is<commit_msg>attribution<commit_after>node-green-light --- A simple stop and go interface to node-fibers
==================================================================

<img src="http://farm6.static.flickr.com/5123/5213858605_b819267488_m.jpg"><span style="font-size:-1;">image: (cc by-nc-nd) http://www.flickr.com/photos/mcdemoura/</span>

This wrapper to [node-fibers](https://github.com/laverdet/node-fibers) aims to
ease calling existing asynchronous code from a synchronous context. A
greenlight fiber gets two functions, red and green.  The first is for pausing
the other for resumes. Call them anyway you like red/green, pause/resume,
stop/go etc..

Calling an asynchronous function is as simple as handing it the green function
as callback and calling the red function yourself to wait for green to be
called.  Red returns either one of the arguments passed to green, all arguments
as array or a table with the arguments (see below).

Since the call to the asynchronous function is almost standard, its this
pointer is unaffected too. Red and green must always be called in pairs,
red-green or green-red.  In some cases some asynchronous function might call
its callback before returning, so in that case a call to green before red is
{'fraction_non_alphanumeric': 0.11742892459826947, 'fraction_numerical': 0.02018953440461475, 'mean_word_length': 4.739952718676123, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7671198', 'n_tokens_mistral': 692, 'n_tokens_neox': 625, 'n_words': 314}