-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
43 lines (42 loc) · 1.22 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Generate FormKit validation array from key/label object
*
* Only uses the object keys and not the values.
* ```js
* { dog: 'Dog', cat: 'Fox' } //=> ['dog', 'cat']
* ```
*
* @param obj object with key/value pairs
* @returns FormKit validation array
*
* ```js
* import { generateArray } from 'formkit-validation-helper;
* const selectOptions = { dog: 'Dog', cat: 'Cat', mouse: 'Mouse' };
* const validationArray = generateArray(selectOptions) //=> ['dog', 'cat', 'mouse']
* //...
* :validation="[['is', ...validationArray]]"
* //...
* ```
*/
export function generateValidationArray(obj: object): string[];
/**
* Generate FormKit validation string from key/value object
*
* Only uses the object keys and not the values.
* ```js
* { dog: 'Dog', cat: 'Fox' } //=> 'dog,cat'
* ```
*
* @param obj object with key/label pairs
* @returns FormKit validation string
*
* ```js
* import { generateString } from 'formkit-validation-helper;
* const selectOptions = { dog: 'Dog', cat: 'Cat', mouse: 'Mouse' };
* const validationString = generateString(selectOptions) //=> 'dog,cat,mouse'
* //...
* :validation="`is:${validationString}`"
* //...
* ```
*/
export function generateValidationString(obj: object): string;