UNPKG

disposablestack

Version:

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

16 lines (13 loc) 332 B
'use strict'; var define = require('define-properties'); var globalThis = require('globalthis')(); var getPolyfill = require('./polyfill'); module.exports = function shimDisposableStack() { var polyfill = getPolyfill(); define( globalThis, { DisposableStack: polyfill }, { DisposableStack: true } ); return polyfill; };