# @art-suite/art-core-ts-types 中文文档

规范地址：https://npmcn.com/package/%40art-suite/art-core-ts-types/

版本：0\.4\.1
npm 元数据更新时间：2026-06-19T10:21:35.400Z
中文译文更新时间：2026-11-06T20:37:28.609Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40art-suite/art-core-ts-types
原文对照：https://npmcn.com/package/%40art-suite/art-core-ts-types/?lang=original
项目主页：https://github.com/art-suite/art-suite-ts#readme
源码仓库：https://github.com/art-suite/art-suite-ts

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：30.2 kB，9 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- 首次发布：2025-05-12T08:58:41.163Z
- 最新版本发布：2026-06-19T10:21:35.281Z
- 近 30 天下载量：3234（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：23（近 12 个月 5 个）

## 中文简介

TypeScript 字符串工具库

## 安装

```sh
npm install @art-suite/art-core-ts-types
```

也可以使用：`pnpm add @art-suite/art-core-ts-types`、`yarn add @art-suite/art-core-ts-types`、`bun add @art-suite/art-core-ts-types`

## README

# @ art- suite/ art- core- ts- 类型

用于运行时间识别JavaScript类型的简单而一致的库.

## 为什么是这个模块?

**为什么:** JavaScript的型号系统在运行时有出名的不一致. 开发者往往与许多不同的,有时是不可靠的方法来检查一个值是否是一个字符串,数组,日期,或者其他类型——引导到错误,混淆,以及重复代码.

**如何解释:** 该图书馆通过提供一套高性能、经过良好测试的检查,统一类型检查并使之标准化 `isFoo` 函数。 每个函数都执行最可靠和最有效的策略来识别各自的类型,将JavaScript的夸克抽象出.

**何谓:** 一整套 `isFoo` 函数( 如 `isString`, (中文(简体) ), `isDate`, (中文(简体) ), `isPlainObject`),用于稳健,可读,并一致的运行时间类型检查.

## 安装和使用示例( 需要)

用 npm 安装 :

```sh
npm install @art-suite/art-core-ts-types
```

基本用途:

```ts
import {
  isString,
  isPlainObject,
  isDate,
  isNull,
  isNotNull,
  isNullish,
  isNotNullish,
  exists,
  present,
} from "@art-suite/art-core-ts-types";

isString("hello"); // true
isPlainObject({ a: 1 }); // true
isDate(new Date()); // true
isDate("2020-01-01"); // false
isNull(null); // true
isNotNull(undefined); // false
isNullish(undefined); // true
isNotNullish(0); // true
exists(0); // true
present(""); // false
present("something"); // true
```

## 职能概览

### 类型检查函数

-   **初级:**
    
    -   `isString(value)` ——检查字符串值.
    -   `isNumber(value)` - 检查数字.
    -   `isBoolean(value)` - 检查布尔斯.
    -   `isFunction(value)` ——检查功能.
-   **对象和收藏 :**
    
    -   `isObject(value)` ——检查任何对象(不包括无效的,原始的,和函数).
    -   `isPlainObject(value)` ——检查平面对象(即:, `{}`) (中文(简体) ).
    -   `isArray(value)` - 检查数组.
    -   `isArrayBuffer(value)` ——检查等距缓冲实例.
    -   `isTypedArray(value)` 检查任意打入的箭头.
-   **特殊类型 :**
    
    -   `isDate(value)` 检查日期对象.
    -   `isRegExp(value)` ——检查正则表达式.
    -   `isError(value)` ——检查出错对象.
    -   `isPromise(value)` 检查类似承诺的对象.
-   **其他公用事业:**
    
    -   `isEmptyObject(value)` ——检查对象是否有自身属性.
    -   `isNonNegativeInt(value)` ——检查非负整数.
    -   `stringIsPresent(value)` ——检查非空,非白空字符串.
-   **Null/未定义/Exists 公用事业:**
    
    -   `isNull(value)` - 检查 `null` 或者说 `undefined` 数值.
    -   `isNotNull(value)` ——检查非值 `null` 或者说 `undefined`。 。 。 .
    -   `isNullish(value)` - 检查 `null` 或者说 `undefined` (别名: `isNull`) (中文(简体) ).
    -   `isNotNullish(value)` ——检查非值 `null` 或者说 `undefined` (别名: `isNotNull`) (中文(简体) ).
    -   `exists(value)` ——检查非无,非定义值.
    -   `present(value)` ——检查存在的值(非无效,非定义,非空字符串,或自定义的现值).

## API 文档参考

关于所有被输出功能及其参数的详细信息,请参见源代码内的TypeScript打字和JSDoc评论.

## 常见问题

### @art-suite/art-core-ts-types 是什么？

TypeScript 字符串工具库

### 如何安装 @art-suite/art-core-ts-types？

在项目目录运行 npm install @art-suite/art-core-ts-types，或使用 pnpm add / yarn add / bun add。

### @art-suite/art-core-ts-types 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @art-suite/art-core-ts-types 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @art-suite/art-core-ts-types 可以商用吗？

@art-suite/art-core-ts-types 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @art-suite/art-core-ts-types 的下载量有多少？

根据 npm 官方下载统计，@art-suite/art-core-ts-types 在 2026/10/07 – 2026/11/05 这 30 天内被下载 3,234 次，日均约 108 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @art-suite/art-core-ts-types 还在维护吗？

最新版本 0\.4\.1 发布于 2026/06/19（4 个月前）；至今共发布 23 个版本，其中过去 12 个月发布了 5 个；首次发布于 2025/05/12。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

