Skip to content
This repository was archived by the owner on Dec 12, 2018. It is now read-only.
This repository was archived by the owner on Dec 12, 2018. It is now read-only.

Documented method signature for next in collectionResource.detect and implementation do not match. #589

Description

@kirps

The docs indicate that the iterator in collectionResource.detect must call it's next argument with the signature next(err, test) .

https://docs.stormpath.com/nodejs/jsdoc/CollectionResource.html#detect__anchor

However, printing out the next function reveals that it only accepts one argument, see below

function (v) {
    if (cb && check(v)) {
        cb(getResult(true, x));
        cb = iterator = false;
    }
    callback();
}

Practically, it appears that the signature should be next(test) to get the described behavior.

For instance I was calling next(null, test) as I had no errors and that resulted in all resources being visited and null being passed as the foundResource argument of doneCallback

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions