@fangzhongya/utils 0.0.28 → 0.0.30

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.
@@ -3,7 +3,10 @@
3
3
  var _chunkVYOTXPMMcjs = require('./chunk-VYOTXPMM.cjs');
4
4
 
5
5
 
6
- var _chunkUX6A432Fcjs = require('./chunk-UX6A432F.cjs');
6
+
7
+
8
+
9
+ var _chunkZRO5GHYVcjs = require('./chunk-ZRO5GHYV.cjs');
7
10
 
8
11
 
9
12
  var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
@@ -12,7 +15,10 @@ var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
12
15
  var window_exports = {};
13
16
  _chunk75ZPJI57cjs.__export.call(void 0, window_exports, {
14
17
  copy: () => _chunkVYOTXPMMcjs.copy,
15
- getParam: () => _chunkUX6A432Fcjs.getParam
18
+ getAllParams: () => _chunkZRO5GHYVcjs.getAllParams,
19
+ getParam: () => _chunkZRO5GHYVcjs.getParam,
20
+ getUrlParam: () => _chunkZRO5GHYVcjs.getUrlParam,
21
+ getUrlParams: () => _chunkZRO5GHYVcjs.getUrlParams
16
22
  });
17
23
 
18
24
 
@@ -0,0 +1,35 @@
1
+ // packages/window/getParam.ts
2
+ function getParam(URL) {
3
+ URL = JSON.parse(
4
+ '{"' + decodeURI(URL.split("?")[1]).replace(/"/g, '"').replace(/&/g, '","').replace(/=/g, '":"') + '"}'
5
+ );
6
+ return JSON.stringify(URL);
7
+ }
8
+ function getUrlParams() {
9
+ const hash = window.location.href;
10
+ const questionMarkIndex = hash.indexOf("?");
11
+ if (questionMarkIndex === -1) {
12
+ return new URLSearchParams();
13
+ }
14
+ const queryString = hash.substring(questionMarkIndex + 1);
15
+ return new URLSearchParams(queryString);
16
+ }
17
+ function getUrlParam(name) {
18
+ const params = getUrlParams();
19
+ return params.get(name);
20
+ }
21
+ function getAllParams() {
22
+ const params = getUrlParams();
23
+ const result = {};
24
+ for (const [key, value] of params.entries()) {
25
+ result[key] = value;
26
+ }
27
+ return result;
28
+ }
29
+
30
+ export {
31
+ getParam,
32
+ getUrlParams,
33
+ getUrlParam,
34
+ getAllParams
35
+ };
@@ -2,8 +2,11 @@ import {
2
2
  copy
3
3
  } from "./chunk-W45DTA4D.js";
4
4
  import {
5
- getParam
6
- } from "./chunk-VCZ62DR2.js";
5
+ getAllParams,
6
+ getParam,
7
+ getUrlParam,
8
+ getUrlParams
9
+ } from "./chunk-MCT2IB67.js";
7
10
  import {
8
11
  __export
9
12
  } from "./chunk-MLKGABMK.js";
