# uxcore-validator

> uxcore-validator component for uxcore.

Latest version **0.2.7** (published 2019-04-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install uxcore-validator
pnpm add uxcore-validator
yarn add uxcore-validator
bun add uxcore-validator
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.7 |
| Published | 2019-04-19 |
| First published | 2015-09-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | eternalsky |
| Maintainers | appian, eternalsky, ex90rts, jianfei, surfacew, taoqili |
| Keywords | react, react-component, uxcore-validator, Validator |

## Links

- npm: https://www.npmjs.com/package/uxcore-validator
- Repository: https://github.com/uxcore/uxcore-validator
- Homepage: https://github.com/uxcore/uxcore-validator#readme
- Issues: http://github.com/uxcore/uxcore-validator/issues
- npm.io page: https://npm.io/package/uxcore-validator

## Dependencies (2)

- [prop-types](https://npm.io/package/prop-types.md) 15.x
- [object-assign](https://npm.io/package/object-assign.md) ^4.0.0

## 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

- 0.2.7 (latest) — 2019-04-19
- 0.2.6 — 2018-11-23
- 0.2.4 — 2018-02-24
- 0.2.3 — 2018-01-17
- 0.2.2 — 2017-10-19
- 0.2.0 — 2016-05-09
- 0.1.4 — 2016-03-23
- 0.1.3 — 2016-03-06
- 0.1.2 — 2016-01-21
- 0.1.1 — 2015-12-01
- 0.1.0 — 2015-09-22

## README

---

## uxcore-validator

[![Test Coverage](https://img.shields.io/coveralls/uxcore/uxcore-validator.svg?style=flat-square)](https://coveralls.io/r/uxcore/uxcore-validator?branch=master)
[![Dependency Status](http://img.shields.io/david/uxcore/uxcore-validator.svg?style=flat-square)](https://david-dm.org/uxcore/uxcore-validator)
[![devDependency Status](http://img.shields.io/david/dev/uxcore/uxcore-validator.svg?style=flat-square)](https://david-dm.org/uxcore/uxcore-validator#info=devDependencies)

## TL;DR

base validators used in uxcore-form & uxcore-grid

#### setup develop environment

```sh
$ git clone https://github.com/uxcore/uxcore-validator
$ cd uxcore-validator
$ npm install
$ gulp server
```

> 提供了一些通用的 validator
>
> 所有的 validator 返回 true，表示通过。

* isNotEmpty: 空对象、空数组、空字符串都被理解为空。
* isNum: 判断是否为数字，注意这里的数字包括字符串和数值两种数据类型。
* isInt: 是否是整数
* isDecimal: 是否是小数
* isArray
* isRegExp
* isObject
* isFunc
* isEmail
* isUrl: 只做 host 部分的检测，这只是一个非常基础的检测，通过你需要搭配非法字符一同进行。
* isHex
* isIdCard: 是否是中国身份证。
* isCNMobile: 是否是中国手机号。


## Usage

```
var validator = require("uxcore-validator");
console.log(validator.isNum(1));
// return true
console.log(validator.isNum("1"));
// return true
console.log(validator.isNum("a"));
// return false
```

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