-
Notifications
You must be signed in to change notification settings - Fork 0
match: consider guarding against empty text input #1
Copy link
Copy link
Open
Description
match(text) currently accepts an empty string without raising, which is asymmetric with the empty-pattern guard.
Riteway.match("").call("hello") # => nil (no error)
Riteway.match("hello").call("") # => ArgumentError: pattern must not be emptyPassing empty text to match is likely a user bug. The JS riteway does not guard this either, so keeping it unguarded is a defensible choice — but worth a conscious decision.
Options:
- Add a guard:
raise ArgumentError, "text must not be empty"inmatch(text) - Document the asymmetry explicitly and leave it as-is (consistent with JS)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels