@daysnap/utils 0.0.83 → 0.0.85

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/es/index.d.ts CHANGED
@@ -77,6 +77,7 @@ export * from './isWindow';
77
77
  export * from './kebabCase';
78
78
  export * from './listGenerator';
79
79
  export * from './mousewheel';
80
+ export * from './nf';
80
81
  export * from './normalizePath';
81
82
  export * from './omit';
82
83
  export * from './padding';
@@ -85,6 +86,7 @@ export * from './parseError';
85
86
  export * from './parseObject';
86
87
  export * from './parsePath';
87
88
  export * from './parseQuery';
89
+ export * from './parseQueryString';
88
90
  export * from './pascalCase';
89
91
  export * from './pick';
90
92
  export * from './replaceCrlf';
@@ -98,6 +100,7 @@ export * from './splitArray';
98
100
  export * from './storage';
99
101
  export * from './stringTrim';
100
102
  export * from './stringifyQuery';
103
+ export * from './stringifyQueryString';
101
104
  export * from './throttle';
102
105
  export * from './toCDB';
103
106
  export * from './toDBC';
package/es/index.js CHANGED
@@ -78,6 +78,7 @@ export * from './isWindow';
78
78
  export * from './kebabCase';
79
79
  export * from './listGenerator';
80
80
  export * from './mousewheel';
81
+ export * from './nf';
81
82
  export * from './normalizePath';
82
83
  export * from './omit';
83
84
  export * from './padding';
@@ -86,6 +87,7 @@ export * from './parseError';
86
87
  export * from './parseObject';
87
88
  export * from './parsePath';
88
89
  export * from './parseQuery';
90
+ export * from './parseQueryString';
89
91
  export * from './pascalCase';
90
92
  export * from './pick';
91
93
  export * from './replaceCrlf';
@@ -99,6 +101,7 @@ export * from './splitArray';
99
101
  export * from './storage';
100
102
  export * from './stringTrim';
101
103
  export * from './stringifyQuery';
104
+ export * from './stringifyQueryString';
102
105
  export * from './throttle';
103
106
  export * from './toCDB';
104
107
  export * from './toDBC';
