lodash-match-pattern icon indicating copy to clipboard operation
lodash-match-pattern copied to clipboard

Match one of set of values?

Open robross0606 opened this issue 3 years ago • 2 comments

How do I match a field that can be any of multiple values, such as from an Enum of possible options? Effectively an "or" pattern?

robross0606 avatar Jun 24 '22 16:06 robross0606

I would have thought of using _.includes but that takes the collection as its first value so I'm not sure how that would work with | syntax.

robross0606 avatar Jun 24 '22 16:06 robross0606

I've gone over everything in here and I'm kinda shocked that there doesn't seem to be built-in way to check if a simple string matches one of a set of values without using Regex. 😮

robross0606 avatar Jun 24 '22 20:06 robross0606