-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requestmajorResults in a major version bumpResults in a major version bump
Description
Considering patroon allows matching array with object and object with array, why not also allow matching a character of a string with an array or object?
const fn = patroon(
'a', () => 'first character is a',
[_, 'a'], () => 'second character is a',
{2: 'b'}, () => 'third character is b',
)
fn('aaaa') // => 'first character is a'
fn('hallo') // => 'seconds character is a'
fn('baba') // => 'third character is b'So really the pattern 'a' is equivalent to:
{0: 'a'}
// and
['a']This requires a major version bump as string patterns are no longer a === (strict equal check).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestmajorResults in a major version bumpResults in a major version bump