@colisweb/rescript-toolkit 2.29.1 → 2.30.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
|
@@ -18,6 +18,12 @@ let debug2 = (str, str2) => {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
let debugMany = (arr: array<string>) => {
|
|
22
|
+
if isDev {
|
|
23
|
+
Js.Console.logMany(["%cDEBUG", debugStyle]->Array.concat(arr))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
let warning = str => {
|
|
22
28
|
if isDev {
|
|
23
29
|
Js.Console.log3("%cWARN", warningStyle, str)
|
|
@@ -30,6 +36,12 @@ let warning2 = (str, str2) => {
|
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
38
|
|
|
39
|
+
let warningMany = (arr: array<string>) => {
|
|
40
|
+
if isDev {
|
|
41
|
+
Js.Console.logMany(["%cWARN", warningStyle]->Array.concat(arr))
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
33
45
|
let error = str => {
|
|
34
46
|
if isDev {
|
|
35
47
|
Js.Console.log3("%cERROR", errorStyle, str)
|
|
@@ -52,3 +64,17 @@ let error2 = (str, str2) => {
|
|
|
52
64
|
})
|
|
53
65
|
}
|
|
54
66
|
}
|
|
67
|
+
|
|
68
|
+
let errorMany = (arr: array<string>) => {
|
|
69
|
+
let message = arr[0]
|
|
70
|
+
let data = arr->Array.length > 1 ? arr->Array.sliceToEnd(1) : []
|
|
71
|
+
if isDev {
|
|
72
|
+
Js.Console.logMany(["%cERROR", errorStyle]->Array.concat(arr))
|
|
73
|
+
} else {
|
|
74
|
+
open Sentry
|
|
75
|
+
withScope(scope => {
|
|
76
|
+
scope->Scope.setExtra("data", data)
|
|
77
|
+
captureMessage(Obj.magic(message))
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
let debug: 'a => unit
|
|
2
2
|
let debug2: ('a, 'b) => unit
|
|
3
|
+
let debugMany: array<string> => unit
|
|
3
4
|
|
|
4
5
|
let warning: 'a => unit
|
|
5
6
|
let warning2: ('a, 'b) => unit
|
|
7
|
+
let warningMany: array<string> => unit
|
|
6
8
|
|
|
7
9
|
let error: 'a => unit
|
|
8
10
|
let error2: ('a, 'b) => unit
|
|
11
|
+
let errorMany: array<string> => unit
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
module UnitMeasure = Toolkit__Utils_UnitMeasure
|
|
2
2
|
module Regex = Toolkit__Utils_Regex
|
|
3
|
+
|
|
4
|
+
let wait = ms =>
|
|
5
|
+
Js.Promise.make((~resolve, ~reject as _) => {
|
|
6
|
+
Js.Global.setTimeout(() => {
|
|
7
|
+
let data = ()
|
|
8
|
+
resolve(. data)
|
|
9
|
+
}, ms)->ignore
|
|
10
|
+
})
|
|
11
|
+
->Promise.Js.fromBsPromise
|
|
12
|
+
->Promise.Js.toResult
|