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

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

Added visualizations

  • Property mode set to 100644
File size: 1022 bytes
Line 
1import { ConformsPredicateObject } from '../_internal/ConformsPredicateObject.mjs';
2
3/**
4 * Checks if `object` conforms to `source` by invoking the predicate properties of `source` with the corresponding property values of `object`.
5 *
6 * Note: This method is equivalent to `conforms` when source is partially applied.
7 *
8 * @template T - The type of the target object.
9 * @param {T} target The object to inspect.
10 * @param {ConformsPredicateObject<T>} source The object of property predicates to conform to.
11 * @returns {boolean} Returns `true` if `object` conforms, else `false`.
12 *
13 * @example
14 *
15 * const object = { 'a': 1, 'b': 2 };
16 * const source = {
17 * 'a': (n) => n > 0,
18 * 'b': (n) => n > 1
19 * };
20 *
21 * console.log(conformsTo(object, source)); // => true
22 *
23 * const source2 = {
24 * 'a': (n) => n > 1,
25 * 'b': (n) => n > 1
26 * };
27 *
28 * console.log(conformsTo(object, source2)); // => false
29 */
30declare function conformsTo<T>(target: T, source: ConformsPredicateObject<T>): boolean;
31
32export { conformsTo };
Note: See TracBrowser for help on using the repository browser.