mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-08-20 10:59:46 +08:00
chore: add pick utils
This commit is contained in:
parent
ddce2afb4d
commit
28f2fe340c
@ -33,3 +33,10 @@ export function get(object: any, path: string): any {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function pick(obj: Record<string, any>, keys: string[]) {
|
||||||
|
return keys.reduce((ret, key) => {
|
||||||
|
ret[key] = obj[key];
|
||||||
|
return ret;
|
||||||
|
}, {} as Record<string, any>);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user