package/es/nf.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 空函数
3
+ */
4
+ export declare function nf(): void;
package/es/nf.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 空函数
3
+ */
4
+ export function nf() {
5
+ // 空函数
6
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 解析 url 参数
3
+ *
4
+ * 在不支持 URLSearchParams 的环境下使用该方法
5
+ */
6
+ export declare function parseQueryString<T extends Record<string, any>>(value: string): T;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 解析 url 参数
3
+ *
4
+ * 在不支持 URLSearchParams 的环境下使用该方法
5
+ */
6
+ export function parseQueryString(value) {
7
+ return decodeURIComponent(value)
8
+ .split('&')
9
+ .reduce((res, item) => {
10
+ const [key, value] = item.split('=');
11
+ res[key] = value;
12
+ return res;
13
+ }, {});
14
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 将对象转换为查询字符串
3
+ *
4
+ * 在不支持 URLSearchParams 的环境下使用该方法
5
+ */
6
+ export declare function stringifyQueryString(value: Record<string, any>): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 将对象转换为查询字符串
3
+ *
4
+ * 在不支持 URLSearchParams 的环境下使用该方法
5
+ */
6
+ export function stringifyQueryString(value) {
7
+ return Object.keys(value)
8
+ .reduce((res, k) => {
9
+ res.push(`${k}=${value[k]}`);
10
+ return res;
11
+ }, [])
12
+ .join('&');
13
+ }
package/lib/index.d.ts CHANGED
@@ -77,6 +77,7 @@ export * from './isWindow';
77
77
  export * from './kebabCase';
78
78
  export * from './listGenerator';
79
79
  export * from './mousewheel';
80
+ export * from './nf';
80
81
  export * from './normalizePath';
81
82
  export * from './omit';
82
83
  export * from './padding';
@@ -85,6 +86,7 @@ export * from './parseError';
85
86
  export * from './parseObject';
86
87
  export * from './parsePath';
87
88
  export * from './parseQuery';
89
+ export * from './parseQueryString';
88
90
  export * from './pascalCase';
89
91
  export * from './pick';
90
92
  export * from './replaceCrlf';
@@ -98,6 +100,7 @@ export * from './splitArray';
98
100
  export * from './storage';
99
101
  export * from './stringTrim';
100
102
  export * from './stringifyQuery';
103
+ export * from './stringifyQueryString';
101
104
  export * from './throttle';
102
105
  export * from './toCDB';
103
106
  export * from './toDBC';
package/lib/index.js CHANGED
@@ -94,6 +94,7 @@ __exportStar(require("./isWindow"), exports);
94
94
  __exportStar(require("./kebabCase"), exports);
95
95
  __exportStar(require("./listGenerator"), exports);
96
96
  __exportStar(require("./mousewheel"), exports);
97
+ __exportStar(require("./nf"), exports);
97
98
  __exportStar(require("./normalizePath"), exports);
98
99
  __exportStar(require("./omit"), exports);
99
100
  __exportStar(require("./padding"), exports);
@@ -102,6 +103,7 @@ __exportStar(require("./parseError"), exports);
102
103
  __exportStar(require("./parseObject"), exports);
103
104
  __exportStar(require("./parsePath"), exports);
104
105
  __exportStar(require("./parseQuery"), exports);
106
+ __exportStar(require("./parseQueryString"), exports);
105
107
  __exportStar(require("./pascalCase"), exports);
106
108
  __exportStar(require("./pick"), exports);
107
109
  __exportStar(require("./replaceCrlf"), exports);
@@ -115,6 +117,7 @@ __exportStar(require("./splitArray"), exports);
115
117
  __exportStar(require("./storage"), exports);
116
118
  __exportStar(require("./stringTrim"), exports);
117
119
  __exportStar(require("./stringifyQuery"), exports);
120
+ __exportStar(require("./stringifyQueryString"), exports);
118
121
  __exportStar(require("./throttle"), exports);
119
122
  __exportStar(require("./toCDB"), exports);
120
123
  __exportStar(require("./toDBC"), exports);
package/lib/nf.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 空函数
3
+ */
4
+ export declare function nf(): void;
package/lib/nf.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nf = void 0;
4
+ /**
5
+ * 空函数
6
+ */
7
+ function nf() {
8
+ // 空函数
9
+ }
10
+ exports.nf = nf;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 解析 url 参数
3
+ *
4
+ * 在不支持 URLSearchParams 的环境下使用该方法
5
+ */
6
+ export declare function parseQueryString<T extends Record<string, any>>(value: string): T;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseQueryString = void 0;
4
+ /**
5
+ * 解析 url 参数
6
+ *
7
+ * 在不支持 URLSearchParams 的环境下使用该方法
8
+ */
9
+ function parseQueryString(value) {
10
+ return decodeURIComponent(value)
11
+ .split('&')
12
+ .reduce((res, item) => {
13
+ const [key, value] = item.split('=');
14
+ res[key] = value;
15
+ return res;
16
+ }, {});
17
+ }
18
+ exports.parseQueryString = parseQueryString;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 将对象转换为查询字符串
3
+ *
4
+ * 在不支持 URLSearchParams 的环境下使用该方法
5
+ */
6
+ export declare function stringifyQueryString(value: Record<string, any>): string;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringifyQueryString = void 0;
4
+ /**
5
+ * 将对象转换为查询字符串
6
+ *
7
+ * 在不支持 URLSearchParams 的环境下使用该方法
8
+ */
9
+ function stringifyQueryString(value) {
10
+ return Object.keys(value)
11
+ .reduce((res, k) => {
12
+ res.push(`${k}=${value[k]}`);
13
+ return res;
14
+ }, [])
15
+ .join('&');
16
+ }
17
+ exports.stringifyQueryString = stringifyQueryString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daysnap/utils",
3
- "version": "0.0.83",
3
+ "version": "0.0.85",
4
4
  "description": "通用的工具库",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",