You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have a case where I want to be able to match against an arbitrary set of value-cases, with the return value of each match being known. The value-cases and matching closures would be derived from input data. For example:
(This is a weak example, since in this case I could accomplish this by using filter over the keys of the input object.)
In this example I would prefer to pass in to getScopes a generic Record<string, boolean>, derive the 2^n cases and their return values, and then use match() to process it all. This is similar in nature to the request in #217, I think, but sufficiently different to file this as a new request.
Describe the solution you'd like
Something that creates an initial (or "empty") matcher, allows the programmatic addition of with cases, then can have run called on it.
Describe alternatives you've considered
I have looked at passing multiple patterns to with, but it isn't clear how I would carry over the matching pattern to the handler.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I have a case where I want to be able to match against an arbitrary set of value-cases, with the return value of each match being known. The value-cases and matching closures would be derived from input data. For example:
(This is a weak example, since in this case I could accomplish this by using
filter
over the keys of the input object.)In this example I would prefer to pass in to
getScopes
a genericRecord<string, boolean>
, derive the 2^n cases and their return values, and then usematch()
to process it all. This is similar in nature to the request in #217, I think, but sufficiently different to file this as a new request.Describe the solution you'd like
Something that creates an initial (or "empty") matcher, allows the programmatic addition of
with
cases, then can haverun
called on it.Describe alternatives you've considered
I have looked at passing multiple patterns to
with
, but it isn't clear how I would carry over the matching pattern to the handler.The text was updated successfully, but these errors were encountered: