lyb-js 1.6.20 → 1.6.22
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
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @description 用于游戏判断是否为横版状态
|
|
2
|
+
* @param mode h-纯横版游戏 v-纯竖版
|
|
3
|
+
*/
|
|
4
|
+
export const libJsHorizontal = (mode) => {
|
|
5
|
+
const w = window.innerWidth;
|
|
6
|
+
const h = window.innerHeight;
|
|
7
|
+
let isH = w > h;
|
|
8
|
+
if (mode === "h") {
|
|
9
|
+
isH = true;
|
|
10
|
+
}
|
|
11
|
+
else if (mode === "v") {
|
|
12
|
+
isH = false;
|
|
13
|
+
}
|
|
14
|
+
return isH;
|
|
15
|
+
};
|
package/README.md
CHANGED
|
@@ -155,6 +155,8 @@ console.log(t); //"string"
|
|
|
155
155
|
|
|
156
156
|
\- [LibJsClassObservable-类属性监听器](#LibJsClassObservable-类属性监听器)
|
|
157
157
|
|
|
158
|
+
\- [LibJsHorizontal-游戏横版状态](#LibJsHorizontal-游戏横版状态)
|
|
159
|
+
|
|
158
160
|
|
|
159
161
|
### Random-随机
|
|
160
162
|
|
|
@@ -680,6 +682,10 @@ setTimeout(()=>{
|
|
|
680
682
|
}, 1000)
|
|
681
683
|
```
|
|
682
684
|
|
|
685
|
+
### LibJsHorizontal-游戏横版状态
|
|
686
|
+
|
|
687
|
+
> 需要传递当前游戏的适配模式
|
|
688
|
+
|
|
683
689
|
## Random-随机
|
|
684
690
|
|
|
685
691
|
### LibJsProbabilityResult-概率触发
|