|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Rev | Line | |
|---|
| [a762898] | 1 | import { IsMatchWithCustomizer } from '../_internal/IsMatchWithCustomizer.js';
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | * Performs a deep comparison between a target value and a source pattern to determine if they match,
|
|---|
| 5 | * using a custom comparison function for fine-grained control over the matching logic.
|
|---|
| 6 | *
|
|---|
| 7 | * @param {object} target - The value to be tested for matching
|
|---|
| 8 | * @param {object} source - The pattern/template to match against
|
|---|
| 9 | * @param {IsMatchWithCustomizer} compare - Custom comparison function for fine-grained control
|
|---|
| 10 | * @returns {boolean} `true` if the target matches the source pattern, `false` otherwise
|
|---|
| 11 | *
|
|---|
| 12 | * @example
|
|---|
| 13 | * // Basic matching with custom comparator
|
|---|
| 14 | * const caseInsensitiveCompare = (objVal, srcVal) => {
|
|---|
| 15 | * if (typeof objVal === 'string' && typeof srcVal === 'string') {
|
|---|
| 16 | * return objVal.toLowerCase() === srcVal.toLowerCase();
|
|---|
| 17 | * }
|
|---|
| 18 | * return undefined;
|
|---|
| 19 | * };
|
|---|
| 20 | *
|
|---|
| 21 | * isMatchWith(
|
|---|
| 22 | * { name: 'JOHN', age: 30 },
|
|---|
| 23 | * { name: 'john' },
|
|---|
| 24 | * caseInsensitiveCompare
|
|---|
| 25 | * ); // true
|
|---|
| 26 | */
|
|---|
| 27 | declare function isMatchWith(target: object, source: object, compare: IsMatchWithCustomizer): boolean;
|
|---|
| 28 |
|
|---|
| 29 | export { isMatchWith };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.