# jun-utils

> utils, public library

Latest version **2.0.0** (published 2026-10-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install jun-utils
pnpm add jun-utils
yarn add jun-utils
bun add jun-utils
```

## Health

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

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

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-10-08 |
| First published | 2018-10-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 538.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | 小巷 |
| Maintainers | xwjune |
| Keywords | jun, utils, check, validate, convert, float, tree, crypt, string, websocket |

## Links

- npm: https://www.npmjs.com/package/jun-utils
- Repository: https://github.com/xwjune/utils
- Homepage: https://github.com/xwjune/utils#readme
- Issues: https://github.com/xwjune/utils/issues
- npm.io page: https://npm.io/package/jun-utils

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2026-10-08
- 1.18.1 — 2026-09-09
- 1.18.0 — 2026-09-08
- 1.17.0 — 2026-09-07
- 1.16.0 — 2026-09-07
- 1.15.0 — 2020-11-24
- 1.14.2 — 2020-11-15
- 1.14.1 — 2020-11-15
- 1.14.0 — 2020-11-14
- 1.13.0 — 2020-10-13
- 1.12.0 — 2020-09-23
- 1.11.1 — 2020-08-19
- 1.11.0 — 2020-08-19
- 1.10.4 — 2020-06-23
- 1.10.3 — 2020-03-23
- … 31 more at https://npm.io/package/jun-utils/versions

## README

# jun-utils

前端通用工具函数库：校验、数据转换、浮点数运算、树结构操作等 9 个模块，提供 ES module 与 UMD 两种产物。

## Installation

Install with npm:

```bash
npm install --save-dev jun-utils
```

Install with yarn:

```bash
yarn add jun-utils --dev
```

## 浏览器支持

面向现代浏览器（Chrome 69+ / Safari 12+ / Firefox 62+ / Edge 79+，2018-09 起的全量版本），不支持 IE。

- `dist`【UMD】：`Number.isFinite` 等内建已由构建链内置 core-js@2 兜底
- `lib`【ESM】：不做 polyfill，需运行环境或消费方 polyfill 方案支持 ES2019 内建【如 `Array.prototype.flatMap`】

## Usage

ES6 module:

```JavaScript
import { check } from 'jun-utils'; // import check from 'jun-utils/lib/check';

// 手机号码校验
check.cellphone('13456789012'); // true
```

Script:

```html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>jun-utils</title>
  <script src="jun-utils.min.js"></script>
</head>
<body>
  <script type="text/javascript">
    junUtils.check.cellphone('13456789012'); // true
  </script>
</body>
</html>
```

## API

<!-- gen-docs:start -->
| 模块 | 说明 | 函数 |
| :--- | :--- | :--- |
| [appUtil](docs/api/appUtil.md) | app 交互 | 10 |
| [check](docs/api/check.md) | 校验库 | 19 |
| [common](docs/api/common.md) | 通用方法 | 3 |
| [convert](docs/api/convert.md) | 数据转换 | 9 |
| [cookie](docs/api/cookie.md) | cookie 操作 | 3 |
| [crypt](docs/api/crypt.md) | 加密解密【用于暴露在 url 中的重要参数】 | 2 |
| [dom](docs/api/dom.md) | DOM 视口与元素操作 | 9 |
| [event](docs/api/event.md) | 事件操作 | 4 |
| [floatUtil](docs/api/floatUtil.md) | 浮点数运算【解决精度问题】 | 4 |
| [stringUtil](docs/api/stringUtil.md) | 字符串处理 | 1 |
| [treeUtil](docs/api/treeUtil.md) | 树结构数据操作 | 3 |
| [ws](docs/api/ws.md) | webSocket【断线重连】 | 1 |
<!-- gen-docs:end -->

> 各函数的参数、返回值与示例见对应模块文档；安装后在 IDE 中悬停函数名可查看同样内容的 JSDoc。docs/api 与本索引表由源码 JSDoc 自动生成（`npm run docs:gen`），改函数请改 JSDoc，勿手改生成文件。

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