@colisweb/rescript-toolkit 5.29.1 → 5.29.2
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 +1 -1
- package/src/form/ReSchema.res +5 -3
package/package.json
CHANGED
package/src/form/ReSchema.res
CHANGED
|
@@ -247,10 +247,12 @@ module Make = (Lenses: Lenses) => {
|
|
|
247
247
|
let value = Lenses.get(values, field)
|
|
248
248
|
(
|
|
249
249
|
Field(field),
|
|
250
|
-
switch value {
|
|
250
|
+
switch (value->Obj.magic: option<string>) {
|
|
251
251
|
| _ if props.optionalPredicate->Option.mapWithDefault(false, fn => fn(values)) => Valid
|
|
252
|
-
|
|
|
253
|
-
|
|
|
252
|
+
| None
|
|
253
|
+
| Some("") =>
|
|
254
|
+
Error(i18n.stringNonEmpty(~value=""))
|
|
255
|
+
| Some(phone) =>
|
|
254
256
|
if !(phone->Js.String2.startsWith("+33")) {
|
|
255
257
|
Error(error->Option.getWithDefault(i18n.phone))
|
|
256
258
|
} else if phone->Js.String2.sliceToEnd(~from=3)->Js.String2.length != 9 {
|