@colisweb/rescript-toolkit 2.53.0 → 2.54.0

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.53.0",
3
+ "version": "2.54.0",
4
4
  "scripts": {
5
5
  "clean": "rescript clean",
6
6
  "build": "rescript build -with-deps",
@@ -2,8 +2,20 @@ let positiveIntRegex = %re("/^[0-9]+$/")
2
2
  let strictPositiveIntReex = %re("/^[0-9]*[1-9][0-9]*$/")
3
3
  let positiveIntOrFloatRegex = %re("/^[0-9]+(?:\.?[0-9]+)?$/")
4
4
 
5
+ @new
6
+ external makeRegex: string => Js.Re.t = "RegExp"
7
+
5
8
  module Test = {
6
9
  let isPositiveInt = Js.Re.test_(positiveIntRegex, _)
7
10
  let isStrictPositiveInt = Js.Re.test_(strictPositiveIntReex, _)
8
11
  let isPositiveIntOrFloat = Js.Re.test_(positiveIntOrFloatRegex, _)
9
12
  }
13
+
14
+ let isValid = regex => {
15
+ try {
16
+ let _test = makeRegex(regex)
17
+ true
18
+ } catch {
19
+ | _ => false
20
+ }
21
+ }
@@ -0,0 +1,7 @@
1
+ type barcodeOptions = {
2
+ format?: string,
3
+ height?: float,
4
+ fontSize?: float,
5
+ }
6
+ @module("jsbarcode")
7
+ external generate: (string, string, barcodeOptions) => unit = "default"