move stuff around until it feels right
This commit is contained in:
14
helpers/pick.ts
Normal file
14
helpers/pick.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// eslint-disable-next-line import/no-unused-modules
|
||||
export function pick<T, K extends keyof T>(
|
||||
object: T,
|
||||
...keys: K[]
|
||||
): Pick<T, K> {
|
||||
const result: any = {}
|
||||
for (const key of keys) {
|
||||
const value = object[key]
|
||||
if (value !== undefined) {
|
||||
result[key] = value
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user