asyncawait  by yortus

JS library for async/await implementation pre-ES2017

created 11 years ago
1,905 stars

Top 23.4% on sourcepulse

GitHubView on GitHub
Project Summary

This library provides a way to write asynchronous Node.js code using an async/await syntax, similar to C#, for developers struggling with callback hell or maintaining older codebases. It offers a cleaner, more synchronous-looking approach to asynchronous operations without requiring ES6 generators or code preprocessing.

How It Works

The library leverages node-fibers to implement coroutines, allowing functions to suspend execution at await calls without blocking the Node.js event loop. This enables the use of standard JavaScript control flow structures (like for and while loops) and try/catch blocks for managing asynchronous operations, making code more readable and maintainable.

Quick Start & Requirements

  • Install via npm: npm install asyncawait
  • Requires Node.js.
  • Official documentation and examples are available in the repository.

Highlighted Details

  • Eliminates callback spaghetti code and enables synchronous-style control flow.
  • Seamlessly interoperates with popular libraries like Express, Mocha, and Bluebird.
  • Written in TypeScript with embedded type declarations.
  • Supports various result-handling mechanisms (promises, callbacks, thunks, direct results).

Maintenance & Community

The project was last updated in June 2018. While it enabled async/await functionality early on, native JavaScript async/await (ES2017) is now widely supported in Node.js. The README advises users to consider migrating to native async/await unless maintaining older codebases or requiring deep coroutine features.

Licensing & Compatibility

The software is provided under a permissive MIT license, allowing for commercial use and integration into closed-source projects.

Limitations & Caveats

The library is strictly limited to Node.js environments due to its reliance on node-fibers and does not support browser environments. Given the widespread adoption of native async/await in modern Node.js versions, its relevance may be diminished for new projects.

Health Check
Last commit

3 years ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
1 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.