File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ export const formRules = {
25
25
v ? v . length <= 600 || 'Must not be longer than 600 characters' : true ,
26
26
maxLength1200 : ( v : string ) =>
27
27
v ? v . length <= 1200 || 'Must not be longer than 1200 characters' : true ,
28
+ maxLength5000 : ( v : string ) =>
29
+ v ? v . length <= 5000 || 'Must not be longer than 5000 characters' : true ,
30
+ maxLength10000 : ( v : string ) =>
31
+ v ? v . length <= 10000 || 'Must not be longer than 10,000 characters' : true ,
28
32
29
33
// Number
30
34
isInteger : ( v : string ) => Number . isInteger ( + v ) || 'Must be an integer' ,
Original file line number Diff line number Diff line change @@ -14,3 +14,17 @@ export const addOrReplaceArrayItem = (
14
14
if ( i > - 1 ) array [ i ] = element
15
15
else array . push ( element )
16
16
}
17
+
18
+ /**
19
+ * Returns a random integer between min (inclusive) and max (inclusive).
20
+ * The value is no lower than min (or the next integer greater than min
21
+ * if min isn't an integer) and no greater than max (or the next integer
22
+ * lower than max if max isn't an integer).
23
+ * Using Math.round() will give you a non-uniform distribution!
24
+ */
25
+ // https://stackoverflow.com/questions/1527803/how-to-generate-random-whole-numbers-in-javascript-in-a-specific-range
26
+ export const getRandomInt = ( min : number , max : number ) => {
27
+ min = Math . ceil ( min )
28
+ max = Math . floor ( max )
29
+ return Math . floor ( Math . random ( ) * ( max - min + 1 ) ) + min
30
+ }
You can’t perform that action at this time.
0 commit comments