-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I'm not an native English speaker but to me the naming of the pattern helpers seem off.
Currently we have typed and ref. It seems a bit off. Either the naming should improve or the API should change so these helpers don't even exist.
An idea is to only have an all helper which will check if all patterns passed to it pass. It could look like this.
To manage the errors with a value one could do:
patroon(
all(is(Error), {statusCode: _}), 'an error with statusCode'
)In case of the ref one could do:
patroon(
equals(fn), 'is the function'
)This would make patroon a little more focused/bare-bones but still play nice with other fp libraries.
EDIT:
@CrossEye suggested using arrays for each pattern-value pair. In that case an all helper would not be necessary.
patroon(
[Error, {statusCode: _}, 'is an error with a statusCode']
)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels