@fekit/idcard
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@fekit/idcard

中国身份证号合法性校验,获取身份证详细信息(含一代及二代身份证)

安装

yarn add @fekit/idcard

npm i @fekit/idcard

引入

import idcard from '@fekit/idcard';

使用

const info: any = idcard(id) || {};

返回的数据结构

// 身份证合法返回的数据结构
{
    "gender": "女", //性别
    "birthday": "1967-1-11", // 出生日期
    "province": {  //省
        "code": "410000",
        "text": "河南省"
    },
    "city": {  // 市
        "code": "410400",
        "text": "平顶山市"
    },
    "area": { // 区县
        "code": "410421",
        "text": "宝丰县"
    },
    "adreass": "河南省平顶山市宝丰县", // 籍贯
    "cardText": "大陆",
    "age": 33,  // 年龄
    "zodiac": "鼠",  // 生肖
    "constellation": "射手座"  // 星座
}

// 身份证非法时返回的数据结构
false // 校验失败直接返回false

版本

1.0.0
校验身份证号合法性,并返回具体信息

Package Sidebar

Install

npm i @fekit/idcard

Weekly Downloads

9

Version

1.0.2

License

MIT

Unpacked Size

1.84 MB

Total Files

14

Last publish

Collaborators

  • liliguo
  • xiaojunbo