# apipost-tools

> apipost-tools

Latest version **0.0.41** (published 2025-06-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install apipost-tools
pnpm add apipost-tools
yarn add apipost-tools
bun add apipost-tools
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.41 |
| Published | 2025-06-30 |
| First published | 2022-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 22 |
| Unpacked size | 595.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lee-meng, proud_lion, xbw19975, wjzhangq, apipost-lab001, chengyang12138 |
| Keywords | tools, utils, apipost-tools |

## Links

- npm: https://www.npmjs.com/package/apipost-tools
- npm.io page: https://npm.io/package/apipost-tools

## Dependencies (22)

- [pako](https://npm.io/package/pako.md) ^2.0.4
- [json5](https://npm.io/package/json5.md) ^2.2.1
- [tslib](https://npm.io/package/tslib.md) ^2.5.0
- [buffer](https://npm.io/package/buffer.md) ^6.0.3
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [rollup](https://npm.io/package/rollup.md) ^2.56.2
- [core-js](https://npm.io/package/core-js.md) ^3.9.0
- [ts-jest](https://npm.io/package/ts-jest.md) ^29.1.0
- [typescript](https://npm.io/package/typescript.md) ^4.3.5
- [json-bigint](https://npm.io/package/json-bigint.md) ^1.0.0
- [comment-json](https://npm.io/package/comment-json.md) ^4.2.5
- [jsonc-parser](https://npm.io/package/jsonc-parser.md) ^3.3.1
- [html-beautify](https://npm.io/package/html-beautify.md) ^1.0.4
- [@xmldom/xmldom](https://npm.io/package/@xmldom/xmldom.md) ^0.8.10
- [rollup-plugin-dts](https://npm.io/package/rollup-plugin-dts.md) ^3.0.2
- [rollup-plugin-terser](https://npm.io/package/rollup-plugin-terser.md) ^7.0.2
- [@rollup/plugin-terser](https://npm.io/package/@rollup/plugin-terser.md) ^0.4.1
- [rollup-plugin-postcss](https://npm.io/package/rollup-plugin-postcss.md) ^4.0.1
- [@rollup/plugin-commonjs](https://npm.io/package/@rollup/plugin-commonjs.md) ^20.0.0
- [@rollup/plugin-typescript](https://npm.io/package/@rollup/plugin-typescript.md) ^8.2.5
- [@rollup/plugin-node-resolve](https://npm.io/package/@rollup/plugin-node-resolve.md) ^13.0.4
- [rollup-plugin-peer-deps-external](https://npm.io/package/rollup-plugin-peer-deps-external.md) ^2.2.4

## Recent versions

- 0.0.41 (latest) — 2025-06-30
- 0.0.40 — 2025-06-18
- 0.0.39 — 2025-06-16
- 0.0.38 — 2025-03-03
- 0.0.37 — 2025-01-21
- 0.0.36 — 2025-01-07
- 0.0.35 — 2024-07-08
- 0.0.34 — 2024-02-02
- 0.0.33 — 2024-01-16
- 0.0.32 — 2024-01-16
- 0.0.31 — 2024-01-15
- 0.0.30 — 2024-01-13
- 0.0.29 — 2023-10-17
- 0.0.28 — 2023-08-08
- 0.0.25 — 2023-08-07
- … 23 more at https://npm.io/package/apipost-tools/versions

## README

<p align="center">
  <a href="https://adesign.apipost.cn/" target="_blank">
    <img alt="A-Design Logo" width="360" src="https://img.cdn.apipost.cn/cdn/opensource/apipost-opensource.svg" />
  </a>
</p>

apipost-tools 是一个一致性、模块化、高性能的 JavaScript 实用工具库。

# 安装

```shell
npm i apipost-tools
```

# 基础使用
需引入：

```js
import ATools from 'apipost-tools';
let json='{"name":"我是一名ApiPost用户"}';
let email='1030698842@qq.com';

ATools.isJson(json); //true
ATools.isEmail(email); //true

目前支持:
array2Tree //扁平数据转树状结构
beautifyRaw // 美化数据，目前支持object,xml,html,jsonp,javascript. 返回结果为对象。包含mode（类型），value（美化后的结果）
formatXml //格式化xml数据
getUrlQuery //获取url中的query数据（对象）。
getUrlQueryArray //获取url中的query数据（数组）。
isEmail //验证邮箱格式
isXml // 验证是否为xml格式
isJson //验证是否为json格式
isJson5 //验证是否为json5格式
isJsonp //验证是否为jsonp格式
isHtml //验证是否为html格式
ms2second //毫秒时间戳转秒时间戳
formatHtml // 格式化html数据
jsonp2Obj // jsonp格式转为对象
errorResult // 统一失败结果对象
successResult // 统一成功结果对象
bufferToRaw // buffer转raw
completionHttpProtocol // 补齐http协议开头
NewURL // 根据url生成url对象
setObjValByPath // 根据对象路径给对象赋值，例如a.b.c  没有的属性会默认补上对象。
```


# 开源协议

apipost-tools 遵循 [MIT 协议](https://github.com/Apipost-Team/apipost-tools)。

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