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

V2 - Improve validator to also provide inline validation #271

Open
dxinteractive opened this issue Jan 4, 2020 · 1 comment
Open

V2 - Improve validator to also provide inline validation #271

dxinteractive opened this issue Jan 4, 2020 · 1 comment

Comments

@dxinteractive
Copy link
Collaborator

  • Make a new validator that adds the validator functions to meta
  • Add a modifier to execute value -> meta.validate = meta.invalid
@dxinteractive
Copy link
Collaborator Author

let validate = (config) => {

let _validate = data => {
    let {keyPath} = data;
    // do validation
    return {
        meta: {
            errors: []
        }
    }
};

return (parcel) =>  parcel
    .setCall({
        validate: fn,
        submit: () => parcel.call.submit()
    })
    .modifyDown(_validate)
    .modifyUp(_validate)
}

...also...

parcel.modifyUp(parcel.call.validate)...

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