GithubHelp home page GithubHelp logo

davidmr001 / idcard Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nobey/idcard

0.0 1.0 0.0 136 KB

node-js-身份证-信息-生肖-星座-性别-地址-户籍-验证

License: MIT License

JavaScript 100.00%

idcard's Introduction

IdCard - 身份证的工具库


本来是不想重新造轮子的可是找了找github上的仓库,看了看感觉都有bug而且很别扭,所以还是自己开刀搞,说说跟别的库有什么不同吧

  • 对地区数据上不准备直接用网上的一些数据因为那些数据在计算到县和区的时候会漏掉市级的一些数据所以准备先对数据进行二次处理在引入

安装

npm install js-idcard

使用

var IdCard = require('js-idcard')

方法列表


IdCard.EndNum(IdCard)

返回根据前17位数算出来的第18位

参数说明
  • @param {String} IdCard 身份证号码
返回数据

{Number}


IdCard.birthDay(IdCard)

返回计算出来的星期几,星座,生肖

参数说明
  • @param {String} IdCard 身份证号码
返回数据
{
  date: '2014/2/2',
  nong: '2013/3/3',
  year: 2001,
  month: 01,
  day: 01,
  week: '星期一', // 星期几
  zodiac: '天秤座',  // 星座
  zodiac_zh: '龙'  // 生肖
}

IdCard.checkIdCard(IdCard)

返回验证身份证号是否正确

参数说明
  • @param {String} IdCard 身份证号码
返回数据

{Boolean}


IdCard.repairIdCard(IdCard)

返回补全身份证号

参数说明
  • @param {String} IdCard 身份证号码 18位活着残缺的17位
返回数据

{Number}


IdCard.num15to18(IdCard)

返回15位转换18位后的身份证号码

参数说明
  • @param {String} IdCard 身份证号码 15位
返回数据

{Number}


IdCard.sex(IdCard)

返回性别 男或女

参数说明
  • @param {String} IdCard 身份证号码
返回数据

{String}男或女


IdCard.nong(date)

返回性别 农历日期

参数说明
  • @param {String} date 日期 2016/01/01
返回数据

{String}农历日期


IdCard.address(IdCard)

返回 地址信息

参数说明
  • @param {String} IdCard 身份证号码
返回数据
{
  "address": "地址",
  "provinces": "省/直辖市",
  "citiy": "",
  "areas": "县/区",
  "all": "省-市-县"
}

IdCard.all(IdCard)

返回 全部解析的数据

参数说明
  • @param {String} IdCard 身份证号码
返回数据
{
  endNum: 6,
  birthDay: {
    date: '2014/2/2',
    nong: '2013/3/3',
    year: '1985',
    month: '01',
    week: '星期天',
    zodiac: '水瓶座',
    zodiac_zh: '牛'
  },
  checkIdCard: true,
  address: {
    address: '北京市平谷县',
    provinces: '北京市',
    citiy: '无',
    areas: '平谷县',
    all: '北京市--平谷县'
  },
  sex: '男'
}

idcard's People

Contributors

labikyo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.