@@ -12,7 +15,10 @@ import {
12
15
  var window_exports = {};
13
16
  __export(window_exports, {
14
17
  copy: () => copy,
15
- getParam: () => getParam
18
+ getAllParams: () => getAllParams,
19
+ getParam: () => getParam,
20
+ getUrlParam: () => getUrlParam,
21
+ getUrlParams: () => getUrlParams
16
22
  });
17
23
 
18
24
  export {
@@ -0,0 +1,35 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/window/getParam.ts
2
+ function getParam(URL) {
3
+ URL = JSON.parse(
4
+ '{"' + decodeURI(URL.split("?")[1]).replace(/"/g, '"').replace(/&/g, '","').replace(/=/g, '":"') + '"}'
5
+ );
6
+ return JSON.stringify(URL);
7
+ }
8
+ function getUrlParams() {
9
+ const hash = window.location.href;
10
+ const questionMarkIndex = hash.indexOf("?");
11
+ if (questionMarkIndex === -1) {
12
+ return new URLSearchParams();
13
+ }
14
+ const queryString = hash.substring(questionMarkIndex + 1);
15
+ return new URLSearchParams(queryString);
16
+ }
17
+ function getUrlParam(name) {
18
+ const params = getUrlParams();
19
+ return params.get(name);
20
+ }
21
+ function getAllParams() {
22
+ const params = getUrlParams();
23
+ const result = {};
24
+ for (const [key, value] of params.entries()) {
25
+ result[key] = value;
26
+ }
27
+ return result;
28
+ }
29
+
30
+
31
+
32
+
33
+
34
+
35
+ exports.getParam = getParam; exports.getUrlParams = getUrlParams; exports.getUrlParam = getUrlParam; exports.getAllParams = getAllParams;
@@ -0,0 +1,13 @@
1
+ import { copy } from './window/copy.cjs';
2
+ import { getAllParams, getParam, getUrlParam, getUrlParams } from './window/getParam.cjs';
3
+
4
+ declare const index_copy: typeof copy;
5
+ declare const index_getAllParams: typeof getAllParams;
6
+ declare const index_getParam: typeof getParam;
7
+ declare const index_getUrlParam: typeof getUrlParam;
8
+ declare const index_getUrlParams: typeof getUrlParams;
9
+ declare namespace index {
10
+ export { index_copy as copy, index_getAllParams as getAllParams, index_getParam as getParam, index_getUrlParam as getUrlParam, index_getUrlParams as getUrlParams };
11
+ }
12
+
13
+ export { index as i };
@@ -0,0 +1,13 @@
1
+ import { copy } from './window/copy.js';
2
+ import { getAllParams, getParam, getUrlParam, getUrlParams } from './window/getParam.js';
3
+
4
+ declare const index_copy: typeof copy;
5
+ declare const index_getAllParams: typeof getAllParams;
6
+ declare const index_getParam: typeof getParam;
7
+ declare const index_getUrlParam: typeof getUrlParam;
8
+ declare const index_getUrlParams: typeof getUrlParams;
9
+ declare namespace index {
10
+ export { index_copy as copy, index_getAllParams as getAllParams, index_getParam as getParam, index_getUrlParam as getUrlParam, index_getUrlParams as getUrlParams };
11
+ }
12
+
13
+ export { index as i };
package/dist/index.cjs CHANGED
@@ -4,9 +4,9 @@ var _chunkJZQA6OH4cjs = require('./chunk-JZQA6OH4.cjs');
4
4
  require('./chunk-3ERQHPTD.cjs');
5
5
 
6
6
 
7
- var _chunkVCQOLLVKcjs = require('./chunk-VCQOLLVK.cjs');
7
+ var _chunk5WEKCLPKcjs = require('./chunk-5WEKCLPK.cjs');
8
8
  require('./chunk-VYOTXPMM.cjs');
9
- require('./chunk-UX6A432F.cjs');
9
+ require('./chunk-ZRO5GHYV.cjs');
10
10
  require('./chunk-27WA7EI2.cjs');
11
11
  require('./chunk-43VE3KXL.cjs');
12
12
  require('./chunk-NESVPZNF.cjs');
@@ -140,4 +140,4 @@ require('./chunk-75ZPJI57.cjs');
140
140
 
141
141
 
142
142
 
143
- exports.basic = _chunkCS3E5UZ2cjs.basic_exports; exports.css = _chunkXDTLZL44cjs.css_exports; exports.date = _chunkFVQTU3A7cjs.date_exports; exports.dom = _chunkKNTGZRPDcjs.dom_exports; exports.html = _chunkQN6KZWKMcjs.html_exports; exports.iss = _chunkIJDVZOVJcjs.iss_exports; exports.judge = _chunkUHKL2RG3cjs.judge_exports; exports.load = _chunkXXS5G6S6cjs.load_exports; exports.log = _chunkHUKQYAV6cjs.log_exports; exports.name = _chunkBG2YS767cjs.name_exports; exports.node = _chunkV6PYRA4Acjs.node_exports; exports.tree = _chunkPV2N6PF2cjs.tree_exports; exports.urls = _chunkJZQA6OH4cjs.urls_exports; exports.window = _chunkVCQOLLVKcjs.window_exports;
143
+ exports.basic = _chunkCS3E5UZ2cjs.basic_exports; exports.css = _chunkXDTLZL44cjs.css_exports; exports.date = _chunkFVQTU3A7cjs.date_exports; exports.dom = _chunkKNTGZRPDcjs.dom_exports; exports.html = _chunkQN6KZWKMcjs.html_exports; exports.iss = _chunkIJDVZOVJcjs.iss_exports; exports.judge = _chunkUHKL2RG3cjs.judge_exports; exports.load = _chunkXXS5G6S6cjs.load_exports; exports.log = _chunkHUKQYAV6cjs.log_exports; exports.name = _chunkBG2YS767cjs.name_exports; exports.node = _chunkV6PYRA4Acjs.node_exports; exports.tree = _chunkPV2N6PF2cjs.tree_exports; exports.urls = _chunkJZQA6OH4cjs.urls_exports; exports.window = _chunk5WEKCLPKcjs.window_exports;
package/dist/index.d.cts CHANGED
@@ -11,7 +11,7 @@ export { i as name } from './index-BbrWO_KD.cjs';
11
11
  export { i as node } from './index-CK2c-6vv.cjs';
12
12
  export { i as tree } from './index-cuR7l2XV.cjs';
13
13
  export { i as urls } from './index--yFTfMpc.cjs';
14
- export { i as window } from './index-C1jaHioq.cjs';
14
+ export { i as window } from './index-DAi9PP0w.cjs';
15
15
  import './index-qUiGxoy_.cjs';
16
16
  import './basic/array/asyncMergeArray.cjs';
17
17
  import './basic/array/deleteArray.cjs';
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export { i as name } from './index-CS54GrWo.js';
11
11
  export { i as node } from './index-BocAlCa8.js';
12
12
  export { i as tree } from './index-CPO1AFVg.js';
13
13
  export { i as urls } from './index-CLnASTZ5.js';
14
- export { i as window } from './index-Q-ggiBiZ.js';
14
+ export { i as window } from './index-vCPDFXBq.js';
15
15
  import './index-C29DFVeC.js';
16
16
  import './basic/array/asyncMergeArray.js';
17
17
  import './basic/array/deleteArray.js';
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  import "./chunk-BDJORZRC.js";
5
5
  import {
6
6
  window_exports
7
- } from "./chunk-5M5OM6N6.js";
7
+ } from "./chunk-TERIHBSO.js";
8
8
  import "./chunk-W45DTA4D.js";
9
- import "./chunk-VCZ62DR2.js";
9
+ import "./chunk-MCT2IB67.js";
10
10
  import "./chunk-XBZX5YZW.js";
11
11
  import "./chunk-YYWENXJO.js";
12
12
  import "./chunk-3NBXSBFM.js";
@@ -1,7 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkUX6A432Fcjs = require('../chunk-UX6A432F.cjs');
3
+
4
+
5
+
6
+ var _chunkZRO5GHYVcjs = require('../chunk-ZRO5GHYV.cjs');
4
7
  require('../chunk-75ZPJI57.cjs');
5
8
 
6
9
 
7
- exports.getParam = _chunkUX6A432Fcjs.getParam;
10
+
11
+
12
+
13
+ exports.getAllParams = _chunkZRO5GHYVcjs.getAllParams; exports.getParam = _chunkZRO5GHYVcjs.getParam; exports.getUrlParam = _chunkZRO5GHYVcjs.getUrlParam; exports.getUrlParams = _chunkZRO5GHYVcjs.getUrlParams;
@@ -2,5 +2,8 @@
2
2
  * 获取url中参数
3
3
  */
4
4
  declare function getParam(URL: string): string;
5
+ declare function getUrlParams(): URLSearchParams;
6
+ declare function getUrlParam(name: string): string | null;
7
+ declare function getAllParams(): Record<string, string>;
5
8
 
6
- export { getParam };
9
+ export { getAllParams, getParam, getUrlParam, getUrlParams };
@@ -2,5 +2,8 @@
2
2
  * 获取url中参数
3
3
  */
4
4
  declare function getParam(URL: string): string;
5
+ declare function getUrlParams(): URLSearchParams;
6
+ declare function getUrlParam(name: string): string | null;
7
+ declare function getAllParams(): Record<string, string>;
5
8
 
6
- export { getParam };
9
+ export { getAllParams, getParam, getUrlParam, getUrlParams };
@@ -1,7 +1,13 @@
1
1
  import {
2
- getParam
3
- } from "../chunk-VCZ62DR2.js";
2
+ getAllParams,
3
+ getParam,
4
+ getUrlParam,
5
+ getUrlParams
6
+ } from "../chunk-MCT2IB67.js";
4
7
  import "../chunk-MLKGABMK.js";
5
8
  export {
6
- getParam
9
+ getAllParams,
10
+ getParam,
11
+ getUrlParam,
12
+ getUrlParams
7
13
  };
@@ -1,12 +1,18 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-VCQOLLVK.cjs');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-5WEKCLPK.cjs');
2
2
 
