@yh-kit/utils 1.0.0 → 1.1.0
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 +32 -23
- package/dist/utils.umd.cjs +1 -1
- package/package.json +2 -2
- package/types/array/array2obj.d.ts +11 -0
- package/types/letter/index.d.ts +11 -0
- package/types/number/index.d.ts +1 -0
- package/types/number/letter.d.ts +4 -0
package/dist/utils.js
CHANGED
|
@@ -1,28 +1,37 @@
|
|
|
1
|
-
const r =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
const r = {
|
|
2
|
+
// toEnumObj: handleArrTansferEnumObj,
|
|
3
|
+
/**
|
|
4
|
+
* 数组转枚举对象
|
|
5
|
+
* @param arr 数组
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
toEnumObj: (e) => {
|
|
9
|
+
if (!e || !e.length) return {};
|
|
10
|
+
const n = {};
|
|
11
|
+
return e.forEach((t) => {
|
|
12
|
+
const o = Object.assign({ label: t.label, text: t.label }, t);
|
|
13
|
+
n[t == null ? void 0 : t.value] = o;
|
|
14
|
+
}), n;
|
|
15
|
+
}
|
|
14
16
|
}, g = {
|
|
15
|
-
...
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getQueryInfoByName: u
|
|
17
|
+
...r
|
|
18
|
+
}, s = (e) => e > 25 || e < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[e], c = {
|
|
19
|
+
toLetter: s
|
|
20
|
+
}, l = (e) => e.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), u = {
|
|
21
|
+
toMoney: l
|
|
21
22
|
}, y = {
|
|
22
|
-
...
|
|
23
|
+
...u,
|
|
24
|
+
...c
|
|
25
|
+
}, a = (e) => {
|
|
26
|
+
const t = new RegExp("[?&]" + e + "=([^&#]*)", "i").exec(window.location.href);
|
|
27
|
+
return t ? decodeURIComponent(t[1]) : null;
|
|
28
|
+
}, b = {
|
|
29
|
+
getQueryInfoByName: a
|
|
30
|
+
}, x = {
|
|
31
|
+
...b
|
|
23
32
|
};
|
|
24
33
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
g as arrayUtils,
|
|
35
|
+
y as numberUtils,
|
|
36
|
+
x as urlUtils
|
|
28
37
|
};
|
package/dist/utils.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.yhkitUtils={}))})(this,function(n){"use strict";const s={...{toEnumObj:
|
|
1
|
+
(function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.yhkitUtils={}))})(this,function(n){"use strict";const s={...{toEnumObj:e=>{if(!e||!e.length)return{};const r={};return e.forEach(t=>{const c=Object.assign({label:t.label,text:t.label},t);r[t==null?void 0:t.value]=c}),r}}},l={...{toMoney:e=>e.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},...{toLetter:e=>e>25||e<0?"":"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[e]}},u={...{getQueryInfoByName:e=>{const t=new RegExp("[?&]"+e+"=([^&#]*)","i").exec(window.location.href);return t?decodeURIComponent(t[1]):null}}};n.arrayUtils=s,n.numberUtils=l,n.urlUtils=u,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { IOptionItem, TValueEnum } from "../typings";
|
|
2
|
+
/**
|
|
3
|
+
* 数组转枚举对象
|
|
4
|
+
* @param arr
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
/** 数组转对象 */
|
|
2
8
|
declare const _default: {
|
|
9
|
+
/**
|
|
10
|
+
* 数组转枚举对象
|
|
11
|
+
* @param arr 数组
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
3
14
|
toEnumObj: (arr: IOptionItem[]) => TValueEnum;
|
|
4
15
|
};
|
|
5
16
|
export default _default;
|
package/types/number/index.d.ts
CHANGED