Async functions for CoffeeScript: map, reduce, and more


setTimeout and setInterval reversed, so it is easier to call from CoffeeScript.

I created a node module only for that? Yes, and a GitHub repository, too! I version my code snippets so I don't have to copy & paste them in all my projects.

{puts} = require 'sys'
{async,delay,repeat} = require 'ragtime'
# this is setTimeout(function(){ puts(42);}, 5000);
delay 5000, -> puts 42
# this is setTimeout(function(){ puts(42);}, 1);
async -> puts 42
# this is setInterval(function(){ puts(42);}, 1);
repeat 2000, -> puts 42