Skip to content

Problem with forEach if iterator-function is prototype-function and uses "this" #176

@jochenonline

Description

@jochenonline

I am having problems using forEach if the iterator-function (2nd argument) is a prototype-function of an obejct and uses "this" within its function-body.

Concrete: I am trying to use forEach with "client.add" of node-solr (https://github.com/gsf/node-solr/blob/master/lib/solr.js - line 77).

When I use the following code:

async.forEachSeries( doc_arr, client.add, function(err) {
    if( err ) { 
         throw err; 
    }
});

I get: 'this' has no function 'update'. Which is in line 109 of the mentioned solr.js.

What can I do?

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