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:
This requires a major version bump as string patterns are no longer a === (strict equal check).
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?
So really the pattern
'a'is equivalent to:This requires a major version bump as string patterns are no longer a
===(strict equal check).