# cn-idno-validator

> 大陆第二代身份证ID校验器

Latest version **1.0.0** (published 2021-03-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install cn-idno-validator
pnpm add cn-idno-validator
yarn add cn-idno-validator
bun add cn-idno-validator
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-03-27 |
| First published | 2021-03-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Funky Fang |
| Maintainers | funkyfang |
| Keywords | 身份证校验 |

## Links

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

## Recent versions

- 1.0.0 (latest) — 2021-03-27

## README

# cn-idno-validator 中国第二代身份证校验器

🇨🇳 中国第二代身份证校验器，依照国家标准 [GB 11643-1999](http://www.gb688.cn/bzgk/gb/newGbInfo?hcno=080D6FBF2BB468F9007657F26D60013E)

## 使用

install:
```
npm install cn-idno-validator
```

CommonJS:
```js
const validator = require('cn-idno-validator');

const rs = validator.isValid('xxxxxxxxxxxxxxxxxx');
```

ES Module:
```js
import { isValid } from 'cn-idno-validator';

const rs = isValid('xxxxxxxxxxxxxxxxxx');
```

CDN:
```html
<script src="pathto/dist/index.umd.jd"></script>
<script>
    var rs = CnIdNoValidator.isValid('xxxxxxxxxxxxxxxxxx');
</script>
```

## 注意

只支持18位第二代身份证，目前只做宽松校验，第二代身份证第 18 是前 17 位数字计算得出的校验码，此规则可以校验大多数输入性错误，可用于用户输入时的规则校验，但不可用作身份证真实性校验依据。

- 第 18 位按标准计算校验
- 地区只校验了省级行政区，地级市行政区数据可能会
- 出生年份下限为 1850，无上限
- 出生日期未按具体月份校验（TODO），月份为 1\~12，日期为 1\~31

## License

MIT

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