# @lijuhong1981/jsdestroy

> Object destroy mechanism with deep release.

Latest version **1.2.7** (published 2026-09-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install @lijuhong1981/jsdestroy
pnpm add @lijuhong1981/jsdestroy
yarn add @lijuhong1981/jsdestroy
bun add @lijuhong1981/jsdestroy
```

## Health

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

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.2.7 |
| Published | 2026-09-24 |
| First published | 2022-09-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | lijuhong1981 |
| Maintainers | lijuhong1981_pci |

## Links

- npm: https://www.npmjs.com/package/@lijuhong1981/jsdestroy
- Repository: https://github.com/lijuhong1981/jslibs
- Homepage: https://github.com/lijuhong1981/jslibs#readme
- Issues: https://github.com/lijuhong1981/jslibs/issues
- npm.io page: https://npm.io/package/@lijuhong1981/jsdestroy

## Recent versions

- 1.2.7 (latest) — 2026-09-24
- 1.2.6 — 2026-04-01
- 1.2.5 — 2025-08-11
- 1.2.4 — 2025-07-24
- 1.2.3 — 2025-07-24
- 1.2.2 — 2025-07-24
- 1.2.1 — 2025-04-14
- 1.2.0 — 2025-04-14
- 1.1.19 — 2024-07-31
- 1.1.18 — 2024-07-31
- 1.1.17 — 2024-07-30
- 1.1.16 — 2024-07-30
- 1.1.15 — 2024-07-30
- 1.1.14 — 2024-06-11
- 1.1.13 — 2024-06-05
- … 23 more at https://npm.io/package/@lijuhong1981/jsdestroy/versions

## README

# @lijuhong1981/jsdestroy

> 对象销毁机制，提供 `Destroyable` 基类和 `destroyObject` 深度释放函数，支持销毁数组、DOM 元素与嵌套对象。

## 安装

```bash
npm install @lijuhong1981/jsdestroy
```

## 导出

- `Destroyable` — 可继承的销毁基类（含 `destroy`/`isDestroyed`/`onDestroy`/`destroyConfigure`）
- `destroyObject(object, config)` — 销毁对象下所有属性与方法
- `destroyHTMLElement(element, deep)` — 销毁 DOM 元素
- `defineDestroyProperties(target, destroyFunc)` — 为目标对象或原型定义 `destroy` 相关属性
- `isDestroyed(object)` — 判断对象是否已销毁

### 销毁配置（`config`）

| 项 | 默认 | 说明 |
| --- | --- | --- |
| `deleteProperty` | `true` | 是否删除对象属性 |
| `ignoreProperties` | `[]` | 需忽略的属性数组 |
| `ignoreUnderlinePrefixProperty` | `false` | 是否忽略下划线前缀属性 |
| `overwriteFunction` | `true` | 是否覆盖对象方法 |
| `releaseArray` | `true` | 是否清空数组内容（`length = 0`） |
| `destroyHTMLElement` | `true` | 是否销毁 HTMLElement |
| `deep` | `false` | 是否向下执行深度销毁 |

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