@yh-kit/utils 1.0.0 → 1.0.1
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.
- package/dist/utils.js +27 -22
- package/package.json +2 -2
- package/types/array/array2obj.d.ts +6 -0
package/dist/utils.js
CHANGED
|
@@ -1,28 +1,33 @@
|
|
|
1
|
-
const r =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
const r = {
|
|
2
|
+
/**
|
|
3
|
+
* 数组转枚举对象
|
|
4
|
+
* @param arr 数组
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
toEnumObj: (e) => {
|
|
8
|
+
if (!e || !e.length) return {};
|
|
9
|
+
const o = {};
|
|
10
|
+
return e.forEach((n) => {
|
|
11
|
+
const t = Object.assign({ label: n.label, text: n.label }, n);
|
|
12
|
+
o[n == null ? void 0 : n.value] = t;
|
|
13
|
+
}), o;
|
|
14
|
+
}
|
|
15
|
+
}, a = {
|
|
16
|
+
...r
|
|
17
|
+
}, s = (e) => e.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), c = {
|
|
18
|
+
toMoney: s
|
|
10
19
|
}, b = {
|
|
11
|
-
...
|
|
12
|
-
},
|
|
13
|
-
toMoney: c
|
|
14
|
-
}, g = {
|
|
15
|
-
...l
|
|
16
|
-
}, u = (e) => {
|
|
20
|
+
...c
|
|
21
|
+
}, l = (e) => {
|
|
17
22
|
const n = new RegExp("[?&]" + e + "=([^&#]*)", "i").exec(window.location.href);
|
|
18
23
|
return n ? decodeURIComponent(n[1]) : null;
|
|
19
|
-
},
|
|
20
|
-
getQueryInfoByName:
|
|
21
|
-
},
|
|
22
|
-
...
|
|
24
|
+
}, u = {
|
|
25
|
+
getQueryInfoByName: l
|
|
26
|
+
}, g = {
|
|
27
|
+
...u
|
|
23
28
|
};
|
|
24
29
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
a as arrayUtils,
|
|
31
|
+
b as numberUtils,
|
|
32
|
+
g as urlUtils
|
|
28
33
|
};
|
package/package.json
CHANGED