isObjectMatch()function
isObjectMatch(left: L | R, right: R, recursor: Match = isEqual): left is L & R
| Param | Type | |
|---|---|---|
left | LR | The object to check and narrow. required |
right | R | The object whose props left must contain. required |
recursor | Match | Function that checks each prop of the object. - Defaults to isEqual() to check strict equality of the properties.- Use isDeepEqual() as the recursor to check to check deep equality of the properties. Defaults to isEqual |
| Return | |
|---|---|
left is L & R | true if left contains every prop of right with matching values. |
Are two objects partially equal based on their own props?
leftmust have every property present inrightleftmay have have excess properties not present inright
Examples
isObjectMatch({ a: 1, b: 2 }, { a: 1 }) // true