1.0.3 • Published 6 months ago

desensitization v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

1. 安装依赖

npm install desensitization

2. 使用方法

const { name, IdNumberDesensitization, desensitizedCommon, phone, address } = require('./index')
console.log(name('张三')) //输出:*三
console.log(IdNumberDesensitization('310101198001010011')) //输出:3****************1
console.log(desensitizedCommon('1234567890', 3, 3)) //输出:123***890
console.log(phone('13812345678')) //输出:138******78
console.log(address('上海市浦东新区张江镇')) //输出:上海市浦东新区****

3. 说明

  • 脱敏公用 desensitizedCommon
/**
 * 脱敏公用
 * @param str 脱敏字符串
 * @param begin 起始保留长度,从0开始
 * @param end 结束保留长度,到str.length结束
 * @returns {string}
 */
  • 姓名脱敏 name
/**
 * 姓名脱敏
 * @param name 脱敏字符串
 * @returns {string}
 */
  • 证件脱敏(身份证号,军官证号,护照号)IdNumberDesensitization
/**
 * 证件脱敏(身份证号,军官证号,护照号)
 * @param str 脱敏字符串
 * @returns {string}
 */
  • 手机号脱敏 phone
/**
 * 手机号脱敏
 * @param str 脱敏字符串
 * @returns {string}
 */
  • 地址脱敏 address
/**
 * 地址脱敏
 * @param address 脱敏字符串
 * @returns {string}
 */
1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago