@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "2.46.3",
3
+ "version": "2.46.4",
4
4
  "scripts": {
5
5
  "clean": "rescript clean",
6
6
  "build": "rescript build -with-deps",
@@ -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->Js.Json.string->Config.unitEnum_decode {
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 = v => v->Config.unitEnumToJs
28
- let unitEnumFromString = v => v->Config.unitEnumFromJs
27
+ let unitEnumToString = Config.unitEnumToJs
28
+ let unitEnumFromString = Config.unitEnumFromJs
29
29
  }
30
30
 
31
31
  module Weight = {