UNPKG

corde

Version:

A simple library for Discord bot tests

39 lines (38 loc) 908 B
declare type KeyValue = { [key: string]: any; }; declare type PartialWithAnyValue<T> = Partial<T> & KeyValue; /** * Verify if a `sample` object matches with properties of a `holder` object. * * @example * * const objA = { * abc: 1 * } * * // matches with * * const objB = { * abc: 1, * a: 2 * } * * isPartialOf(objA, objB); // True * * // Because objA has property abc, which exists in objB too. * // But the follow example fails * * isPartialOf(objB, objA); // False * * // It fails because property 'a' does not exists in objA. * * @param sample Partial object of `holder` * @param holder "Original" object wich contains all properties that `sample` should have in part * @returns If object `sample` has properties of `holder` */ export declare function isPartialOf<T extends unknown>( sample: PartialWithAnyValue<T> & KeyValue, holder: T, ): boolean; export {};