@cripty2001/utils 0.0.24 → 0.0.26
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/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/react-whispr.d.ts +1 -1
- package/dist/react-whispr.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ exports.arrayStep = arrayStep;
|
|
|
11
11
|
exports.copyToClipboard = copyToClipboard;
|
|
12
12
|
exports.stableLog = stableLog;
|
|
13
13
|
exports.parseQuery = parseQuery;
|
|
14
|
+
exports.randBetween = randBetween;
|
|
14
15
|
const lodash_1 = require("lodash");
|
|
15
16
|
function getRandom(_alphabeth, length) {
|
|
16
17
|
const alphabeth = _alphabeth.split("");
|
|
@@ -118,3 +119,6 @@ function parseQuery(query, fields) {
|
|
|
118
119
|
left: data
|
|
119
120
|
};
|
|
120
121
|
}
|
|
122
|
+
function randBetween(min, max) {
|
|
123
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
124
|
+
}
|
package/dist/react-whispr.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare function useWhisprValue<I, O = I>(w: Whispr<I>, computer?: (data:
|
|
|
25
25
|
* @remarks The returned whispr has already been ref-fed, so it can be directly used without worrying about react recreating it or similar bad things
|
|
26
26
|
*/
|
|
27
27
|
export declare function useWhispr<T>(data: T | Whispr<T>): Whispr<T>;
|
|
28
|
-
export declare function useCurrentTimestamp(): number;
|
|
28
|
+
export declare function useCurrentTimestamp(refresh?: number): number;
|
|
29
29
|
export declare function useDebounced<T>(value: T): T;
|
|
30
30
|
/**
|
|
31
31
|
*
|
package/dist/react-whispr.js
CHANGED
|
@@ -54,10 +54,10 @@ function useWhispr(data) {
|
|
|
54
54
|
return data;
|
|
55
55
|
return w;
|
|
56
56
|
}
|
|
57
|
-
function useCurrentTimestamp() {
|
|
57
|
+
function useCurrentTimestamp(refresh = 1000) {
|
|
58
58
|
const [currTs, setCurrTs] = (0, react_1.useState)(Date.now());
|
|
59
59
|
(0, react_1.useEffect)(() => {
|
|
60
|
-
const id = setInterval(() => setCurrTs(Date.now()),
|
|
60
|
+
const id = setInterval(() => setCurrTs(Date.now()), refresh);
|
|
61
61
|
return () => clearInterval(id);
|
|
62
62
|
}, [setCurrTs]);
|
|
63
63
|
return currTs;
|
package/package.json
CHANGED