私は動作するこのコードを持っています:
require! [async]
action = for let m from 1 to 12
(p) ->
p null, m
err, data <- async.series action
console.log data
しかし、ネストされたループでコードを機能させるのに苦労しています:
action = for let m from 1 to 12
for let d from 1 to 12
(p) ->
p null, (m + "-" + d)
err, data <- async.series action
console.log data
エラーメッセージ:
fn(function (err) {
^
TypeError: object is not a function
コメントで要求されたように、Livescript によって生成されたコンパイル済みの js コード:
var async, action, res$, i$;
async = require('async');
res$ = [];
for (i$ = 1; i$ <= 12; ++i$) {
res$.push((fn$.call(this, i$)));
}
action = res$;
async.series(action, function(err, data){
return console.log(data);
});
function fn$(m){
var i$, results$ = [];
for (i$ = 1; i$ <= 12; ++i$) {
results$.push((fn$.call(this, i$)));
}
return results$;
function fn$(d){
return function(p){
return p(null, m + "-" + d);
};
}
}