@yh-kit/utils 0.0.1 → 0.0.3
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 +2 -9
- package/dist/utils.js +15 -0
- package/dist/utils.umd.cjs +1 -0
- package/package.json +10 -10
- package/types/array/array2obj.d.ts +7 -0
- package/types/array/index.d.ts +1 -0
- package/types/index.d.ts +2 -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,15 @@
|
|
|
1
|
+
const r = (n) => {
|
|
2
|
+
if (!n || !n.length) return {};
|
|
3
|
+
const o = {};
|
|
4
|
+
return n.forEach((e) => {
|
|
5
|
+
const l = Object.assign({ label: e.label, text: e.label }, e);
|
|
6
|
+
o[e == null ? void 0 : e.value] = l;
|
|
7
|
+
}), o;
|
|
8
|
+
}, s = (n) => {
|
|
9
|
+
const e = new RegExp("[?&]" + n + "=([^&#]*)", "i").exec(window.location.href);
|
|
10
|
+
return e ? decodeURIComponent(e[1]) : null;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
r as handleArrTansferEnumObj,
|
|
14
|
+
s as queryURLParamsUtil
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(n=typeof globalThis<"u"?globalThis:n||self,t(n.yhkitUtils={}))})(this,function(n){"use strict";const t=o=>{if(!o||!o.length)return{};const s={};return o.forEach(e=>{const r=Object.assign({label:e.label,text:e.label},e);s[e==null?void 0:e.value]=r}),s},l=o=>{const e=new RegExp("[?&]"+o+"=([^&#]*)","i").exec(window.location.href);return e?decodeURIComponent(e[1]):null};n.handleArrTansferEnumObj=t,n.queryURLParamsUtil=l,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yh-kit/utils",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
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",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"vite": "catalog:"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
|
-
"main": "dist/
|
|
27
|
+
"main": "dist/utils.js",
|
|
28
28
|
"access": "public",
|
|
29
29
|
"registry": "https://registry.npmjs.org/"
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|
|
@@ -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;
|