3
3
 
4
4
  var _chunkVYOTXPMMcjs = require('../chunk-VYOTXPMM.cjs');
5
5
 
6
6
 
7
- var _chunkUX6A432Fcjs = require('../chunk-UX6A432F.cjs');
7
+
8
+
9
+
10
+ var _chunkZRO5GHYVcjs = require('../chunk-ZRO5GHYV.cjs');
8
11
  require('../chunk-75ZPJI57.cjs');
9
12
 
10
13
 
11
14
 
12
- exports.copy = _chunkVYOTXPMMcjs.copy; exports.getParam = _chunkUX6A432Fcjs.getParam;
15
+
16
+
17
+
18
+ exports.copy = _chunkVYOTXPMMcjs.copy; exports.getAllParams = _chunkZRO5GHYVcjs.getAllParams; exports.getParam = _chunkZRO5GHYVcjs.getParam; exports.getUrlParam = _chunkZRO5GHYVcjs.getUrlParam; exports.getUrlParams = _chunkZRO5GHYVcjs.getUrlParams;
@@ -1,2 +1,2 @@
1
1
  export { copy } from './copy.cjs';
2
- export { getParam } from './getParam.cjs';
2
+ export { getAllParams, getParam, getUrlParam, getUrlParams } from './getParam.cjs';
@@ -1,2 +1,2 @@
1
1
  export { copy } from './copy.js';
