disposablestack
An ESnext spec-compliant DisposableStack
and Symbol.dispose
shim/polyfill/replacement that works as far down as ES3.
Its root auto
entrypoint also provides SuppressedError
, via the suppressed-error
package.
In the future, this package will also provide AsyncDisposableStack
and Symbol.asyncDispose
, or whichever forms end up in stage 3.
This package implements the es-shim API “multi” interface. It works in an ES3-supported environment and complies with the proposed spec.
Getting started
npm install --save disposable-stack
Usage/Examples
const assert = require('assert');
require('disposable-stack/auto');
assert.equal(typeof Symbol.dispose, 'symbol');
const error = new SuppressedError();
assert.ok(error instanceof Error);
const stack = new DisposableStack();
stack.dispose();
Tests
Clone the repo, npm install
, and run npm test