Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An option to fall through all the matchers #16

Open
avalanche1 opened this issue May 13, 2020 · 0 comments
Open

An option to fall through all the matchers #16

avalanche1 opened this issue May 13, 2020 · 0 comments

Comments

@avalanche1
Copy link

I would like a feature to be able to not stop matching if any pattern matches and continue to run matchers (except for the default _, of course).

match(id,
        () => typeof id === 'string', () => doEffect1,
        () => typeof id === 'string' && id.length > 5, () => doEffect2,
        () => typeof id === 'number', () => doEffect3,
        _,  (x) => x
);

Here if id === 'foobar' I would like to effects 1 and 2 to run.
In cur lib version it would do effect 1 and stop.
What I ask is similar to switch statement without breaks.

@avalanche1 avalanche1 changed the title An option to fall through to all the matchers An option to fall through all the matchers May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant