A lightweight JavaScript library for asynchronous flow control with a functional programming style.
Contra is a JavaScript library for asynchronous flow control that provides utilities like waterfall, concurrent execution, and functional iterators (map, each, filter). It solves the problem of managing async operations in a clean, functional style while keeping the library size minimal. It's particularly tailored for browser environments where small bundle sizes are crucial.
Frontend developers and Node.js developers who need a lightweight, focused alternative to larger async libraries like Async.js, especially those working in browser contexts where bundle size is a concern.
Developers choose Contra for its tiny footprint (~2.7k minified), consistent API using collections for all methods, and functional programming style. It offers a more focused and browser-optimized alternative to comprehensive libraries, reducing overhead while covering common async patterns.
:surfer: Asynchronous flow control with a functional taste to it
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
At ~2.7k minified, Contra is over 10x smaller than async (~29.6k), making it ideal for browser environments where download speed and performance are critical.
All functional methods like map, each, and filter work uniformly on both arrays and objects, unlike async which has inconsistent APIs for different data types.
Provides functional iterators and a curry function, encouraging a clean, composable approach to async operations without bloated dependencies.
λ.emitter adds event capabilities to objects with special error handling (throws if no error listeners), reducing the need for separate libraries in lightweight projects.
The README explicitly states it's not a replacement for async, missing utilities like auto and retry, which may require custom implementations or workarounds.
Relies on callbacks rather than promises, leading to less readable code compared to modern async/await and poor integration with promise-based ecosystems.
Supporting older browsers like IE < 10 requires an additional shim (~1.2k), partially negating the size benefits and adding setup complexity.