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 🙏

© 2026 – Pkg Stats / Ryan Hefner

bank-notification-utils

v1.0.1

Published

银行通知系统的辅助函数库

Downloads

228

Readme

bank-notification-utils 银行通知系统的 JavaScript 工具函数库,提供金额格式化、手机号校验、敏感信息掩码等常用功能,适用于 Node.js 与浏览器环境。

安装 bash npm install bank-notification-utils 或使用 yarn:

bash yarn add bank-notification-utils 快速开始 javascript // ES Module 引入 import { formatAmount, validatePhone, maskAccount } from 'bank-notification-utils';

console.log(formatAmount(1500.5)); // "1,500.50 ₽" console.log(validatePhone('+79161234567')); // true console.log(maskAccount('40817810123456789012')); // "408178****789012" javascript // CommonJS 引入 const { formatAmount, validatePhone, maskAccount } = require('bank-notification-utils'); API formatAmount(amount, options?) 将数字格式化为货币显示字符串。

参数

amount (number):金额数值。

options (object):可选配置。

locale (string):地区代码,默认 'ru-RU'。

currency (string):货币代码,默认 'RUB'。

decimals (number):小数位数,默认 2。

返回值 (string):格式化后的金额字符串。

示例

javascript formatAmount(1500); // "1,500.00 ₽" formatAmount(2000.5, { locale: 'en-US', currency: 'USD' }); // "$2,000.50" validatePhone(phone) 校验手机号格式是否合法(支持国际格式,以 + 开头)。

参数

phone (string):待校验的手机号字符串。

返回值 (boolean):是否为合法手机号。

示例

javascript validatePhone('+79161234567'); // true validatePhone('89161234567'); // false (缺少 +) validatePhone('+7 916 123 45 67'); // false (含空格) maskAccount(account) 对银行账号进行脱敏处理,保留前 6 位与后 6 位,中间用 **** 替代。

参数

account (string):账号字符串。

返回值 (string):脱敏后的账号;若长度不足 12 位,则返回原字符串(不做处理)。

示例

javascript maskAccount('40817810123456789012'); // "408178****789012" maskAccount('123456'); // "123456" maskName(name) 对姓名进行脱敏,保留第一个字符,其余用 * 替换。

参数

name (string):姓名。

返回值 (string):脱敏后的姓名。

示例

javascript maskName('Иванов'); // "И****" maskName('Li'); // "L*" getEventTypeName(type) 根据事件类型代码返回中文或俄文的可读名称。

参数

type (string):事件类型代码,可选值:TRANSACTION, RISK_ALERT, PROMOTION, BILL。

返回值 (string):显示名称。

示例

javascript getEventTypeName('TRANSACTION'); // "交易通知" getEventTypeName('RISK_ALERT'); // "风险提醒" getChannelName(channel) 根据渠道代码返回显示名称。

参数

channel (string):渠道代码,可选值:SMS, EMAIL, PUSH。

返回值 (string):显示名称。