source: node_modules/es-toolkit/dist/compat/predicate/isMatch.d.mts

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

Added visualizations

  • Property mode set to 100644
File size: 993 bytes
Line 
1/**
2 * Checks if the target matches the source by comparing their structures and values.
3 * This function supports deep comparison for objects, arrays, maps, and sets.
4 *
5 * @param {object} target - The target value to match against.
6 * @param {object} source - The source value to match with.
7 * @returns {boolean} - Returns `true` if the target matches the source, otherwise `false`.
8 *
9 * @example
10 * // Basic usage
11 * isMatch({ a: 1, b: 2 }, { a: 1 }); // true
12 *
13 * @example
14 * // Matching arrays
15 * isMatch([1, 2, 3], [1, 2, 3]); // true
16 *
17 * @example
18 * // Matching maps
19 * const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]);
20 * const sourceMap = new Map([['key1', 'value1']]);
21 * isMatch(targetMap, sourceMap); // true
22 *
23 * @example
24 * // Matching sets
25 * const targetSet = new Set([1, 2, 3]);
26 * const sourceSet = new Set([1, 2]);
27 * isMatch(targetSet, sourceSet); // true
28 */
29declare function isMatch(target: object, source: object): boolean;
30
31export { isMatch };
Note: See TracBrowser for help on using the repository browser.