# @baiwusanyu/utils-is

> ## Function

Latest version **1.1.2** (published 2024-12-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @baiwusanyu/utils-is
pnpm add @baiwusanyu/utils-is
yarn add @baiwusanyu/utils-is
bun add @baiwusanyu/utils-is
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2024-12-12 |
| First published | 2023-05-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | baiwusanyu-c |
| Maintainers | baiwusanyu |
| Keywords | typescript, javascript, utils, vue, vue3, vite, react |

## Links

- npm: https://www.npmjs.com/package/@baiwusanyu/utils-is
- Repository: https://github.com/baiwusanyu-c/bwsy-utils
- Homepage: https://github.com/baiwusanyu-c
- Issues: https://github.com/baiwusanyu-c/bwsy-utils/issues
- npm.io page: https://npm.io/package/@baiwusanyu/utils-is

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2024-12-12
- 1.1.1 — 2024-12-12
- 1.1.0 — 2024-12-12
- 1.0.18 — 2023-12-28
- 1.0.17 — 2023-12-28
- 1.0.16 — 2023-09-02
- 1.0.15 — 2023-08-15
- 1.0.14 — 2023-07-08
- 1.0.13 — 2023-05-25
- 1.0.12 — 2023-05-10
- 1.0.11 — 2023-05-08
- 1.0.10 — 2023-05-08
- 1.0.9 — 2023-05-07
- 1.0.8 — 2023-05-04
- 1.0.5 — 2023-05-03

## README

# @baiwusanyu/utils-is

## Function

### isEmptyObj

判断是否为空对象

| 参数     | 参数类型    | 默认值     | 说明       |
|--------|------------|---------|----------|
| val    | `unknown`  | `-`     | 待判断变量    |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isBool

判定布尔

| 参数     | 参数类型                            | 默认值     | 说明       |
|--------|---------------------------------|---------|----------|
| val    | `unknown`                       | `-`     | 待判断变量    |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isString

判定字符串

| 参数     | 参数类型                            | 默认值     | 说明       |
|--------|---------------------------------|---------|----------|
| val    | `unknown`                       | `-`     | 待判断变量    |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isNumber

判定数字

| 参数     | 参数类型                            | 默认值     | 说明       |
|--------|---------------------------------|---------|----------|
| val    | `unknown`                       | `-`     | 待判断变量    |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isFunction

判定是否是方法

| 参数     | 参数类型                            | 默认值     | 说明       |
|--------|---------------------------------|---------|----------|
| val    | `unknown`                       | `-`     | 待判断变量    |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isObject

判定是否是对象

| 参数     | 参数类型                            | 默认值     | 说明       |
|--------|---------------------------------|---------|----------|
| val    | `unknown`                       | `-`     | 待判断变量    |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isArray

判定是否是数组

| 参数     | 参数类型                          | 默认值              | 说明    |
|--------|-------------------------------|------------------|-------|
| val    | `unknown`                     | `-`              | 待判断变量 |
| val    | `null / undefined / Function` | `Array.isArray`  | 判断函数  |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isNumberStr

判断是否由纯数字组成(不支持前导 `0` 与科学计数法)

| 参数     | 参数类型                          | 默认值              | 说明    |
|--------|-------------------------------|------------------|-------|
| str    | `string`                      | `-`              | 待判断变量 |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isHttp

判断 `url` 是否是 `http` 或 `https`

| 参数     | 参数类型                          | 默认值              | 说明    |
|--------|-------------------------------|------------------|-------|
| url    | `string`                      | `-`              | 待判断变量 |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isValidURL

判断 `url` 是否是有效的 `url`

| 参数     | 参数类型                          | 默认值              | 说明    |
|--------|-------------------------------|------------------|-------|
| url    | `string`                      | `-`              | 待判断变量 |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isLowerCase

判断字符串是否为纯小写

| 参数  | 参数类型                          | 默认值              | 说明    |
|-----|-------------------------------|------------------|-------|
| str | `string`                      | `-`              | 待判断变量 |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isUpperCase

判断字符串是否为纯大写

| 参数  | 参数类型                          | 默认值              | 说明    |
|-----|-------------------------------|------------------|-------|
| str | `string`                      | `-`              | 待判断变量 |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isEmail

判断是否为有效的 `Email`

| 参数    | 参数类型                          | 默认值              | 说明    |
|-------|-------------------------------|------------------|-------|
| email | `string`                      | `-`              | 待判断变量 |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isMobileCN

判断是否为中國手機號

| 参数  | 参数类型                          | 默认值              | 说明    |
|-----|-------------------------------|------------------|-------|
| num | `string`                      | `-`              | 待判断变量 |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

### isRegex

判断是否为正则表达式

| 参数  | 参数类型      | 默认值              | 说明    |
|-----|-----------|------------------|-------|
| value | `unknown` | `-`              | 待判断变量 |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |


### isElement

判断是否为 dom 元素

| 参数  | 参数类型      | 默认值              | 说明    |
|-----|-----------|------------------|-------|
| value | `unknown` | `-`              | 待判断变量 |

| 返回值 | 返回类型      | 说明   |
|-----|-----------|------|
| res | `Boolean` | 判断结果 |

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