chore: workspace improvements (#282)

This commit is contained in:
rahim
2026-01-04 01:39:26 +11:00
committed by GitHub
parent d74e4e6701
commit 2901593085
77 changed files with 2085 additions and 573 deletions
+18
View File
@@ -0,0 +1,18 @@
/**
* Creates a new object with only the specified keys.
*
* @example
* const obj = { a: 1, b: 2, c: 3 };
* pick(obj, ['a', 'c']); // { a: 1, c: 3 }
*/
export function pick<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: readonly K[]): Pick<T, K> {
const result = {} as Pick<T, K>;
for (const key of keys) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
result[key] = obj[key];
}
}
return result;
}