-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
updated docs #16
updated docs #16
Conversation
I am all in for agnostic principle. The hard-coding of https://github.com/lundegaard/validarium/blob/master/packages/core/src/createMainValidate.js#L74 I consider as a bug that must be solved. Have you thought about the way how to do that? Referring to |
@@ -2,10 +2,12 @@ | |||
|
|||
[![build status](https://img.shields.io/travis/lundegaard/validarium/master.svg?style=flat-square)](https://travis-ci.org/lundegaard/validarium) | |||
|
|||
An agnostic validation library for JavaScript applications. | |||
An validation library for JavaScript applications. Ready to be used with react-intl. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it is not agnostic yet... but it is definitely our goal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will create issue
<br /> | ||
<br /> | ||
|
||
[`Try It`](https://runkit.com/aizerin/validarium) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* [.validateMany](#module_core.validateMany) | ||
* [.createMainValidate](#module_core.createMainValidate) ⇒ <code>Object</code> | ||
* [.createValidation(fn, react, params)](#module_core.createValidation) ⇒ <code>Object</code> \| <code>null</code> | ||
* [.createValidation(fn, react, params)](#module_core.createValidation) ⇒ <code>Object</code> \| <code>null</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that there shoud be .createOptionalValidation
<a name="module_core.createValidation"></a> | ||
|
||
### core.createValidation(fn, react, params) ⇒ <code>Object</code> \| <code>null</code> | ||
Creates optional validation function with predicate and message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that there shoud be .createOptionalValidation
|
||
**Example** | ||
```js | ||
validateMany({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please adjust the formatting of all examples (indentation in particular)?
packages/core/README.md
Outdated
}, | ||
]) | ||
|
||
// [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a line of a comment text above the output of an example that will make more obvious that this is an output of a code above? E.g.:
// Output:
// [{
// ......
instead of ust
// [{
// ......
* @param {Object} params for intl message (eg. { min: 1, max: 2 }) | ||
* @return {Object|null} Message object when fails { message, messageValues } or null if pass | ||
* | ||
* @alias module:core.createValidation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be createOptionalValidation
@aizerin Thank you for great work! |
I’ve updated docs.
But I have a few problems with this library.
The library is not agnostic since it requires react-intl to be present in props in the core of the library.
Function createMainValidate requires props and react-intl. Beside that createMainValidate is not actually self-explanatory name when it also translating the validation messages.
Whole intl package has only mandatory validations. There is no way to have optional validations since every validation is created using createValidation. Should I duplicate every validation using createOptionalValidation if I want to optional validations? This implies that isRequired is there only for a fancy error message.
This library is maybe too simple to even for simple form validation. There is no solution for conditional validations, async validations, nested object and objects in arrays.