knex-utils
Version:
Useful utilities for Knex.js
9 lines (8 loc) • 1.04 kB
TypeScript
export declare function copyWithoutUndefined<T extends Record<K, V>, K extends string | number | symbol, V>(originalValue: T): T;
export declare function pick<T extends object, K extends string | number | symbol>(source: T, propNames: readonly K[]): Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>;
export declare function pickWithoutUndefined<T, K extends string | number | symbol>(source: T, propNames: readonly K[]): Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>;
export declare function validateOnlyWhitelistedFields<T extends object>(source: T, propNames: readonly string[]): void;
export declare function validateOnlyWhitelistedFieldsSet(source: Record<string, any>, propNames: Set<string>): void;
export declare function strictPickWithoutUndefined<T extends object>(source: T, propNames: readonly string[]): Pick<T, Exclude<keyof T, Exclude<keyof T, string>>>;
export declare function isEmptyObject(params: Record<string, any>): boolean;
export declare function groupBy<T>(inputArray: T[], propName: string): Record<string, T[]>;