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

gome-id-card

v1.0.3

Published

this is gome id card

Downloads

6

Readme

gome-id-card

这是一个国美内部保险项目使用到的工具包

install

npm i gome-id-card --save

how to work

import {GomeIdCard} from "gome-id-card";

// 参数可有可不。都有默认值
const idcard = new GomeIdCard({
    idCardStr: "你的身份证号,默认随机",
    splitStr: "初始化 string 分隔符, 默认'-'"
    teenage: "低于该年龄为青少年,默认 18",
    older: "超出该年龄为老人,默认 60",
    mastOverDate: "危险期"
});

interface

interface GomeIdCard {
    static _parseIdCard;    // 静态解析器(可解析身份证信息)
    static makeIdCard;      // 静态身份证生成器 (可随机生成身份证【用于测试】)
    static isIdCardValid(idCardStr);   // 静态身份证合法校验器(可校验身份证合法性)
    static getIdCardInfo;               // 静态获取身份证信息获取器(可解析身份证所有信息,包括但不限于地名,出生等)
    isIdCardValid;          // 自身合法信息
    getIdCardInfo           // 自身解析的信息
    idCardStr               // 自身身份证号
    birthDate               // 自身出生日期(Date 格式)
    birthStr                // 自身出生日期(String 格式)
    option: OptionInterface;
    // 是否出生超过30天 now 为参照日期,默认今天
    isMastOverDate(now = new Date()): boolean;
    // 是否是青年人 再青少年跟老人之间为青年
    isYoung(now = new Date()): boolean;
    // 是否是老年人
    isOlder(now = new Date()): boolean;
    // 是否是青少年
    isTeenage(now = new Date()): boolean;
    /**
     * 增加日期 option 可选 {y: number, m: number, d: number}
     * 如:在 2018年4月3日往前推5天
     * addDate(new Date(2018,4,3), {d: -5});
     * 在 2018年4月3日往前推一年
     * addDate(new Date(2018,4,3), {y: -1});
     * 在 2018年4月3日往前推3月
     * addDate(new Date(2018,4,3), {m: -3});
     * */
    addDate(date: Date | any = new Date(), option = {}): Date;
    // 解析字符串为日期 默认返回当前对象的出生
    dateParse(dateStr: string | any = this.birthStr, splitStr = this.option.splitStr): Date
    // 解析日期为字符串 默认返回当前时间的格式化
    dateFormat(date: Date = new Date(), fmt = 'yyyy-MM-dd hh:mm:ss'): string;
    // 获取年龄 如:12.5 小数部分为当前已过时间除以当年所有时间所占比 保留4位有效小数 默认返回当前对象的岁数
    getAgeFromDate(now = new Date()): number;
    // 获取两个日期之间一共有多少天 默认返回一年的天数
    getDayBetweenDate(date1: Date = this.addDate(new Date(), { y: -1 }), date2: Date = new Date()): number;
    // 获取闰年或者平年的所有天数 闰年:366 平年: 365 默认返回今年所有天数
    getDayFullYear(year = new Date().getFullYear()): number;
}

EDN