diff --git a/CHANGELOG.md b/CHANGELOG.md index 35b63f1..d1a75e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 0.0.7 +* Function validator now looks for `validator` instead of `validate` to not clash with the per field validate method + # 0.0.6 * Add support for validating subsets of the form. diff --git a/README.md b/README.md index 0cc8506..e46590b 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ let form = Form({ fields: { email: {}, password: { - validate: x => !x && ['Password is required'], + validator: x => !x && ['Password is required'], }, }, submit: async snapshot => { diff --git a/package.json b/package.json index 2c9a80d..c16fb3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mobx-autoform", - "version": "0.0.6", + "version": "0.0.7", "description": "Ridiculously simple form state management with mobx", "main": "lib/mobx-autoform.js", "scripts": { diff --git a/validators.js b/validators.js index f771795..678d241 100644 --- a/validators.js +++ b/validators.js @@ -19,8 +19,8 @@ export let functions = (form, fields) => { let snapshot = form.getSnapshot() return _.flow( maybeLimitFields(fields), - F.mapValuesIndexed(({ validate = () => {} }, field) => - validate(snapshot[field]) + F.mapValuesIndexed(({ validator = () => {} }, field) => + validator(snapshot[field]) ), F.compactObject )(form.fields)