@colisweb/rescript-toolkit 5.16.7 → 5.16.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ module Msg = {
|
|
|
23
23
|
defaultMessage: "Format requis : 14 chiffres",
|
|
24
24
|
}
|
|
25
25
|
let requiredStrictPosInt = {
|
|
26
|
-
defaultMessage: "Doit
|
|
26
|
+
defaultMessage: "Doit être un entier strictement positif",
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
let stringNonEmpty = {defaultMessage: "Champ requis"}
|
|
@@ -98,6 +98,14 @@ let optionalPosInt = (intl, value) => {
|
|
|
98
98
|
| _ => None
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
let optionalStrictPosInt = (intl, value) => {
|
|
102
|
+
switch value {
|
|
103
|
+
| "" => None
|
|
104
|
+
| value if !Toolkit__Utils_Regex.Test.isStrictPositiveInt(value) =>
|
|
105
|
+
Some(Intl.formatMessage(intl, Msg.requiredStrictPosInt))
|
|
106
|
+
| _ => None
|
|
107
|
+
}
|
|
108
|
+
}
|
|
101
109
|
let requiredPosFloat = (intl, value) => {
|
|
102
110
|
switch value {
|
|
103
111
|
| "" => Some(Intl.formatMessage(intl, Msg.requiredValue))
|