matchesProperty

Modified on Thu, 24 Aug 2023

Description

Use this function to create a function that performs a partial deep comparison between the value at a specified path of a given object and a source value. It returns 'true' if the object value is equivalent to the source value; otherwise, it returns 'false'.

Syntax

matchesProperty(path: PropertyPath, srcValue: T)

Returns

Return ValueDescription
BooleanReturns 'true' if the value at the specified path of the object is equivalent to the source value; otherwise, 'false'.

Sample

ExampleResultDescription
matchesProperty('city', 'New York')trueReturns 'true' because the value at the 'city' path of the object is 'New York', which matches the source value.
matchesProperty('state', 'NY')trueReturns 'true' because the value at the 'state' path of the object is 'NY', which matches the source value.

To view all Object functions, click here.

See Also