Q.nfcall (and related) documentation is slightly confusing
See original GitHub issueThe 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:
- Created 10 years ago
- Comments:13 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Ah, there it is. I remembered it but could not find it.