An ESnext spec-compliant `DisposableStack`, `AsyncDisposableStack`, `Symbol.dispose`, and `Symbol.asyncDispose` shim/polyfill/replacement that works as far down as ES3.
38
stars
92
commits
JavaScript
primary language
Jul 30, 2026
updated
An ESnext spec-compliant DisposableStack, AsyncDisposableStack, Symbol.dispose, and Symbol.asyncDispose shim/polyfill/replacement that works as far down as ES3.
Its root auto entrypoint also provides SuppressedError, via the suppressed-error package.
This package implements the es-shim API “multi” interface. It works in an ES3-supported environment and complies with the proposed spec.
npm install --save disposablestack
const assert = require('assert');
require('disposablestack/auto');
assert.equal(typeof Symbol.dispose, 'symbol');
assert.equal(typeof Symbol.asyncDispose, 'symbol');
const error = new SuppressedError();
assert.ok(error instanceof Error);
const stack = new DisposableStack();
const asyncStack = new AsyncDisposableStack();
// examples of stack methods
stack.dispose();
await asyncStack.disposeAsync();
// assert disposal was done
Clone the repo, npm install, and run npm test
JavaScript
100.0%
An ESnext spec-compliant `DisposableStack`, `AsyncDisposableStack`, `Symbol.dispose`, and `Symbol.asyncDispose` shim/polyfill/replacement that works as far down as ES3.
38
stars
92
commits
JavaScript
primary language
Jul 30, 2026
updated
An ESnext spec-compliant DisposableStack, AsyncDisposableStack, Symbol.dispose, and Symbol.asyncDispose shim/polyfill/replacement that works as far down as ES3.
Its root auto entrypoint also provides SuppressedError, via the suppressed-error package.
This package implements the es-shim API “multi” interface. It works in an ES3-supported environment and complies with the proposed spec.
npm install --save disposablestack
const assert = require('assert');
require('disposablestack/auto');
assert.equal(typeof Symbol.dispose, 'symbol');
assert.equal(typeof Symbol.asyncDispose, 'symbol');
const error = new SuppressedError();
assert.ok(error instanceof Error);
const stack = new DisposableStack();
const asyncStack = new AsyncDisposableStack();
// examples of stack methods
stack.dispose();
await asyncStack.disposeAsync();
// assert disposal was done
Clone the repo, npm install, and run npm test
JavaScript
100.0%