question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Q.nfcall (and related) documentation is slightly confusing

See original GitHub issue

The documentation at https://github.com/kriskowal/q/wiki/API-Reference suggests that when using Q.nfcall (and friends) the resolved callback is called with a single real return value, while in reality it is an Array with the arguments of the node-style callback in-order (sans the error oc).

So this example snippet:

Q.nfcall(FS.readFile, "foo.txt", "utf-8").done(function (text) {

});

Could be better written like this:

Q.nfcall(FS.readFile, "foo.txt", "utf-8").done(function (args) {
    var text = args[0]
});

It is a small thing but got me confused for a minute.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kriskowalcommented, Mar 6, 2014

Users can never have too much information to make it easy to use your work. A responsible developer makes good code, documentation, and videos. Anything less is lazy.

True enough. Still, this is a free service we provide in our spare time. You should look at @domenic’s public contributions graph on his Github home page, or even mine. We appreciate your understanding.

I’ll be doing a presentation at Fluent next week. I did a presentation in Berlin in 2010. Domenic and Forebes Lindesay have done numerous good videos. We will take your advice and create an index of some of this ancillary documentation.

0reactions
kriskowalcommented, Mar 6, 2014

Ah, there it is. I remembered it but could not find it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Q documentation - DevDocs
The object itself is this in the function, just like a synchronous method call. promise.keys(). Returns a promise for an array of the...
Read more >
Node.js v19.3.0 Documentation
If the browser displays the string Hello, World! , that indicates the server is working. Assert#. Stability: 2 - Stable. Source Code: lib/assert.js....
Read more >
Six tips for cleaner javascript promises - Scott Logic Blog
This blog post shares a few quick tips and patterns that I've been using to structure JavaScript promises; keeping them clean, ...
Read more >
kriskowal/q: A promise library for JavaScript - GitHub
From XHR to database access to accessing the Flickr API, Q is there for you. There are many libraries that produce and consume...
Read more >
How to specify resolution and rejection type of the promise in ...
Even if they don't exist in Javascript, I found that JSdoc understands "generic types". So you can define your custom types and then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found