Registry / migration / promise-bridge

promise-bridge

JSON →
library0.1.0jsnpmunverified

Native Promise migration helpers for JavaScript and TypeScript, intended as a drop-in replacement for the deprecated Q library. Version 0.1.0 provides deferreds, denodeify, nfcall, fcall, timeout, delay, allSettled, and other Q-compatible utilities without recreating Q's full promise subclass or progress-notification model. The package ships TypeScript declarations, has zero runtime dependencies, and requires Node >=18. It is designed to ease migration from Q to native promises while keeping the exact API signatures that teams still need. Released in 2025, it offers a stable alternative to Q with no affiliation to the original maintainers.

npm install promise-bridge
INSTALL
IMPORT
SIG · PROMISE-BRIDGE
P
promise-bridge
migrationjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

defer
import { defer } from 'promise-bridge'
import { defer } from 'q'
ESM only; no CommonJS support.
denodeify
import { denodeify } from 'promise-bridge'
const denodeify = require('promise-bridge').denodeify
Package is ESM-only; require() will fail.
nfcall
import { nfcall } from 'promise-bridge'
import nfcall from 'promise-bridge'
Named export, not default.

Basic usage of defer, denodeify, nfcall, and timeout to migrate from Q to native promises.

import { defer, denodeify, nfcall, timeout } from 'promise-bridge'; import fs from 'fs'; const deferred = defer<string>(); deferred.resolve('ready'); const readFile = denodeify(fs.readFile); const text = await timeout(readFile('README.md', 'utf8'), 1000); const callbackApi = (arg, cb) => cb(null, arg); const value = await nfcall(callbackApi, 'input'); console.log(value);
Debug
Known issues
deprecatedQ library is deprecated; this package is a migration helper.
fix
Use native Promises where possible; use promise-bridge as a transitional step.
affects: >=0.0.1
breakingPackage is ESM-only; CommonJS require() will throw a MODULE_NOT_FOUND error.
fix
Use import syntax and set { "type": "module" } in package.json, or use dynamic import().
affects: >=0.1.0
gotchaUnlike Q, promise-bridge does not implement progress notifications or a full thenable subclass. Using Q's Q.progress() pattern will fail.
fix
Migrate progress callbacks to standard Promise patterns or remove them.
affects: >=0.1.0
gotchaThe spread() helper uses array destructuring, not Q's exact argument-passing behavior.
fix
Ensure spread is called with an array of resolved values; adjust callback signatures.
affects: >=0.1.0
Errors
Common errors & fixes
Cannot find module 'promise-bridge' or its corresponding type declarations.
Project is not ESM or missing tsconfig moduleResolution settings.
fix
Enable ESM (type: module in package.json) and set moduleResolution to "node16" or "bundler" in tsconfig.json.
Uncaught Error: not a promise
Passed a non-thenable to timeout() or when().
fix
Wrap the value in Promise.resolve() before passing to promise-bridge utilities.
TypeError: deferred.resolve is not a function
Incorrect import: using default import instead of named import.
fix
Use import { defer } from 'promise-bridge' and call defer() to create the deferred object.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
promise-bridge — npm install promise-bridge · libregistry