source: node_modules/es-toolkit/dist/compat/predicate/matches.d.ts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[a762898]1/**
2 * Creates a function that performs a deep comparison between a given target and the source object.
3 *
4 * @template T
5 * @param {T} source - The source object to create the matcher from.
6 * @returns {(value: any) => boolean} Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`.
7 *
8 * @example
9 * const matcher = matches({ a: 1, b: 2 });
10 * matcher({ a: 1, b: 2, c: 3 }); // true
11 * matcher({ a: 1, c: 3 }); // false
12 */
13declare function matches<T>(source: T): (value: any) => boolean;
14/**
15 * Creates a function that performs a deep comparison between a given target and the source object.
16 *
17 * @template T
18 * @template V
19 * @param {T} source - The source object to create the matcher from.
20 * @returns {(value: V) => boolean} Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`.
21 *
22 * @example
23 * const matcher = matches<{ a: number }, { a: number; b?: number }>({ a: 1 });
24 * matcher({ a: 1, b: 2 }); // true
25 * matcher({ a: 2 }); // false
26 */
27declare function matches<T, V>(source: T): (value: V) => boolean;
28
29export { matches };
Note: See TracBrowser for help on using the repository browser.