lyb-js 1.6.20 → 1.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @description
|
|
3
|
-
* @param
|
|
4
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsMaskPhoneNumber-隐藏手机号码
|
|
2
|
+
* @description 将中间四位设置为星号
|
|
3
|
+
* @param str 需要处理的手机号码
|
|
5
4
|
*/
|
|
6
|
-
export declare const
|
|
5
|
+
export declare const libJsMaskCenterFour: (str: number | string) => string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @description
|
|
3
|
-
* @param
|
|
4
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsMaskPhoneNumber-隐藏手机号码
|
|
2
|
+
* @description 将中间四位设置为星号
|
|
3
|
+
* @param str 需要处理的手机号码
|
|
5
4
|
*/
|
|
6
|
-
export const
|
|
7
|
-
const m =
|
|
8
|
-
|
|
5
|
+
export const libJsMaskCenterFour = (str) => {
|
|
6
|
+
const m = str.toString();
|
|
7
|
+
const len = m.length;
|
|
8
|
+
const start = Math.floor((len - 4) / 2); // 中间四位起点
|
|
9
|
+
return m.slice(0, start) + "****" + m.slice(start + 4);
|
|
9
10
|
};
|