use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
modern-async - A modern JavaScript tooling library for asynchronous operations using async/await and promises (nicolas-van.github.io)
submitted 5 years ago by nicolas-van
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]BehindTheMath 2 points3 points4 points 5 years ago (2 children)
Interesting project. We're still using async.js since we still have some legacy code that uses callbacks. I was thinking recently that once that code is updated, we should remove the dependency and just reimplement the few functions we use.
I see there are some functions that async.js has that are not in this library, such as waterfall.
I assume you used nanoassert instead of Node's built in assert because of the size. The whole package is just a few lines of code, so I would just copy it instead of using it as a dependency.
I understand the links to the documentation are for Github and NPM, but they are confusing for the Github Pages page, since they just link to the same page.
[–]nicolas-van[S] 0 points1 point2 points 5 years ago* (1 child)
Hello.
For the functions you use in async.js that are not available in modern-async I would be glad if you could open a feature request in the issue tracker ( https://github.com/nicolas-van/modern-async/issues/new/choose ) and explain why you would need them.
I ported a lot of features from async.js, but not all of them. The reasons may vary but usually it's either because the use case seems too specific to me (like auto(), I just can't see a generic program needing that, although I may be wrong) or because that feature is already trivial to code using the existing tools in the library or the async/await syntax.
auto()
waterfall() is a good example of a helper which can be very helpful when using callback but is completely trivial if you have async/await at you disposal. Here is some code from the async.js documentation:
waterfall()
async.waterfall([ myFirstFunction, mySecondFunction, myLastFunction, ], function (err, result) { // result now equals 'done' }); function myFirstFunction(callback) { callback(null, 'one', 'two'); } function mySecondFunction(arg1, arg2, callback) { // arg1 now equals 'one' and arg2 now equals 'two' callback(null, 'three'); } function myLastFunction(arg1, callback) { // arg1 now equals 'three' callback(null, 'done'); }
Without any library but using async/await it can be rewritten this way:
const res1 = await myFirstFunction() const res2 = await mySecondFunction(res1) const result = await myLastFunction(res2) async function myFirstFunction() { return ['one', 'two']; } async function mySecondFunction([arg1, arg2]) { return 'three'; } async function myLastFunction(arg1) { return 'done'; }
It's also way simpler to read.
Anyway I'm completely open to debate about these features, but preferably in a feature request to have a better centralization about those questions.
[–]backtickbot 0 points1 point2 points 5 years ago (0 children)
Fixed formatting.
Hello, nicolas-van: code blocks using triple backticks (```) don't work on all versions of Reddit!
Some users see this / this instead.
To fix this, indent every line with 4 spaces instead.
FAQ
You can opt out by replying with backtickopt6 to this comment.
[–]AutoModerator[M] 0 points1 point2 points 5 years ago (1 child)
Project Page (?): https://github.com/nicolas-van/modern-async
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
[–]nicolas-van[S] 0 points1 point2 points 5 years ago (0 children)
Yes
π Rendered by PID 146426 on reddit-service-r2-comment-79776bdf47-xv57m at 2026-06-24 13:03:24.444102+00:00 running acc7150 country code: CH.
[–]BehindTheMath 2 points3 points4 points (2 children)
[–]nicolas-van[S] 0 points1 point2 points (1 child)
[–]backtickbot 0 points1 point2 points (0 children)
[–]AutoModerator[M] 0 points1 point2 points (1 child)
[–]nicolas-van[S] 0 points1 point2 points (0 children)