@colisweb/rescript-toolkit 2.46.3 → 2.46.4
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
|
@@ -228,11 +228,15 @@ module UnitMeasure = {
|
|
|
228
228
|
| Some([_match, None, _unit]) => Decco.error(`${errorPrefix} unhandled no value`, jsonString)
|
|
229
229
|
| Some([Some(_match), Some(value), Some(unit)]) => {
|
|
230
230
|
let value = value->Js.Float.fromString
|
|
231
|
-
switch unit
|
|
231
|
+
switch unit
|
|
232
|
+
->Js.String2.replaceByRe(%re("/\s/"), "")
|
|
233
|
+
->Js.Json.string
|
|
234
|
+
->Config.unitEnum_decode {
|
|
232
235
|
| Ok(unit) => Config.wrapValue(unit, value)->Ok
|
|
233
236
|
| Error(_) => Decco.error(`${errorPrefix} unhandled unit '${unit}'`, jsonString)
|
|
234
237
|
}
|
|
235
238
|
}
|
|
239
|
+
|
|
236
240
|
| Some(_) => Decco.error(`${errorPrefix} regex capture group error`, jsonString)
|
|
237
241
|
}
|
|
238
242
|
}
|
|
@@ -24,8 +24,8 @@ module Unit = (Config: UnitConfig) => {
|
|
|
24
24
|
@decco
|
|
25
25
|
type unitEnum = @decco.codec(codec) Config.unitEnum
|
|
26
26
|
|
|
27
|
-
let unitEnumToString =
|
|
28
|
-
let unitEnumFromString =
|
|
27
|
+
let unitEnumToString = Config.unitEnumToJs
|
|
28
|
+
let unitEnumFromString = Config.unitEnumFromJs
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
module Weight = {
|