@colisweb/rescript-toolkit 3.7.1 → 3.7.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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "3.7.1",
3
+ "version": "3.7.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -323,6 +323,18 @@ let optionalPosFloatEnergyCapacityKWh = (intl, value) => {
323
323
  }
324
324
  }
325
325
 
326
+ let optionalPosFloatSpeedKm_h = (intl, value) => {
327
+ switch value {
328
+ | "" => None
329
+ | v =>
330
+ switch v->Toolkit__Decoders.UnitMeasure.Speed.WithUnit.decodeFromString {
331
+ | Ok(#km_h(_)) => None
332
+ | _ =>
333
+ Some(Intl.formatMessageWithValues(intl, Msg.wrongFormat, {"exemple": "'10 km/h' '0.5 km/h'"}))
334
+ }
335
+ }
336
+ }
337
+
326
338
  let requiredPosFloatWeightG = (intl, value) => {
327
339
  switch value {
328
340
  | "" => Some(Intl.formatMessage(intl, Msg.requiredValue))
@@ -199,19 +199,19 @@ module Speed = {
199
199
 
200
200
  let toValue = value =>
201
201
  switch value {
202
- | #km_h(value) => v
202
+ | #km_h(v) => v
203
203
  }
204
204
 
205
205
  let display = (value, ~digits=2, ()) => {
206
206
  open Js.Float
207
207
  switch value {
208
- | #km_h(value) => v->toFixedWithPrecision(~digits) ++ " km/h"
208
+ | #km_h(v) => v->toFixedWithPrecision(~digits) ++ " km/h"
209
209
  }
210
210
  }
211
211
 
212
212
  let toString = value => {
213
213
  switch value {
214
- | #km_h(value) => v->Float.toString ++ " km/h"
214
+ | #km_h(v) => v->Float.toString ++ " km/h"
215
215
  }
216
216
  }
217
217
  }