The main thing
new P.string.length(n)
pattern
P.string.length(len)
matches strings with exactly len
characters.
const fn = (input: string) =>
match(input)
.with(P.string.length(2), () => '🎉')
.otherwise(() => '❌');
console.log(fn('ok')); // logs '🎉'
What's Changed
- docs: fix typo in
P.when
patterns code example by @grigorischristainas in #260 - feat: Added P.string.length by @JUSTIVE in #257
New Contributors
- @grigorischristainas made their first contribution in #260
Full Changelog: v5.1.2...v5.2.0