パッケージの詳細

disposablestack

es-shims75.5kMIT1.1.7

An ESnext spec-compliant DisposableStack, AsyncDisposableStack, Symbol.dispose, and Symbol.asyncDispose shim/polyfill/replacement that works as far down as ES3.

javascript, ecmascript, polyfill, shim

readme

disposablestack Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

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.

Getting started

npm install --save disposablestack

Usage/Examples

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

Tests

Clone the repo, npm install, and run npm test

更新履歴

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.1.7 - 2024-12-12

Commits

  • [actions] split out node 10-20, and 20+ b0573d4
  • [Dev Deps] update @es-shims/api, auto-changelog, es-value-fixtures, is-registered-symbol, is-symbol, object-inspect, tape c93a7ea
  • [Deps] update call-bind, es-abstract, get-intrinsic, has-symbols 75a8306
  • [Refactor] use call-bound directly 6b4ce0d
  • [Dev Deps] update @es-shims/api 259c92f
  • [Tests] replace aud with npm audit 0e2d45a
  • [Dev Deps] add missing peer dep bb29720

v1.1.6 - 2024-05-28

Fixed

  • [Fix] .disposed should be nonenumerable #8

Commits

  • [Tests] Update nonFunctions adopt test 2f7eb6e
  • [Dev Deps] update @ljharb/eslint-config fa59c73

v1.1.5 - 2024-05-14

Fixed

  • [Deps] add missing call-bind #6
  • [readme] Fix documentation for AsyncDisposableStack #4

Commits

  • [Refactor] sync dispose used in an async dispose should reject, not throw f27d883
  • [Deps] update globalthis 4e6e8f4
  • [Deps] update es-abstract 525559f
  • [Dev Deps] update @es-shims/api 270fc1d
  • [Dev Deps] add missing has-property-descriptors 5d3ca89

v1.1.4 - 2024-03-22

Commits

  • [Refactor] uppercase spec enum values; check dispose records 6236229
  • [Refactor] update AOs to align with latest spec PR 3b1c01c
  • [Deps] update es-abstract, es-set-tostringtag, hasown 07297bb
  • [actions] remove redundant finisher 63a4ac3
  • [Deps] update es-abstract, es-errors, get-intrinsic, internal-slot aeed35b
  • [meta] add missing engines.node d2972ee
  • [Dev Deps] update tape ca6b77d
  • [Dev Deps] update hasown d9407f0

v1.1.3 - 2024-02-04

Commits

  • [Refactor] use es-errors where possible, so things that only need those do not need get-intrinsic 992e541
  • [Dev Deps] use hasown instead of has 07d41dc
  • [Dev Deps] update aud, has-tostringtag, npmignore, tape c7601cf
  • [Deps] update es-abstract, es-set-tostringtag, get-intrinsic, internal-slot ae1f344
  • [Tests] node v18.18 ships a broken Symbol.dispose as well 000c7aa
  • [Deps] update get-intrinsic, suppressed-error e088c32
  • [Dev Deps] update object-inspect, tape 745057e
  • [meta] add prepublish/prepublishOnly f8bd449

v1.1.2 - 2023-09-13

Fixed

  • [Deps] add missing globalthis dep #3

Commits

  • [Deps] update define-properties, suppressed-error 6322b16

v1.1.1 - 2023-07-24

Commits

  • [Deps] update es-abstract 4251c56
  • [Refactor] empty out DisposableStack slot on dispose 4d67178
  • [Tests] add some coverage 001e23c
  • [readme] fix package name 52002d1
  • [Tests] node v20.4 ships Symbol dispose polyfills that are registered symbols 37709d2
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, tape 4716a40
  • [Dev Deps] update tape 85c5033
  • [Deps] update get-intrinsic a3b63e2

v1.1.0 - 2023-04-12

Commits

v1.0.0 - 2023-02-17

Commits