# tj/co

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/tj-co).**

11,856 stars · 782 forks · JavaScript · MIT

## Links

- GitHub: https://github.com/tj/co
- awesome-repositories: https://awesome-repositories.com/repository/tj-co.md

## Description

co is a JavaScript generator control flow library and non-blocking workflow engine. It manages asynchronous logic by using generators and promises to simulate a synchronous coding style.

The project transforms generator functions into standard functions that return promises, ensuring compatibility with non-generator interfaces. It also functions as a promise-based asynchronous orchestrator that executes multiple operations concurrently through the recursive resolution of nested promise collections.

The library provides high-level primitives for asynchronous flow control and non-blocking workflow management in Node.js and the browser. This includes mechanisms for concurrent operation execution and generator-to-promise conversion.

## Tags

### Programming Languages & Runtimes

- [Generator-to-Promise Wrappers](https://awesome-repositories.com/f/programming-languages-runtimes/promise-based-flow-control/generator-to-promise-wrappers.md) — Transforms generator functions into standard functions that return promises for compatibility with non-generator interfaces.
- [Asynchronous Control Flow Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/asynchronous-control-flow-libraries.md) — Provides a comprehensive framework for managing non-blocking asynchronous logic using generators and promises.
- [Linear Asynchronous Syntax](https://awesome-repositories.com/f/programming-languages-runtimes/asynchronous-control-flow/linear-asynchronous-syntax.md) — Allows managing non-blocking operations using linear syntax instead of nested callback structures. ([source](https://github.com/tj/co#readme))
- [Asynchronous Flow Control](https://awesome-repositories.com/f/programming-languages-runtimes/asynchronous-flow-control.md) — Implements techniques for managing the execution order of asynchronous operations using generators.
- [Generator Execution Loops](https://awesome-repositories.com/f/programming-languages-runtimes/generator-execution-loops.md) — Provides a generator-based loop that drives asynchronous execution by resolving promises and resuming the function.
- [Parallel Promise Coordination](https://awesome-repositories.com/f/programming-languages-runtimes/parallel-promise-coordination.md) — Coordinates multiple asynchronous operations concurrently, waiting for all promises in a collection to resolve.
- [Generator-Based Flow Control](https://awesome-repositories.com/f/programming-languages-runtimes/promise-based-flow-control/generator-based-flow-control.md) — Uses generator functions and yield statements to manage asynchronous execution sequences.

### Software Engineering & Architecture

- [Non-Blocking Execution](https://awesome-repositories.com/f/software-engineering-architecture/client-server-architecture/long-running-task-protocols/non-blocking-execution.md) — Implements non-blocking execution patterns to manage complex sequences of asynchronous events without freezing the thread.
- [Non-Blocking Event Loops](https://awesome-repositories.com/f/software-engineering-architecture/non-blocking-event-loops.md) — Implements architectural patterns that leverage the event loop to manage concurrent operations without blocking the main thread.
- [Recursive Promise Distribution](https://awesome-repositories.com/f/software-engineering-architecture/task-scheduling/parallel-task-executors/parallel-task-spawning/recursive-parallel-distribution/recursive-promise-distribution.md) — Resolves nested arrays or objects of promises recursively to ensure complete parallel task execution.

### Development Tools & Productivity

- [Concurrent Task Execution](https://awesome-repositories.com/f/development-tools-productivity/concurrent-task-execution.md) — Executes multiple asynchronous operations simultaneously to improve throughput and minimize wait time. ([source](https://github.com/tj/co#readme))

### Networking & Communication

- [Recursive Promise Resolution](https://awesome-repositories.com/f/networking-communication/api-integration-frameworks/request-configurations/recursive-variable-resolution/recursive-promise-resolution.md) — Processes nested collections of promises recursively to enable complex parallel task execution.

### Web Development

- [Promise-Based State Resolution](https://awesome-repositories.com/f/web-development/asynchronous-state-managers/promise-based-state-resolution.md) — Integrates asynchronous promise resolution directly into the internal state management of the generator.

### Part of an Awesome List

- [Flow Control](https://awesome-repositories.com/f/awesome-lists/devtools/flow-control.md) — Generator-based flow control for Node.js.
- [Promise Utilities](https://awesome-repositories.com/f/awesome-lists/devtools/promise-utilities.md) — Generator-based control flow for asynchronous code.
