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

chinabankbin

v1.0.1

Published

按银行卡卡号快速检测该银行卡类型,银行名称,银行代码

Downloads

14

Readme

BankBin

按银行卡卡号检测该银行卡类型,银行名称,银行代码 银行卡信息库更新于(2019-08)

通过银行卡号查询银行类型和银行卡类型,修复在与阿里API,混用时,导致的返回结果有可能会被上一次的Promise覆盖。

在input事件中高频率调用时,如果开启async配置,出现多个promise 中, 上一次的xhr在未完成请求的情况下会被cancle掉

采用 es6 class构造类 import导入 银行卡信息库

安装

npm install chinabankbin

#返回结果

validated 为true时,验证成功


{
    cardNo:"6217003810020275930"
    data: {
        cardType: "DC",
        cardTypeName: "储蓄卡",
        bankName: "中国建设银行",
        bankCode: "CCB"
    }
    validated:true
    msg:"匹配成功"
}

使用方式 new BankBin(cardNo,options)

成功获取银行卡信息后,返回一个对象.

promise.then方式调用

    import BankBin from 'bankbin';

    new BankBin(6217003810020275930).then(function(res){
            console.log(res)
    },function(res){
        console.log('验证失败')
    });

async/await方式调用

    import BankBin from 'bankbin';

    try{
        const res = await new BankBin(6217003810020275930);
        console.log(res)
    } catch (e){
        console.log('验证失败')
    }

options 参数


{
    async : false,              //默认false,  是否在内置银行卡信息中查询失败后,调用支付宝开放式银行卡查询API。
    timeout : 10000             //默认10000,  async参数为true时,生效.  API调用超时时间
}

//例:
try{
    const res = await new BankBin(6217003810020275930, { async : true });
    console.log(res)
} catch (e){
    console.log('验证失败')
}

小结

  1. 优先使用内置的银行卡信息库进行规则匹配,当前内置123个银行信息,能满足国内众多银行卡信息识别。银行卡信息库更新于(2019-08)
  2. 当系统自带的规则获取不到卡bin时,会调用支付宝的接口来获取,测试地址
  3. 支持 es6 import