xshell 1.2.52 → 1.2.54
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/package.json +1 -1
- package/utils.browser.d.ts +3 -1
- package/utils.browser.js +4 -0
- package/utils.d.ts +3 -1
- package/utils.js +4 -0
package/package.json
CHANGED
package/utils.browser.d.ts
CHANGED
|
@@ -19,7 +19,9 @@ export declare function zip_object<TValue>(keys: (string | number)[], values: TV
|
|
|
19
19
|
/** 映射对象中的 keys, 返回新对象
|
|
20
20
|
- obj: 对象
|
|
21
21
|
- mapper?: `to_snake_case` (key: string) => string 或者 Record<string, string> */
|
|
22
|
-
export declare function map_keys<TReturn>(obj: any, mapper?: (key: string) => string | Record<string, string>): TReturn;
|
|
22
|
+
export declare function map_keys<TReturn>(obj: any, mapper?: ((key: string) => string) | Record<string, string>): TReturn;
|
|
23
|
+
/** 返回一个映射对象 keys 的函数,通常和 .map 函数一起使用 */
|
|
24
|
+
export declare function get_key_mapper<TReturn>(mapper?: ((key: string) => string) | Record<string, string>): (obj: any) => TReturn;
|
|
23
25
|
/** 过滤对象中的 values, 返回新对象
|
|
24
26
|
- obj
|
|
25
27
|
- filter?: `not_empty` */
|
package/utils.browser.js
CHANGED
|
@@ -64,6 +64,10 @@ export function map_keys(obj, mapper = to_snake_case) {
|
|
|
64
64
|
:
|
|
65
65
|
([key, value]) => [mapper[key] || key, value]));
|
|
66
66
|
}
|
|
67
|
+
/** 返回一个映射对象 keys 的函数,通常和 .map 函数一起使用 */
|
|
68
|
+
export function get_key_mapper(mapper = to_snake_case) {
|
|
69
|
+
return (obj) => map_keys(obj, mapper);
|
|
70
|
+
}
|
|
67
71
|
/** 过滤对象中的 values, 返回新对象
|
|
68
72
|
- obj
|
|
69
73
|
- filter?: `not_empty` */
|
package/utils.d.ts
CHANGED
|
@@ -28,7 +28,9 @@ export declare function zip_object<TValue>(keys: (string | number)[], values: TV
|
|
|
28
28
|
/** 映射对象中的 keys, 返回新对象
|
|
29
29
|
- obj: 对象
|
|
30
30
|
- mapper?: `to_snake_case` (key: string) => string 或者 Record<string, string> */
|
|
31
|
-
export declare function map_keys<TReturn>(obj: any, mapper?: (key: string) => string | Record<string, string>): TReturn;
|
|
31
|
+
export declare function map_keys<TReturn>(obj: any, mapper?: ((key: string) => string) | Record<string, string>): TReturn;
|
|
32
|
+
/** 返回一个映射对象 keys 的函数,通常和 .map 函数一起使用 */
|
|
33
|
+
export declare function get_key_mapper<TReturn>(mapper?: ((key: string) => string) | Record<string, string>): (obj: any) => TReturn;
|
|
32
34
|
/** 映射对象中的 values, 返回新对象 */
|
|
33
35
|
export declare function map_values<TValue, TNewValue>(obj: {
|
|
34
36
|
[key: string]: TValue;
|
package/utils.js
CHANGED
|
@@ -91,6 +91,10 @@ export function map_keys(obj, mapper = to_snake_case) {
|
|
|
91
91
|
:
|
|
92
92
|
([key, value]) => [mapper[key] || key, value]));
|
|
93
93
|
}
|
|
94
|
+
/** 返回一个映射对象 keys 的函数,通常和 .map 函数一起使用 */
|
|
95
|
+
export function get_key_mapper(mapper = to_snake_case) {
|
|
96
|
+
return (obj) => map_keys(obj, mapper);
|
|
97
|
+
}
|
|
94
98
|
/** 映射对象中的 values, 返回新对象 */
|
|
95
99
|
export function map_values(obj, mapper) {
|
|
96
100
|
return Object.fromEntries(Object.entries(obj)
|