Replies: 3 comments 2 replies
-
I'm all for adding aliases for common enough helpers, some for |
Beta Was this translation helpful? Give feedback.
-
I think, at a minimum, anything that exists as a regex character class (e.g. |
Beta Was this translation helpful? Give feedback.
-
Oh, another idea: number range helpers. e.g. pipe(
PB.characterClass(false, ['2', '4']),
PB.then(digit),
PB.or(pipe(
PB.char('5'),
PB.then(PB.characterClass(false, ['0', '5'])),
)),
) wouldn't be fun to write but would be immensely helpful |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What's available inside
PatternBuilder
right now is pretty barebones; it has enough to do what it has to do, but it feels pretty clunky manually writing out every little step.Fortunately, much like the whole
Schemable
system, it's composable! So, for example, while it doesn't (right now) have adigit
combinator, it's pretty easy to write one:Also, some of the names make sense in some contexts but aren't exactly what I'd pick in others. As an example, when I was writing the docs-ts example for the module, I did things like use
PB.exactly(3)(foo)
instead ofPB.times(3)
; exactly makes sense (to me) in that style, while thetimes
naming was chosen thinking about piping (e.g.pipe(foo, PB.times(3))
)Just wanted to start a thread to get discussion on
digit
) should the PB module export?Beta Was this translation helpful? Give feedback.
All reactions