Skip to content

Unexpected results in CoffeeScript #10

@akidee

Description

@akidee

This is generated code from CoffeeScript that runs in node 0.4.5 and with latest asyncjs. I use the "=>" operator, that prefixes a function's body and preserves the current context (this):

var async;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
async = require('asyncjs');
async.list([1, 2, 3]).forEach(__bind(function(name, next) {
  return next(null, name);
}, this)).toArray(false, function(e, f) {
  return console.log(f);
});

Result:

[ 1, 2, 3 ]
[ 1, 2, 3, 3 ]
[ 1, 2, 3, 3, 2 ]
[ 1, 2, 3, 3, 2, 1 ]

Instead of:

[ 1, 2, 3 ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions