@ivujs/i-utils 1.1.6 → 1.1.8

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,29 +1,46 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
+ 'use strict';
2
+
3
+ /**
4
+ * 生成UUID
5
+ * @param {Number} len 生成的长度,默认32位
6
+ * @param {Number} radix 进制数,默认16进制
7
+ * @example
8
+ * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a
9
+ * @returns {String} 返回字符串
10
+ */
3
11
  function getUUID(len = 32, radix = 16) {
4
- const CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
5
- let uuid = [], i;
6
- radix = radix || CHARS.length;
7
- if (len) {
8
- for (i = 0; i < len; i++) uuid[i] = CHARS[0 | Math.random() * radix];
9
- } else {
10
- let r;
11
- uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
12
- uuid[14] = "4";
13
- for (i = 0; i < 36; i++) {
14
- if (!uuid[i]) {
15
- r = 0 | Math.random() * 16;
16
- uuid[i] = CHARS[i === 19 ? r & 3 | 8 : r];
17
- }
12
+ const CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
13
+ let uuid = [], i;
14
+ radix = radix || CHARS.length;
15
+ if (len) {
16
+ for (i = 0; i < len; i++)
17
+ uuid[i] = CHARS[0 | (Math.random() * radix)];
18
18
  }
19
- }
20
- return uuid.join("");
19
+ else {
20
+ let r;
21
+ uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
22
+ uuid[14] = "4";
23
+ for (i = 0; i < 36; i++) {
24
+ if (!uuid[i]) {
25
+ r = 0 | (Math.random() * 16);
26
+ uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];
27
+ }
28
+ }
29
+ }
30
+ return uuid.join("");
21
31
  }
32
+ /**
33
+ * 生成GUID
34
+ * @example
35
+ * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c
36
+ * @returns {String} 返回字符串
37
+ */
22
38
  function getGUID() {
23
- let s4 = function() {
24
- return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
25
- };
26
- return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
39
+ const s4 = function () {
40
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
41
+ };
42
+ return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
27
43
  }
44
+
28
45
  exports.getGUID = getGUID;
29
46
  exports.getUUID = getUUID;
@@ -1,9 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./id/index.cjs");
1
+ 'use strict';
2
+
3
+ var index = require('./id/index.cjs');
4
+
5
+ // 测试加载成功方法
4
6
  function loadedTest() {
5
- console.log("Nice, iUtils loaded successfully!");
7
+ console.log("Nice, iUtils loaded successfully!");
6
8
  }
9
+ function loadUtils() {
10
+ console.log("Nice, iUtils loaded successfully!");
11
+ }
12
+
7
13
  exports.getGUID = index.getGUID;
8
14
  exports.getUUID = index.getUUID;
15
+ exports.loadUtils = loadUtils;
9
16
  exports.loadedTest = loadedTest;
@@ -1,29 +1,43 @@
1
+ /**
2
+ * 生成UUID
3
+ * @param {Number} len 生成的长度,默认32位
4
+ * @param {Number} radix 进制数,默认16进制
5
+ * @example
6
+ * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a
7
+ * @returns {String} 返回字符串
8
+ */
1
9
  function getUUID(len = 32, radix = 16) {
2
- const CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
3
- let uuid = [], i;
4
- radix = radix || CHARS.length;
5
- if (len) {
6
- for (i = 0; i < len; i++) uuid[i] = CHARS[0 | Math.random() * radix];
7
- } else {
8
- let r;
9
- uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
10
- uuid[14] = "4";
11
- for (i = 0; i < 36; i++) {
12
- if (!uuid[i]) {
13
- r = 0 | Math.random() * 16;
14
- uuid[i] = CHARS[i === 19 ? r & 3 | 8 : r];
15
- }
10
+ const CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
11
+ let uuid = [], i;
12
+ radix = radix || CHARS.length;
13
+ if (len) {
14
+ for (i = 0; i < len; i++)
15
+ uuid[i] = CHARS[0 | (Math.random() * radix)];
16
16
  }
17
- }
18
- return uuid.join("");
17
+ else {
18
+ let r;
19
+ uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
20
+ uuid[14] = "4";
21
+ for (i = 0; i < 36; i++) {
22
+ if (!uuid[i]) {
23
+ r = 0 | (Math.random() * 16);
24
+ uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];
25
+ }
26
+ }
27
+ }
28
+ return uuid.join("");
19
29
  }
30
+ /**
31
+ * 生成GUID
32
+ * @example
33
+ * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c
34
+ * @returns {String} 返回字符串
35
+ */
20
36
  function getGUID() {
21
- let s4 = function() {
22
- return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
23
- };
24
- return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
37
+ const s4 = function () {
38
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
39
+ };
40
+ return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
25
41
  }
26
- export {
27
- getGUID,
28
- getUUID
29
- };
42
+
43
+ export { getGUID, getUUID };
@@ -1,2 +1,3 @@
1
1
  export declare function loadedTest(): void;
2
+ export declare function loadUtils(): void;
2
3
  export * from "./id/index.ts";
package/dist/es/index.mjs CHANGED
@@ -1,9 +1,11 @@
1
- import { getGUID, getUUID } from "./id/index.mjs";
1
+ export { getGUID, getUUID } from './id/index.mjs';
2
+
3
+ // 测试加载成功方法
2
4
  function loadedTest() {
3
- console.log("Nice, iUtils loaded successfully!");
5
+ console.log("Nice, iUtils loaded successfully!");
4
6
  }
5
- export {
6
- getGUID,
7
- getUUID,
8
- loadedTest
9
- };
7
+ function loadUtils() {
8
+ console.log("Nice, iUtils loaded successfully!");
9
+ }
10
+
11
+ export { loadUtils, loadedTest };
package/dist/index.d.ts CHANGED
@@ -1,21 +1,21 @@
1
- /**
2
- * 生成GUID
3
- * @example
4
- * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c
5
- * @returns {String} 返回字符串
6
- */
7
- export declare function getGUID(): string;
8
-
9
- /**
10
- * 生成UUID
11
- * @param {Number} len 生成的长度,默认32位
12
- * @param {Number} radix 进制数,默认16进制
13
- * @example
14
- * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a
15
- * @returns {String} 返回字符串
16
- */
17
- export declare function getUUID(len?: number, radix?: number): string;
18
-
19
- export declare function loadedTest(): void;
20
-
21
- export { }
1
+ /**
2
+ * 生成UUID
3
+ * @param {Number} len 生成的长度,默认32位
4
+ * @param {Number} radix 进制数,默认16进制
5
+ * @example
6
+ * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a
7
+ * @returns {String} 返回字符串
8
+ */
9
+ declare function getUUID(len?: number, radix?: number): string;
10
+ /**
11
+ * 生成GUID
12
+ * @example
13
+ * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c
14
+ * @returns {String} 返回字符串
15
+ */
16
+ declare function getGUID(): string;
17
+
18
+ declare function loadedTest(): void;
19
+ declare function loadUtils(): void;
20
+
21
+ export { getGUID, getUUID, loadUtils, loadedTest };
@@ -1,19 +1,61 @@
1
1
  /*!
2
- * @ivujs/i-utils v1.1.6
2
+ * @ivujs/i-utils v1.1.8
3
3
  * Copyright 2021-2026, <gao911222@163.com>
4
4
  * Released under the MIT License.
5
5
  */
6
- "use strict";
7
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
- function IUtilsResolver(options = {}) {
9
- const api = ["getUUID", "getGUID", "loadTest"];
10
- return (name) => {
11
- if (api.includes(name)) {
12
- return {
13
- name,
14
- from: "@ivujs/i-utils"
15
- };
6
+ 'use strict';
7
+
8
+ /**
9
+ * 生成UUID
10
+ * @param {Number} len 生成的长度,默认32位
11
+ * @param {Number} radix 进制数,默认16进制
12
+ * @example
13
+ * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a
14
+ * @returns {String} 返回字符串
15
+ */
16
+ function getUUID(len = 32, radix = 16) {
17
+ const CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
18
+ let uuid = [], i;
19
+ radix = radix || CHARS.length;
20
+ if (len) {
21
+ for (i = 0; i < len; i++)
22
+ uuid[i] = CHARS[0 | (Math.random() * radix)];
23
+ }
24
+ else {
25
+ let r;
26
+ uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
27
+ uuid[14] = "4";
28
+ for (i = 0; i < 36; i++) {
29
+ if (!uuid[i]) {
30
+ r = 0 | (Math.random() * 16);
31
+ uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];
32
+ }
33
+ }
16
34
  }
17
- };
35
+ return uuid.join("");
36
+ }
37
+ /**
38
+ * 生成GUID
39
+ * @example
40
+ * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c
41
+ * @returns {String} 返回字符串
42
+ */
43
+ function getGUID() {
44
+ const s4 = function () {
45
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
46
+ };
47
+ return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
48
+ }
49
+
50
+ // 测试加载成功方法
51
+ function loadedTest() {
52
+ console.log("Nice, iUtils loaded successfully!");
53
+ }
54
+ function loadUtils() {
55
+ console.log("Nice, iUtils loaded successfully!");
18
56
  }
19
- exports.IUtilsResolver = IUtilsResolver;
57
+
58
+ exports.getGUID = getGUID;
59
+ exports.getUUID = getUUID;
60
+ exports.loadUtils = loadUtils;
61
+ exports.loadedTest = loadedTest;
@@ -1,2 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.IUtilsResolver=function(e={}){const t=["getUUID","getGUID","loadTest"];return e=>{if(t.includes(e))return{name:e,from:"@ivujs/i-utils"}}};
1
+ /*!
2
+ * @ivujs/i-utils v1.1.8
3
+ * Copyright 2021-2026, <gao911222@163.com>
4
+ * Released under the MIT License.
5
+ */
6
+ "use strict";exports.getGUID=function(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},exports.getUUID=function(t=32,o=16){const e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");let n,s=[];if(o=o||e.length,t)for(n=0;n<t;n++)s[n]=e[0|Math.random()*o];else{let t;for(s[8]=s[13]=s[18]=s[23]="-",s[14]="4",n=0;n<36;n++)s[n]||(t=0|16*Math.random(),s[n]=e[19===n?3&t|8:t])}return s.join("")},exports.loadUtils=function(){console.log("Nice, iUtils loaded successfully!")},exports.loadedTest=function(){console.log("Nice, iUtils loaded successfully!")};
2
7
  //# sourceMappingURL=index.full.cjs.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.full.cjs.min.js","sources":["../../src/resolvers/index.ts"],"sourcesContent":["import type { Resolver, Options } from \"unplugin-auto-import/types\";\r\n\r\nexport function IUtilsResolver(options: Options = {}): Resolver {\r\n const api = [\"getUUID\", \"getGUID\", \"loadTest\"];\r\n return (name: string) => {\r\n if (api.includes(name)) {\r\n return {\r\n name,\r\n from: \"@ivujs/i-utils\",\r\n };\r\n }\r\n };\r\n}\r\n"],"names":["options","api","name","includes","from"],"mappings":"uGAEO,SAAwBA,EAAmB,IAChD,MAAMC,EAAM,CAAC,UAAW,UAAW,YACnC,OAAQC,IACN,GAAID,EAAIE,SAASD,GACf,MAAO,CACLA,OACAE,KAAM,iBAEV,CAEJ"}
1
+ {"version":3,"file":"index.full.cjs.min.js","sources":["../../src/id/file:/D:/webWorks/i-utils/src/id/index.ts","../../src/file:/D:/webWorks/i-utils/src/index.ts"],"sourcesContent":["/**\r\n * 生成UUID\r\n * @param {Number} len 生成的长度,默认32位\r\n * @param {Number} radix 进制数,默认16进制\r\n * @example\r\n * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getUUID(len: number = 32, radix: number = 16): string {\r\n const CHARS = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\");\r\n let uuid = [],\r\n i;\r\n radix = radix || CHARS.length;\r\n if (len) {\r\n for (i = 0; i < len; i++) uuid[i] = CHARS[0 | (Math.random() * radix)];\r\n } else {\r\n let r;\r\n uuid[8] = uuid[13] = uuid[18] = uuid[23] = \"-\";\r\n uuid[14] = \"4\";\r\n for (i = 0; i < 36; i++) {\r\n if (!uuid[i]) {\r\n r = 0 | (Math.random() * 16);\r\n uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];\r\n }\r\n }\r\n }\r\n return uuid.join(\"\");\r\n}\r\n\r\n/**\r\n * 生成GUID\r\n * @example\r\n * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getGUID(): string {\r\n const s4 = function () {\r\n return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\r\n };\r\n return s4() + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + s4() + s4();\r\n}\r\n","// 测试加载成功方法\r\nexport function loadedTest(): void {\r\n console.log(\"Nice, iUtils loaded successfully!\");\r\n}\r\n\r\nexport function loadUtils(): void {\r\n console.log(\"Nice, iUtils loaded successfully!\");\r\n}\r\n\r\n// 生成id\r\nexport * from \"./id/index.ts\";\r\n"],"names":["s4","Math","random","toString","substring","len","radix","CHARS","split","i","uuid","length","r","join","console","log"],"mappings":";;;;;wCAoCE,MAAMA,EAAK,WACT,OAA+B,OAArB,EAAIC,KAAKC,UAAuB,GAAGC,SAAS,IAAIC,UAAU,EACtE,EACA,OAAOJ,IAAOA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAOA,IAAOA,GAClF,2BAhCwBK,EAAc,GAAIC,EAAgB,IACxD,MAAMC,EAAQ,iEAAiEC,MAAM,IACrF,IACEC,EADEC,EAAO,GAGX,GADAJ,EAAQA,GAASC,EAAMI,OACnBN,EACF,IAAKI,EAAI,EAAGA,EAAIJ,EAAKI,IAAKC,EAAKD,GAAKF,EAAM,EAAKN,KAAKC,SAAWI,OAC1D,CACL,IAAIM,EAGJ,IAFAF,EAAK,GAAKA,EAAK,IAAMA,EAAK,IAAMA,EAAK,IAAM,IAC3CA,EAAK,IAAM,IACND,EAAI,EAAGA,EAAI,GAAIA,IACbC,EAAKD,KACRG,EAAI,EAAqB,GAAhBX,KAAKC,SACdQ,EAAKD,GAAKF,EAAY,KAANE,EAAgB,EAAJG,EAAW,EAAMA,GAGnD,CACA,OAAOF,EAAKG,KAAK,GACnB,+BCrBEC,QAAQC,IAAI,oCACd,gCALED,QAAQC,IAAI,oCACd"}
@@ -1,19 +1,56 @@
1
1
  /*!
2
- * @ivujs/i-utils v1.1.6
2
+ * @ivujs/i-utils v1.1.8
3
3
  * Copyright 2021-2026, <gao911222@163.com>
4
4
  * Released under the MIT License.
5
5
  */
6
- function IUtilsResolver(options = {}) {
7
- const api = ["getUUID", "getGUID", "loadTest"];
8
- return (name) => {
9
- if (api.includes(name)) {
10
- return {
11
- name,
12
- from: "@ivujs/i-utils"
13
- };
6
+ /**
7
+ * 生成UUID
8
+ * @param {Number} len 生成的长度,默认32位
9
+ * @param {Number} radix 进制数,默认16进制
10
+ * @example
11
+ * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a
12
+ * @returns {String} 返回字符串
13
+ */
14
+ function getUUID(len = 32, radix = 16) {
15
+ const CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
16
+ let uuid = [], i;
17
+ radix = radix || CHARS.length;
18
+ if (len) {
19
+ for (i = 0; i < len; i++)
20
+ uuid[i] = CHARS[0 | (Math.random() * radix)];
21
+ }
22
+ else {
23
+ let r;
24
+ uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
25
+ uuid[14] = "4";
26
+ for (i = 0; i < 36; i++) {
27
+ if (!uuid[i]) {
28
+ r = 0 | (Math.random() * 16);
29
+ uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];
30
+ }
31
+ }
14
32
  }
15
- };
33
+ return uuid.join("");
34
+ }
35
+ /**
36
+ * 生成GUID
37
+ * @example
38
+ * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c
39
+ * @returns {String} 返回字符串
40
+ */
41
+ function getGUID() {
42
+ const s4 = function () {
43
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
44
+ };
45
+ return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
46
+ }
47
+
48
+ // 测试加载成功方法
49
+ function loadedTest() {
50
+ console.log("Nice, iUtils loaded successfully!");
51
+ }
52
+ function loadUtils() {
53
+ console.log("Nice, iUtils loaded successfully!");
16
54
  }
17
- export {
18
- IUtilsResolver
19
- };
55
+
56
+ export { getGUID, getUUID, loadUtils, loadedTest };
@@ -1,2 +1,7 @@
1
- function t(t={}){const e=["getUUID","getGUID","loadTest"];return t=>{if(e.includes(t))return{name:t,from:"@ivujs/i-utils"}}}export{t as IUtilsResolver};
1
+ /*!
2
+ * @ivujs/i-utils v1.1.8
3
+ * Copyright 2021-2026, <gao911222@163.com>
4
+ * Released under the MIT License.
5
+ */
6
+ function n(n=32,o=16){const t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");let e,l=[];if(o=o||t.length,n)for(e=0;e<n;e++)l[e]=t[0|Math.random()*o];else{let n;for(l[8]=l[13]=l[18]=l[23]="-",l[14]="4",e=0;e<36;e++)l[e]||(n=0|16*Math.random(),l[e]=t[19===e?3&n|8:n])}return l.join("")}function o(){const n=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}function t(){console.log("Nice, iUtils loaded successfully!")}function e(){console.log("Nice, iUtils loaded successfully!")}export{o as getGUID,n as getUUID,e as loadUtils,t as loadedTest};
2
7
  //# sourceMappingURL=index.full.esm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.full.esm.min.js","sources":["../../src/resolvers/index.ts"],"sourcesContent":["import type { Resolver, Options } from \"unplugin-auto-import/types\";\r\n\r\nexport function IUtilsResolver(options: Options = {}): Resolver {\r\n const api = [\"getUUID\", \"getGUID\", \"loadTest\"];\r\n return (name: string) => {\r\n if (api.includes(name)) {\r\n return {\r\n name,\r\n from: \"@ivujs/i-utils\",\r\n };\r\n }\r\n };\r\n}\r\n"],"names":["IUtilsResolver","options","api","name","includes","from"],"mappings":"AAEO,SAASA,EAAeC,EAAmB,IAChD,MAAMC,EAAM,CAAC,UAAW,UAAW,YACnC,OAAQC,IACN,GAAID,EAAIE,SAASD,GACf,MAAO,CACLA,OACAE,KAAM,iBAEV,CAEJ"}
1
+ {"version":3,"file":"index.full.esm.min.js","sources":["../../src/id/file:/D:/webWorks/i-utils/src/id/index.ts","../../src/file:/D:/webWorks/i-utils/src/index.ts"],"sourcesContent":["/**\r\n * 生成UUID\r\n * @param {Number} len 生成的长度,默认32位\r\n * @param {Number} radix 进制数,默认16进制\r\n * @example\r\n * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getUUID(len: number = 32, radix: number = 16): string {\r\n const CHARS = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\");\r\n let uuid = [],\r\n i;\r\n radix = radix || CHARS.length;\r\n if (len) {\r\n for (i = 0; i < len; i++) uuid[i] = CHARS[0 | (Math.random() * radix)];\r\n } else {\r\n let r;\r\n uuid[8] = uuid[13] = uuid[18] = uuid[23] = \"-\";\r\n uuid[14] = \"4\";\r\n for (i = 0; i < 36; i++) {\r\n if (!uuid[i]) {\r\n r = 0 | (Math.random() * 16);\r\n uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];\r\n }\r\n }\r\n }\r\n return uuid.join(\"\");\r\n}\r\n\r\n/**\r\n * 生成GUID\r\n * @example\r\n * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getGUID(): string {\r\n const s4 = function () {\r\n return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\r\n };\r\n return s4() + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + s4() + s4();\r\n}\r\n","// 测试加载成功方法\r\nexport function loadedTest(): void {\r\n console.log(\"Nice, iUtils loaded successfully!\");\r\n}\r\n\r\nexport function loadUtils(): void {\r\n console.log(\"Nice, iUtils loaded successfully!\");\r\n}\r\n\r\n// 生成id\r\nexport * from \"./id/index.ts\";\r\n"],"names":["getUUID","len","radix","CHARS","split","i","uuid","length","Math","random","r","join","getGUID","s4","toString","substring","loadedTest","console","log","loadUtils"],"mappings":";;;;;SAQgBA,EAAQC,EAAc,GAAIC,EAAgB,IACxD,MAAMC,EAAQ,iEAAiEC,MAAM,IACrF,IACEC,EADEC,EAAO,GAGX,GADAJ,EAAQA,GAASC,EAAMI,OACnBN,EACF,IAAKI,EAAI,EAAGA,EAAIJ,EAAKI,IAAKC,EAAKD,GAAKF,EAAM,EAAKK,KAAKC,SAAWP,OAC1D,CACL,IAAIQ,EAGJ,IAFAJ,EAAK,GAAKA,EAAK,IAAMA,EAAK,IAAMA,EAAK,IAAM,IAC3CA,EAAK,IAAM,IACND,EAAI,EAAGA,EAAI,GAAIA,IACbC,EAAKD,KACRK,EAAI,EAAqB,GAAhBF,KAAKC,SACdH,EAAKD,GAAKF,EAAY,KAANE,EAAgB,EAAJK,EAAW,EAAMA,GAGnD,CACA,OAAOJ,EAAKK,KAAK,GACnB,UAQgBC,IACd,MAAMC,EAAK,WACT,OAA+B,OAArB,EAAIL,KAAKC,UAAuB,GAAGK,SAAS,IAAIC,UAAU,EACtE,EACA,OAAOF,IAAOA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAOA,IAAOA,GAClF,UCvCgBG,IACdC,QAAQC,IAAI,oCACd,UAEgBC,IACdF,QAAQC,IAAI,oCACd"}
@@ -1,23 +1,67 @@
1
1
  /*!
2
- * @ivujs/i-utils v1.1.6
2
+ * @ivujs/i-utils v1.1.8
3
3
  * Copyright 2021-2026, <gao911222@163.com>
4
4
  * Released under the MIT License.
5
5
  */
6
- (function(global, factory) {
7
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.iUtils = {}));
8
- })(this, (function(exports2) {
9
- "use strict";
10
- function IUtilsResolver(options = {}) {
11
- const api = ["getUUID", "getGUID", "loadTest"];
12
- return (name) => {
13
- if (api.includes(name)) {
14
- return {
15
- name,
16
- from: "@ivujs/i-utils"
6
+ (function (global, factory) {
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
8
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.iUtils = {}));
10
+ })(this, (function (exports) { 'use strict';
11
+
12
+ /**
13
+ * 生成UUID
14
+ * @param {Number} len 生成的长度,默认32位
15
+ * @param {Number} radix 进制数,默认16进制
16
+ * @example
17
+ * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a
18
+ * @returns {String} 返回字符串
19
+ */
20
+ function getUUID(len = 32, radix = 16) {
21
+ const CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
22
+ let uuid = [], i;
23
+ radix = radix || CHARS.length;
24
+ if (len) {
25
+ for (i = 0; i < len; i++)
26
+ uuid[i] = CHARS[0 | (Math.random() * radix)];
27
+ }
28
+ else {
29
+ let r;
30
+ uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
31
+ uuid[14] = "4";
32
+ for (i = 0; i < 36; i++) {
33
+ if (!uuid[i]) {
34
+ r = 0 | (Math.random() * 16);
35
+ uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];
36
+ }
37
+ }
38
+ }
39
+ return uuid.join("");
40
+ }
41
+ /**
42
+ * 生成GUID
43
+ * @example
44
+ * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c
45
+ * @returns {String} 返回字符串
46
+ */
47
+ function getGUID() {
48
+ const s4 = function () {
49
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
17
50
  };
18
- }
19
- };
20
- }
21
- exports2.IUtilsResolver = IUtilsResolver;
22
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
51
+ return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
52
+ }
53
+
54
+ // 测试加载成功方法
55
+ function loadedTest() {
56
+ console.log("Nice, iUtils loaded successfully!");
57
+ }
58
+ function loadUtils() {
59
+ console.log("Nice, iUtils loaded successfully!");
60
+ }
61
+
62
+ exports.getGUID = getGUID;
63
+ exports.getUUID = getUUID;
64
+ exports.loadUtils = loadUtils;
65
+ exports.loadedTest = loadedTest;
66
+
23
67
  }));
@@ -1,2 +1,7 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).iUtils={})}(this,(function(e){"use strict";e.IUtilsResolver=function(e={}){const t=["getUUID","getGUID","loadTest"];return e=>{if(t.includes(e))return{name:e,from:"@ivujs/i-utils"}}},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
1
+ /*!
2
+ * @ivujs/i-utils v1.1.8
3
+ * Copyright 2021-2026, <gao911222@163.com>
4
+ * Released under the MIT License.
5
+ */
6
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).iUtils={})}(this,(function(e){"use strict";e.getGUID=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},e.getUUID=function(e=32,t=16){const o="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");let n,i=[];if(t=t||o.length,e)for(n=0;n<e;n++)i[n]=o[0|Math.random()*t];else{let e;for(i[8]=i[13]=i[18]=i[23]="-",i[14]="4",n=0;n<36;n++)i[n]||(e=0|16*Math.random(),i[n]=o[19===n?3&e|8:e])}return i.join("")},e.loadUtils=function(){console.log("Nice, iUtils loaded successfully!")},e.loadedTest=function(){console.log("Nice, iUtils loaded successfully!")}}));
2
7
  //# sourceMappingURL=index.full.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.full.umd.min.js","sources":["../../src/resolvers/index.ts"],"sourcesContent":["import type { Resolver, Options } from \"unplugin-auto-import/types\";\r\n\r\nexport function IUtilsResolver(options: Options = {}): Resolver {\r\n const api = [\"getUUID\", \"getGUID\", \"loadTest\"];\r\n return (name: string) => {\r\n if (api.includes(name)) {\r\n return {\r\n name,\r\n from: \"@ivujs/i-utils\",\r\n };\r\n }\r\n };\r\n}\r\n"],"names":["options","api","name","includes","from"],"mappings":"+PAEO,SAAwBA,EAAmB,IAChD,MAAMC,EAAM,CAAC,UAAW,UAAW,YACnC,OAAQC,IACN,GAAID,EAAIE,SAASD,GACf,MAAO,CACLA,OACAE,KAAM,iBAEV,CAEJ"}
1
+ {"version":3,"file":"index.full.umd.min.js","sources":["../../src/id/file:/D:/webWorks/i-utils/src/id/index.ts","../../src/file:/D:/webWorks/i-utils/src/index.ts"],"sourcesContent":["/**\r\n * 生成UUID\r\n * @param {Number} len 生成的长度,默认32位\r\n * @param {Number} radix 进制数,默认16进制\r\n * @example\r\n * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getUUID(len: number = 32, radix: number = 16): string {\r\n const CHARS = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\");\r\n let uuid = [],\r\n i;\r\n radix = radix || CHARS.length;\r\n if (len) {\r\n for (i = 0; i < len; i++) uuid[i] = CHARS[0 | (Math.random() * radix)];\r\n } else {\r\n let r;\r\n uuid[8] = uuid[13] = uuid[18] = uuid[23] = \"-\";\r\n uuid[14] = \"4\";\r\n for (i = 0; i < 36; i++) {\r\n if (!uuid[i]) {\r\n r = 0 | (Math.random() * 16);\r\n uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];\r\n }\r\n }\r\n }\r\n return uuid.join(\"\");\r\n}\r\n\r\n/**\r\n * 生成GUID\r\n * @example\r\n * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getGUID(): string {\r\n const s4 = function () {\r\n return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\r\n };\r\n return s4() + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + s4() + s4();\r\n}\r\n","// 测试加载成功方法\r\nexport function loadedTest(): void {\r\n console.log(\"Nice, iUtils loaded successfully!\");\r\n}\r\n\r\nexport function loadUtils(): void {\r\n console.log(\"Nice, iUtils loaded successfully!\");\r\n}\r\n\r\n// 生成id\r\nexport * from \"./id/index.ts\";\r\n"],"names":["s4","Math","random","toString","substring","len","radix","CHARS","split","i","uuid","length","r","join","console","log"],"mappings":";;;;;mQAoCE,MAAMA,EAAK,WACT,OAA+B,OAArB,EAAIC,KAAKC,UAAuB,GAAGC,SAAS,IAAIC,UAAU,EACtE,EACA,OAAOJ,IAAOA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAOA,IAAOA,GAClF,qBAhCwBK,EAAc,GAAIC,EAAgB,IACxD,MAAMC,EAAQ,iEAAiEC,MAAM,IACrF,IACEC,EADEC,EAAO,GAGX,GADAJ,EAAQA,GAASC,EAAMI,OACnBN,EACF,IAAKI,EAAI,EAAGA,EAAIJ,EAAKI,IAAKC,EAAKD,GAAKF,EAAM,EAAKN,KAAKC,SAAWI,OAC1D,CACL,IAAIM,EAGJ,IAFAF,EAAK,GAAKA,EAAK,IAAMA,EAAK,IAAMA,EAAK,IAAM,IAC3CA,EAAK,IAAM,IACND,EAAI,EAAGA,EAAI,GAAIA,IACbC,EAAKD,KACRG,EAAI,EAAqB,GAAhBX,KAAKC,SACdQ,EAAKD,GAAKF,EAAY,KAANE,EAAgB,EAAJG,EAAW,EAAMA,GAGnD,CACA,OAAOF,EAAKG,KAAK,GACnB,yBCrBEC,QAAQC,IAAI,oCACd,0BALED,QAAQC,IAAI,oCACd"}
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ function IUtilsResolver(options = {}) {
4
+ const api = ["getUUID", "getGUID", "loadTest"];
5
+ return (name) => {
6
+ if (api.includes(name)) {
7
+ return {
8
+ name,
9
+ from: "@ivujs/i-utils",
10
+ };
11
+ }
12
+ };
13
+ }
14
+
15
+ exports.IUtilsResolver = IUtilsResolver;
@@ -0,0 +1,13 @@
1
+ function IUtilsResolver(options = {}) {
2
+ const api = ["getUUID", "getGUID", "loadTest"];
3
+ return (name) => {
4
+ if (api.includes(name)) {
5
+ return {
6
+ name,
7
+ from: "@ivujs/i-utils",
8
+ };
9
+ }
10
+ };
11
+ }
12
+
13
+ export { IUtilsResolver };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ivujs/i-utils",
3
3
  "moduleName": "iUtils",
