Skip to content

Commit 7296827

Browse files
author
Vlad Balin
committed
updated docs
1 parent 4fbe97f commit 7296827

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Features:
5151
- Added "Users List" application example.
5252
- `link.toggle` is _removed_. Use `link.update( x => !x )` instead.
5353
- `<NumberInput/>` tag with input rejection for numbers.
54+
- Validator functions for `link.check` may contain default `error` message.
5455

5556
# Installation
5657

@@ -294,6 +295,14 @@ but returns `undefined` and leads to the proper purely functional update of the
294295

295296
Evaluate given condition for the current link value, and assign
296297
given error object to the `link.error` when it fails. There are no restriction on the error object shape and type.
298+
299+
It's possible to assign default error message to the validator function. `tags.jsx` provides `isRequired` and `isEmail`
300+
generic validator functions as an examples. Excerpt from `tags.jsx`:
301+
302+
```jsx
303+
export const isRequired = x => x != null && x !== '';
304+
isRequired.error = 'Required';
305+
```
297306

298307
Checks can be chained. In this case, the first check which fails will leave its error in the link.
299308

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "valuelink",
3-
"version": "1.3.5",
3+
"version": "1.3.6",
44
"description": "React valueLink implementation with links to objects, validation, and purely functional state updates.",
55
"main": "valuelink.js",
66
"repository": {

0 commit comments

Comments
 (0)