2
- export { getParam } from './getParam.js';
2
+ export { getAllParams, getParam, getUrlParam, getUrlParams } from './getParam.js';
@@ -1,12 +1,18 @@
1
- import "../chunk-5M5OM6N6.js";
1
+ import "../chunk-TERIHBSO.js";
2
2
  import {
3
3
  copy
4
4
  } from "../chunk-W45DTA4D.js";
5
5
  import {
6
- getParam
7
- } from "../chunk-VCZ62DR2.js";
6
+ getAllParams,
7
+ getParam,
8
+ getUrlParam,
9
+ getUrlParams
10
+ } from "../chunk-MCT2IB67.js";
8
11
  import "../chunk-MLKGABMK.js";
9
12
  export {
10
13
  copy,
11
- getParam
14
+ getAllParams,
15
+ getParam,
16
+ getUrlParam,
17
+ getUrlParams
12
18
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fangzhongya/utils",
3
3
  "private": false,
4
4
  "type": "module",
5
- "version": "0.0.28",
5
+ "version": "0.0.30",
6
6
  "description ": "个人工具库",
7
7
  "author": "fangzhongya ",
8
8
  "license": "MIT",
@@ -18,12 +18,12 @@
18
18
  "registry": "https://registry.npmjs.org/"
19
19
  },
20
20
  "devDependencies": {
21
- "@fangzhongya/create": "0.2.23",
22
- "@types/node": "^24.0.15",
21
+ "@fangzhongya/create": "0.2.34",
22
+ "@types/node": "^24.5.2",
23
23
  "ts-node": "^10.9.2",
24
24
  "tsup": "^8.5.0",
25
- "typescript": "^5.8.3",
26
- "vite": "^7.0.5",
25
+ "typescript": "^5.9.2",
26
+ "vite": "^7.1.7",
27
27
  "vitest": "^3.2.4"
28
28
  },
29
29
  "files": [
@@ -1,11 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/window/getParam.ts
2
- function getParam(URL) {
3
- URL = JSON.parse(
4
- '{"' + decodeURI(URL.split("?")[1]).replace(/"/g, '"').replace(/&/g, '","').replace(/=/g, '":"') + '"}'
5
- );
6
- return JSON.stringify(URL);
7
- }
8
-
9
-
10
-
11
- exports.getParam = getParam;
@@ -1,11 +0,0 @@
1
- // packages/window/getParam.ts
2
- function getParam(URL) {
3
- URL = JSON.parse(
4
- '{"' + decodeURI(URL.split("?")[1]).replace(/"/g, '"').replace(/&/g, '","').replace(/=/g, '":"') + '"}'
5
- );
6
- return JSON.stringify(URL);
7
- }
8
-
9
- export {
10
- getParam
11
- };
@@ -1,10 +0,0 @@
1
- import { copy } from './window/copy.cjs';
2
- import { getParam } from './window/getParam.cjs';
3
-
4
- declare const index_copy: typeof copy;
5
- declare const index_getParam: typeof getParam;
6
- declare namespace index {
7
- export { index_copy as copy, index_getParam as getParam };
8
- }
9
-
10
- export { index as i };
@@ -1,10 +0,0 @@
1
- import { copy } from './window/copy.js';
2
- import { getParam } from './window/getParam.js';
3
-
4
- declare const index_copy: typeof copy;
5
- declare const index_getParam: typeof getParam;
6
- declare namespace index {
7
- export { index_copy as copy, index_getParam as getParam };
8
- }
9
-
10
- export { index as i };