npm.commands.ls throws #2681

Closed
prabhakhar opened this Issue Aug 7, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@prabhakhar

Usage:

npm.load({}, function() {
            npm.commands.ls({}, true, function(e, data) {});
});

This used to work. :-)

But, the recent change at (https://github.com/isaacs/npm/blob/master/lib/ls.js#L26) breaks this, as {} doesnt have map method.

Trace:

else args = args.map(function (a) {
                   ^
TypeError: Object #<Object> has no method 'map'
    at EventEmitter.ls (/Users/blackbird/911/node_modules/npm/lib/ls.js:28:20)
    at Object.keys.concat.forEach.Object.defineProperty.get.commandCache.(anonymous function) (/Users/blackbird/911/node_modules/npm/lib/npm.js:182:11)
    at EventEmitter.<anonymous> (/Users/blackbird/911/npm-test.js:3:16)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
@prabhakhar

This comment has been minimized.

Show comment Hide comment
@prabhakhar

prabhakhar Aug 7, 2012

I workaround this by passing [] instead of an empty object {}. Logged an issue, so that we will have a chance to fix.

I workaround this by passing [] instead of an empty object {}. Logged an issue, so that we will have a chance to fix.

@isaacs

This comment has been minimized.

Show comment Hide comment
@isaacs

isaacs Aug 7, 2012

Owner

Args should always be an array, never anything other than an array. This was only working by accident before.

Owner

isaacs commented Aug 7, 2012

Args should always be an array, never anything other than an array. This was only working by accident before.

@isaacs isaacs closed this Aug 7, 2012

@prabhakhar

This comment has been minimized.

Show comment Hide comment
@prabhakhar

prabhakhar Aug 7, 2012

Thank you for the reply. I got you.

But, may be this doc page needs this info. https://npmjs.org/api/ls.html

Thank you for the reply. I got you.

But, may be this doc page needs this info. https://npmjs.org/api/ls.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment