Strickland
Search…
emptyResults
Applications that maintain validation state for interaction generally need to initialize the state with an empty validation result. Strickland's form validator provides an emptyResults() helper function to simplify that need.

Usage

1
const personValidator = form({
2
firstName: [
3
required(),
4
length({minLength: 2, maxLength: 20})
5
],
6
lastName: [
7
required(),
8
length({minLength: 2, maxLength: 20})
9
],
10
birthYear: range({min: 1900, max: 2018})
11
});
12
13
let validationResult = personValidator.emptyResults();
14
15
/*
16
validationResult = {
17
form: {
18
validationResults: {},
19
validationErrors: [],
20
isComplete: false
21
}
22
}
23
*/
Copied!
Last modified 1yr ago
Copy link
Contents
Usage