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

pazl-shelter

v1.0.14

Published

前端脱敏:用户名、手机号、邮箱、银行卡、身份证、地址、车架号、军官号、驾照号, MAC地址、公积金号、IP、社保号、车牌

Downloads

21

Readme

脱敏

脱敏规则

  • 客户姓名: 保留姓,其余屏蔽 王建国;Michale Jordan 王**;*** Jordan
  • 手机号:
    • 大陆:显示前3位和后4位
    • 香港:澳门:显示前2位和后2位(如:90****85)
    • 台湾:显示前2位和后3位(如:90****856)
    • 其他海外地区:连续屏蔽自第四位开始的4位数字 17812345678 178****5678
    • 固定电话: 保留区号和后2位,其余屏蔽 02147593745 021******45
  • 电子邮箱:
    • @前面字符显示前3位,后面加三个*,@后面完整显示;
    • 如果@前面字符少于三位,则全部展示,并在后面加三个*,@后面完整显示;
  • 银行卡号:
    • 多于10位:保留前6位,后4位,其余屏蔽;
    • 10位或更短时:屏蔽第3位到倒数第3位 6257983556363363225403 625798************5403
  • 身份证号: 保留前4位和后4位 422302193740323000 422***********3000
  • 家庭住址:
    • 地址为中文:显示国家、省、地级市,其余屏蔽;
    • 地址为非中文:保留总字符个数的前一半,其余屏蔽 广东省深圳市福田区益田路5033号平安金融中心22楼 广东省深圳市*******
  • 车架号: 展示前4位和后4位 SLD15CK4721155214 SLD1*********5214
// npm i pazl-shellter // 安装
import { shelter } from 'pazl-shelter' // 1.引入
shelter('李狗蛋', 1);  // 调用 -> 李**

/**
* @description: 脱敏通用方法(对以下方法的简单封装)
* @str: {string} 要脱敏的字符
* @type: { number } 类型:  1: 用户名、 2: 手机号、 3: 邮箱、 4: 银行卡、 5: 身份证、 6: 地址、 7: 车架号、 8: 军官号、护照号、居住证、 9: 驾照号, MAC地址、 10: 公积金号、 11: 社保号、 12:IP、 13:车牌号
* @return: {string} 脱敏后的结果
*/
export function shelter(str, type):string

/**
 * @description: 脱敏对象的部分key
 * @param { Object} obj  要脱单对象
 * @param { string} keys  要脱的key的集合 ,例:[{key: 'userName', type: 1}, { key: 'phone', type: 2}]
 * @returns { Object} 脱敏后的对象
 */
export function shelterObj(obj,keys):object

/**
 * @description: 数组批量脱敏[表格数据]
 * @param {Array} arr 要脱敏的数组
 * @param {string} keys  要脱的key的集合 例:[{key: 'userName', type: 1}, { key: 'phone', type: 2}]
 * @returns { Object}  脱敏后的列表
 */
function shelterArr(arr, keys): Array 


/**
* @description: 全部屏蔽
* @len: {number} 要脱敏的字符的长度
* @return: {string} 全都是****, 长度和源字符串长度一样
*/
export function hideAll(len):string


/**
* @description: 用户名脱敏(支持中/英文)
* @UserName: {string} 用户名
* @return: {string} 脱敏后的用户名
*/
export function shelterUserName(UserName):string

/**
* @description: 脱敏手机号
* @PhoneNumber: {string} 手机号
* @return: {string} 脱敏后手机号
*/
export function shelterPhoneNumber(PhoneNumber):string

/**
* @description: 脱敏邮箱
* @email: {string} 邮箱
* @return: {string} 脱敏后的邮箱
*/
export function shelterEmail(email):string

/**
* @description: 脱敏银行卡
* @backCard: {string} 银行卡
* @return: {string} 脱敏后银行卡
*/
export function shelterBankCard(backCard):string

/**
* @description: 脱敏身份证
* @idCard: {string} 身份证
* @return: {string} 脱敏后身份证
*/
export function shelterIdCard(idCard):string

/**
* @description: 脱敏地址
* @idCard: {string} 地址
* @return: {string} 脱敏后地址
*/
export function shelterAddress(idCard):string

/**
* @description: 脱敏车架号
* @carNumber: {string} 车架号
* @return: {string} 脱敏后车架号
*/
export function shelterCarNumber(carNumber):string

npm 推送

   0- nrm use npm  连主站
   1- npm login 先登录
   2- npm publish 推送

技术支持加群:

  • 请备注:脱敏