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

Export rules independently #2

Open
jaggy opened this issue Feb 13, 2019 · 0 comments
Open

Export rules independently #2

jaggy opened this issue Feb 13, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@jaggy
Copy link
Member

jaggy commented Feb 13, 2019

It might be better for userland if they need to import the rules they need, rather than adding 20 different rules when the Validator is pulled in.

I'm still not sure how to do it but that's the end goal.

Also think of a good developer experience for loading all, of the core extensions.

Here's the proposed method

import { required, between, min, file } ax extensions from '@artisanstudio/validate.js/extensions'

Validator.load(extensions)

For loading ALL of the extensions, I would love it to have an API of Validator.loadCoreExtensions() although I'm not sure how that would work since if we do require on the javascript side, it'll already pull in all the dependencies.

The only thing I can think off is:

import * as CoreExtensions from '@artisanstudio/validate.js/extensions'

Validator.load(CoreExtensions)

Though, I'm not sure how the DX is.

@jaggy jaggy added the enhancement New feature or request label Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant