Comparing version 0.1.5 to 0.1.6
/// <reference types="node" resolution-mode="require"/> | ||
import type * as FS from 'fs'; | ||
export declare function filterObject<O extends object, R extends object>(object: O, predicate: (key: keyof O, value: O[keyof O]) => boolean): R; | ||
export declare function pick<T extends object, K extends keyof T>(object: T, ...keys: readonly K[] | readonly K[][]): Pick<T, K>; | ||
export declare function omit<T extends object, K extends keyof T>(object: T, ...keys: readonly K[] | readonly K[][]): Omit<T, K>; | ||
export declare function pick<T extends object, K extends keyof T>(object: T, ...keys: readonly K[] | readonly (readonly K[])[]): Pick<T, K>; | ||
export declare function omit<T extends object, K extends keyof T>(object: T, ...keys: readonly K[] | readonly (readonly K[])[]): Omit<T, K>; | ||
export declare function assignWithDefaults<To extends object, From extends Partial<To>>(to: To, from: From, defaults?: Partial<To>): void; | ||
@@ -7,0 +7,0 @@ export declare function isJSON(str: string): boolean; |
{ | ||
"name": "utilium", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Typescript utilies", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -8,7 +8,7 @@ import type * as FS from 'fs'; | ||
export function pick<T extends object, K extends keyof T>(object: T, ...keys: readonly K[] | readonly K[][]): Pick<T, K> { | ||
export function pick<T extends object, K extends keyof T>(object: T, ...keys: readonly K[] | readonly (readonly K[])[]): Pick<T, K> { | ||
return filterObject<T, Pick<T, K>>(object, (key: K) => keys.flat().includes(key)); | ||
} | ||
export function omit<T extends object, K extends keyof T>(object: T, ...keys: readonly K[] | readonly K[][]): Omit<T, K> { | ||
export function omit<T extends object, K extends keyof T>(object: T, ...keys: readonly K[] | readonly (readonly K[])[]): Omit<T, K> { | ||
return filterObject<T, Omit<T, K>>(object, (key: K) => !keys.flat().includes(key)); | ||
@@ -15,0 +15,0 @@ } |
25090