@cripty2001/utils 0.0.233 → 0.0.235
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 +7 -0
- package/dist/react-ui/input.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -134,3 +134,4 @@ export declare function timediff2HumanReadable(diffMs: number): string;
|
|
|
134
134
|
export declare function fn2promise<T>(fn: () => T | Promise<T>): Promise<T>;
|
|
135
135
|
export type SafeApplyed<T> = (updater: (draft: T) => T | void) => T;
|
|
136
136
|
export declare function safeApply<T>(updater: (draft: T) => T | void, incoming: T): T;
|
|
137
|
+
export declare function timesafeEqual(a: string, b: string): boolean;
|
package/dist/index.js
CHANGED
|
@@ -23,8 +23,10 @@ exports.getClock = getClock;
|
|
|
23
23
|
exports.timediff2HumanReadable = timediff2HumanReadable;
|
|
24
24
|
exports.fn2promise = fn2promise;
|
|
25
25
|
exports.safeApply = safeApply;
|
|
26
|
+
exports.timesafeEqual = timesafeEqual;
|
|
26
27
|
const whispr_1 = require("@cripty2001/whispr");
|
|
27
28
|
const value_1 = require("@sinclair/typebox/value");
|
|
29
|
+
const crypto_1 = require("crypto");
|
|
28
30
|
const lodash_1 = require("lodash");
|
|
29
31
|
const U32_LIMIT = 0x1_0000_0000;
|
|
30
32
|
function randomU32() {
|
|
@@ -367,3 +369,8 @@ function safeApply(updater, incoming) {
|
|
|
367
369
|
const chosen = new_data ?? cloned;
|
|
368
370
|
return structuredClone(chosen);
|
|
369
371
|
}
|
|
372
|
+
function timesafeEqual(a, b) {
|
|
373
|
+
if (a.length !== b.length)
|
|
374
|
+
return false;
|
|
375
|
+
return (0, crypto_1.timingSafeEqual)(Buffer.from(a), Buffer.from(b));
|
|
376
|
+
}
|
package/dist/react-ui/input.js
CHANGED
|
@@ -12,7 +12,7 @@ function InputComponent(props) {
|
|
|
12
12
|
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: '0.5rem' }, children: [props.label &&
|
|
13
13
|
(0, jsx_runtime_1.jsx)("label", { className: baseClassName.label, children: props.label }), props.copy &&
|
|
14
14
|
(0, jsx_runtime_1.jsx)(lucide_react_1.CopyIcon, { style: { width: '1rem', height: '1rem', cursor: 'pointer' }, onClick: () => (0, index_1.copyToClipboard)(props.value) })] }), (0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative' }, className: baseClassName.wrapper, children: [props.icon &&
|
|
15
|
-
(0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute',
|
|
15
|
+
(0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', top: '0.5rem' }, children: props.icon }), (0, jsx_runtime_1.jsx)("div", { style: { paddingLeft: props.icon ? '2rem' : '0' }, children: props.children({
|
|
16
16
|
value: props.value,
|
|
17
17
|
setValue: (v) => {
|
|
18
18
|
try {
|
package/package.json
CHANGED