npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-idcard

v1.0.7

Published

身份证解析

Downloads

11

Readme

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: '男'
}