The method will assume the second pattern object as the callback.
Proposed Solution
Allow match() to accept an array of patterns while providing a new optional flag that will inform the method that it should handle an array of patterns not lookup the array structure in the payload.
Problem:
There are scenarios that require matching an item in an array but also the following item (or items at any other index). Example:
For the
payload
I would like to match the following objects:However, the
match()
function accepts only 1pattern
. If arguments are passed as follows:The method will assume the second pattern object as the callback.
Proposed Solution
Allow
match()
to accept anarray of patterns
while providing a new optional flag that will inform the method that it should handle anarray of patterns
not lookup the array structure in thepayload
.