Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q.ninvoke should handle a promise for an object that provides a Node method #134

Closed
andreas-karlsson opened this issue Nov 1, 2012 · 1 comment

Comments

@andreas-karlsson
Copy link

Might be me not grasping Q. But it's real confusing that you can't do

promise.ninvoke('hello','world')

Here's a full example:

"use strict"
var Q = require('q');

var log = console.log.bind(console);

function testObj(cb) {
    cb(null, {
        hello: function(name, cb) { 
            if(cb)
                cb(null, 'hello ' + name);
            else 
                return 'hello ' + name;
        }
    })
}

// following will throw in end, but using invoke instead of ninvoke makes it work
Q.ncall(testObj)
.ninvoke('hello', 'world') 
.then(log)
.end();
@kriskowal
Copy link
Owner

Looks like a legitimate case to me. We should add it to the test suite.

@domenic domenic closed this as completed in 73cc7ed Nov 4, 2012
domenic added a commit that referenced this issue Nov 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants