@yh-kit/utils 0.0.2 → 0.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/README.md +13 -0
- package/dist/utils.js +16 -0
- package/dist/utils.umd.cjs +1 -0
- package/package.json +14 -10
- package/types/array/array2obj.d.ts +7 -0
- package/types/array/index.d.ts +1 -0
- package/types/index.d.ts +3 -0
- package/types/money/index.d.ts +10 -0
- package/types/typings/index.d.ts +18 -0
- package/types/url/index.d.ts +1 -0
- package/types/url/query.d.ts +6 -0
- package/dist/counter.js +0 -10
- package/dist/counter.umd.cjs +0 -1
- package/index.d.ts +0 -1
package/README.md
CHANGED
package/dist/utils.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const t = (n) => {
|
|
2
|
+
if (!n || !n.length) return {};
|
|
3
|
+
const o = {};
|
|
4
|
+
return n.forEach((e) => {
|
|
5
|
+
const r = Object.assign({ label: e.label, text: e.label }, e);
|
|
6
|
+
o[e == null ? void 0 : e.value] = r;
|
|
7
|
+
}), o;
|
|
8
|
+
}, l = (n) => n.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), s = (n) => {
|
|
9
|
+
const e = new RegExp("[?&]" + n + "=([^&#]*)", "i").exec(window.location.href);
|
|
10
|
+
return e ? decodeURIComponent(e[1]) : null;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
l as formatNumberWithCommasUtil,
|
|
14
|
+
t as handleArrTansferEnumObj,
|
|
15
|
+
s as queryURLParamsUtil
|
|
16
|
+
};
|
|
@@ -0,0 +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 o=t=>{if(!t||!t.length)return{};const r={};return t.forEach(e=>{const u=Object.assign({label:e.label,text:e.label},e);r[e==null?void 0:e.value]=u}),r},l=t=>t.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),s=t=>{const e=new RegExp("[?&]"+t+"=([^&#]*)","i").exec(window.location.href);return e?decodeURIComponent(e[1]):null};n.formatNumberWithCommasUtil=l,n.handleArrTansferEnumObj=o,n.queryURLParamsUtil=s,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yh-kit/utils",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
8
|
-
"
|
|
8
|
+
"types"
|
|
9
9
|
],
|
|
10
|
-
"main": "./dist/
|
|
11
|
-
"module": "./dist/
|
|
12
|
-
"types": "./index.d.ts",
|
|
10
|
+
"main": "./dist/utils.umd.cjs",
|
|
11
|
+
"module": "./dist/utils.js",
|
|
12
|
+
"types": "./types/index.d.ts",
|
|
13
13
|
"exports": {
|
|
14
|
-
"types": "./index.d.ts",
|
|
15
|
-
"import": "./dist/
|
|
16
|
-
"require": "./dist/
|
|
14
|
+
"types": "./types/index.d.ts",
|
|
15
|
+
"import": "./dist/utils.js",
|
|
16
|
+
"require": "./dist/utils.umd.cjs"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"dev": "vite",
|
|
20
|
-
"build": "tsc && vite build"
|
|
20
|
+
"build": "tsc && vite build",
|
|
21
|
+
"clean": "rimraf node_modules",
|
|
22
|
+
"clean-build": "rimraf dist & rimraf types",
|
|
23
|
+
"clean-all": "rimraf node_modules & rimraf dist & rimraf types",
|
|
24
|
+
"prepublishOnly": "npm run clean-build && npm run build"
|
|
21
25
|
},
|
|
22
26
|
"devDependencies": {
|
|
23
27
|
"typescript": "catalog:",
|
|
24
28
|
"vite": "catalog:"
|
|
25
29
|
},
|
|
26
30
|
"publishConfig": {
|
|
27
|
-
"main": "dist/
|
|
31
|
+
"main": "dist/utils.js",
|
|
28
32
|
"access": "public",
|
|
29
33
|
"registry": "https://registry.npmjs.org/"
|
|
30
34
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./array2obj";
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 枚举对象类型
|
|
3
|
+
*/
|
|
4
|
+
export type TValueEnum = Record<string | number | symbol, {
|
|
5
|
+
text: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* 枚举对象类型
|
|
10
|
+
*/
|
|
11
|
+
export interface IOptionItem {
|
|
12
|
+
/** 值 */
|
|
13
|
+
value: number | string;
|
|
14
|
+
/** 中文名 */
|
|
15
|
+
text: string;
|
|
16
|
+
/** 其他任意字段 */
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./query";
|
package/dist/counter.js
DELETED
package/dist/counter.umd.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.Counter={}))})(this,function(e){"use strict";function t(o){let n=0;const i=u=>{n=u,o.innerHTML=`count is ${n}`};o.addEventListener("click",()=>i(++n)),i(0)}e.setupCounter=t,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function setupCounter(element: HTMLButtonElement): void;
|