explaingit

kriskowal/q

Analysis updated 2026-06-24 · repo last pushed 2023-11-08

15,037JavaScriptAudience · developerComplexity · 2/5DormantSetup · easy

TLDR

Q is a legacy JavaScript promise library that helped shape the native Promise API, the maintainers now recommend using built-in promises instead.

Mindmap

mindmap
  root((q))
    Inputs
      Callbacks
      Async tasks
    Outputs
      Promise chains
      Errors via catch
    Use Cases
      Maintain legacy code
      Learn promise history
      Interop with jQuery Deferred
    Tech Stack
      JavaScript
      Node
      Browser
      AMD
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Maintain an older codebase that still depends on Q for promise chains

USE CASE 2

Migrate jQuery Deferred code over to a promise-based style

USE CASE 3

Study how early promise libraries shaped the modern native Promise API

What is it built with?

JavaScriptNode.js

How does it compare?

kriskowal/qpaperjs/paper.jsjosdejong/mathjs
Stars15,03715,03315,028
LanguageJavaScriptJavaScriptJavaScript
Last pushed2023-11-082024-07-232026-05-12
MaintenanceDormantStaleMaintained
Setup difficultyeasymoderateeasy
Complexity2/53/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Project is no longer actively developed, the README itself recommends using native Promises in new code.

In plain English

Q is a JavaScript library that adds promises to the language. A promise is a placeholder object for a value that is not ready yet, for example the result of a network request or a file read. Instead of passing a callback function that gets called later when the work finishes, code asks for a promise and chains follow-up steps onto it. Q was one of the early libraries that brought this pattern to JavaScript and helped shape the design that browsers and Node.js later adopted as the built-in Promise type. The maintainers open the README with a clear note: most projects today should use the native Promise that every modern browser and Node version already provides. Native promises are faster and have better tooling. Q itself is no longer being actively developed. The code is still there, bugs will still be fixed, but new work has been unnecessary for years. The README frames the project as a piece of internet history more than as a current dependency. The main argument the README makes for promises in general is that they replace deeply nested callback code, which the author calls the Pyramid of Doom, with a flat chain. A series of asynchronous steps can be written as one Q.fcall followed by several .then calls, with a single .catch at the end. Errors thrown in any step flow straight to the catch handler, the way exceptions do in normal synchronous code with try and catch. The README also explains that returning a promise from inside a then handler causes the outer promise to wait for that inner one, which is how delays, combinations, and error recovery are built. Q can be loaded in several ways: as a plain script tag that adds a Q global, as a CommonJS module through the npm package q, as an AMD module, as a component, through Bower, or through NuGet. The minified gzipped script is about 2.5 kilobytes. Q can also exchange promises with other libraries from that era, including jQuery, Dojo, When.js, and WinJS. The rest of the README is a tutorial covering the then method, propagation rules, and the fail and fin shorthands. Links from the project wiki point to a full API reference, an examples gallery, a list of libraries that work with Q, and a guide for migrating from jQuery Deferred objects. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
Rewrite a Q.fcall then chain in modern async/await using the native Promise
Prompt 2
Migrate this jQuery Deferred code to Q promises following the README migration guide
Prompt 3
Replace Q.defer in this legacy module with the equivalent native Promise pattern
Prompt 4
Show me how Q handles error propagation through then and catch with one runnable example

Frequently asked questions

What is q?

Q is a legacy JavaScript promise library that helped shape the native Promise API, the maintainers now recommend using built-in promises instead.

What language is q written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js.

Is q actively maintained?

Dormant — no commits in 2+ years (last push 2023-11-08).

How hard is q to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is q for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.