# proxy-disposable

> Make objects with a dispose method compatible with an ES6 disposable

Latest version **1.0.0** (published 2026-05-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install proxy-disposable
pnpm add proxy-disposable
yarn add proxy-disposable
bun add proxy-disposable
```

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2026-05-28 |
| First published | 2026-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Remco Haszing |
| Maintainers | remcohaszing |
| Keywords | disposable, dispose, monaco, monaco-editor, vscode |

## Links

- npm: https://www.npmjs.com/package/proxy-disposable
- Repository: https://github.com/remcohaszing/proxy-disposable
- Homepage: https://github.com/remcohaszing/proxy-disposable#readme
- Issues: https://github.com/remcohaszing/proxy-disposable/issues
- Funding: https://github.com/sponsors/remcohaszing
- npm.io page: https://npm.io/package/proxy-disposable

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2026-05-28

## README

# proxy-disposable

[![github actions](https://github.com/remcohaszing/proxy-disposable/actions/workflows/ci.yaml/badge.svg)](https://github.com/remcohaszing/proxy-disposable/actions/workflows/ci.yaml)
[![codecov](https://codecov.io/gh/remcohaszing/proxy-disposable/branch/main/graph/badge.svg)](https://codecov.io/gh/remcohaszing/proxy-disposable)
[![npm version](https://img.shields.io/npm/v/proxy-disposable)](https://www.npmjs.com/package/proxy-disposable)
[![npm downloads](https://img.shields.io/npm/dm/proxy-disposable)](https://www.npmjs.com/package/proxy-disposable)

Make objects with a `dispose` method compatible with an ES6
[disposable](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol/dispose).

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [API](#api)
  - [`d`](#d)
- [Why](#why)
- [Compatibility](#compatibility)
- [License](#license)

## Installation

```sh
npm install proxy-disposable
```

## Usage

Create an object with a `dispose` method. Then wrap it using the [`d`](#d) function. For example,
the following script:

```js
import { d } from 'proxy-disposable'

using disposable = d({
  name: 'object',

  dispose() {
    console.log('Disposed', this.name)
  }
})

disposable.name = 'disposable'
```

Yields:

```plaintext
Disposed disposable
```

## API

### `d`

Wrap an object with a `dispose` method as an ES6
[disposable](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol/dispose).

#### Arguments

- `disposable` (`Object`) — The disposable to wrap.

#### Returns

The input disposable as an ES6 disposable.

## Why

The `dispose` method is commonly used in various projects, such as
[language server](https://github.com/microsoft/vscode-languageserver-node) related projects and
[Monaco editor](https://microsoft.github.io/monaco-editor).

This package makes these nicer to work with in contexts where you want to quickly create an object,
and clean up afterwards. A typical use case is tests.

## Compatibility

This project is compatible with Node.js 22 or greater.

## License

[MIT](LICENSE.md) © [Remco Haszing](https://github.com/remcohaszing)

---
_Source: https://npm.io/package/proxy-disposable · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