4
- "version": "1.1.6",
4
+ "version": "1.1.8",
5
5
  "type": "module",
6
6
  "description": "前端模块化 JavaScript 工具库",
7
7
  "author": "<gao911222@163.com>",
@@ -23,10 +23,10 @@
23
23
  "import": "./dist/es/index.mjs",
24
24
  "require": "./dist/cjs/index.cjs"
25
25
  },
26
- "./resolvers": {
27
- "types": "./dist/resolvers.d.ts",
28
- "import": "./dist/resolvers.mjs",
29
- "require": "./dist/resolvers.cjs"
26
+ "./resolver": {
27
+ "types": "./dist/resolver/index.d.ts",
28
+ "import": "./dist/resolver/index.mjs",
29
+ "require": "./dist/resolver/index.cjs"
30
30
  },
31
31
  "./es": {
32
32
  "types": "./dist/es/index.d.ts",
@@ -46,22 +46,31 @@
46
46
  "dev": "vite",
47
47
  "build": "tsx ./build/build.ts"
48
48
  },
49
+ "dependencies": {},
49
50
  "devDependencies": {
50
51
  "@eslint/js": "^9.39.2",
52
+ "@rollup/plugin-commonjs": "^29.0.0",
53
+ "@rollup/plugin-node-resolve": "^16.0.3",
51
54
  "@rollup/plugin-terser": "^0.4.4",
55
+ "@rollup/plugin-typescript": "^12.3.0",
52
56
  "@types/node": "^25.0.9",
53
57
  "chalk": "^5.6.2",
54
58
  "eslint": "^9.39.2",
59
+ "eslint-config-prettier": "^10.1.8",
55
60
  "eslint-plugin-prettier": "^5.5.5",
56
61
  "execa": "^9.6.1",
57
62
  "globals": "^17.0.0",
58
63
  "prettier": "^3.8.0",
64
+ "rimraf": "^6.1.2",
65
+ "rollup": "^4.55.1",
66
+ "rollup-plugin-dts": "^6.3.0",
67
+ "tslib": "^2.8.1",
59
68
  "tsx": "^4.21.0",
60
69
  "typescript": "^5.9.3",
61
70
  "typescript-eslint": "^8.53.0",
62
- "unplugin-auto-import": "^21.0.0",
63
71
  "vite": "^7.3.1",
64
- "vite-plugin-dts": "^4.5.4"
72
+ "vite-plugin-dts": "^4.5.4",
73
+ "unplugin-auto-import": "^21.0.0"
65
74
  },
66
75
  "keywords": [
67
76
  "i-utils",
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function IUtilsResolver(options = {}) {
4
- const api = ["getUUID", "getGUID", "loadTest"];
5
- return (name) => {
6
- if (api.includes(name)) {
7
- return {
8
- name,
9
- from: "@ivujs/i-utils"
10
- };
11
- }
12
- };
13
- }
14
- exports.IUtilsResolver = IUtilsResolver;
@@ -1,14 +0,0 @@
1
- function IUtilsResolver(options = {}) {
2
- const api = ["getUUID", "getGUID", "loadTest"];
3
- return (name) => {
4
- if (api.includes(name)) {
5
- return {
6
- name,
7
- from: "@ivujs/i-utils"
8
- };
9
- }
10
- };
11
- }
12
- export {
13
- IUtilsResolver
14
- };
@@ -1,2 +0,0 @@
1
- import type { Resolver, Options } from "unplugin-auto-import/types";
2
- export declare function IUtilsResolver(options?: Options): Resolver;
package/dist/resolves.cjs DELETED
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function IUtilsResolver(options = {}) {
4
- const api = ["getUUID", "getGUID", "loadTest"];
5
- return (name) => {
6
- if (api.includes(name)) {
7
- return {
8
- name,
9
- from: "@ivujs/i-utils"
10
- };
11
- }
12
- };
13
- }
14
- exports.IUtilsResolver = IUtilsResolver;
package/dist/resolves.mjs DELETED
@@ -1,14 +0,0 @@
1
- function IUtilsResolver(options = {}) {
2
- const api = ["getUUID", "getGUID", "loadTest"];
3
- return (name) => {
4
- if (api.includes(name)) {
5
- return {
6
- name,
7
- from: "@ivujs/i-utils"
8
- };
9
- }
10
- };
11
- }
12
- export {
13
- IUtilsResolver
14
- };
File without changes