xshell 1.2.60 → 1.2.62
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 +9 -9
- package/prototype.js +8 -3
- package/react.development.js +1 -1
- package/react.development.js.map +1 -1
- package/react.production.js +118 -118
- package/react.production.js.map +1 -1
- package/utils.common.d.ts +2 -0
- package/utils.common.js +7 -0
package/utils.common.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ export declare function filter_keys<TObj>(obj: TObj, filter: (key: string) => an
|
|
|
45
45
|
- obj
|
|
46
46
|
- filter?: `not_empty` */
|
|
47
47
|
export declare function filter_values<TObj extends Record<string, any>>(obj: TObj, filter?: (value: TObj[string]) => any): TObj;
|
|
48
|
+
/** 简单选择对象中的部分 keys, 返回新对象 */
|
|
49
|
+
export declare function pick<TObject>(obj: TObject, keys: string[]): Partial<TObject>;
|
|
48
50
|
/** 忽略对象中的 keys, 返回新对象 */
|
|
49
51
|
export declare function omit<TObj>(obj: TObj, omit_keys: string[]): TObj;
|
|
50
52
|
/** 模糊过滤字符串列表或对象列表,常用于根据用户输入补全或搜索过滤
|
package/utils.common.js
CHANGED
|
@@ -123,6 +123,13 @@ export function filter_values(obj, filter = not_empty) {
|
|
|
123
123
|
return Object.fromEntries(Object.entries(obj)
|
|
124
124
|
.filter(([, value]) => filter(value)));
|
|
125
125
|
}
|
|
126
|
+
/** 简单选择对象中的部分 keys, 返回新对象 */
|
|
127
|
+
export function pick(obj, keys) {
|
|
128
|
+
return keys.reduce((acc, key) => {
|
|
129
|
+
acc[key] = obj[key];
|
|
130
|
+
return acc;
|
|
131
|
+
}, {});
|
|
132
|
+
}
|
|
126
133
|
/** 忽略对象中的 keys, 返回新对象 */
|
|
127
134
|
export function omit(obj, omit_keys) {
|
|
128
135
|
const omit_keys_ = new Set(omit_keys);
|