@jsnw/common-utils 1.0.0 → 1.1.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/README.md +1 -1
- package/dist/index.cjs +216 -0
- package/dist/index.d.cts +133 -0
- package/dist/index.d.mts +133 -0
- package/dist/index.mjs +206 -0
- package/package.json +19 -25
- package/dist/cjs/chunk.js +0 -19
- package/dist/cjs/chunkStr.js +0 -17
- package/dist/cjs/createInFlightDeduper.js +0 -24
- package/dist/cjs/ignorePromise.js +0 -15
- package/dist/cjs/index.js +0 -25
- package/dist/cjs/isObjectEmpty.js +0 -16
- package/dist/cjs/monitor.js +0 -75
- package/dist/cjs/noop.js +0 -12
- package/dist/cjs/resultify.js +0 -23
- package/dist/cjs/wait.js +0 -34
- package/dist/esm/chunk.js +0 -15
- package/dist/esm/chunkStr.js +0 -14
- package/dist/esm/createInFlightDeduper.js +0 -21
- package/dist/esm/ignorePromise.js +0 -11
- package/dist/esm/index.js +0 -9
- package/dist/esm/isObjectEmpty.js +0 -13
- package/dist/esm/monitor.js +0 -71
- package/dist/esm/noop.js +0 -8
- package/dist/esm/resultify.js +0 -20
- package/dist/esm/wait.js +0 -30
- package/dist/types/chunk.d.ts +0 -9
- package/dist/types/chunkStr.d.ts +0 -8
- package/dist/types/createInFlightDeduper.d.ts +0 -10
- package/dist/types/ignorePromise.d.ts +0 -6
- package/dist/types/index.d.ts +0 -9
- package/dist/types/isObjectEmpty.d.ts +0 -5
- package/dist/types/monitor.d.ts +0 -40
- package/dist/types/noop.d.ts +0 -8
- package/dist/types/resultify.d.ts +0 -10
- package/dist/types/wait.d.ts +0 -8
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type ErrorResult<R, E> = readonly [R, null] | readonly [null, E];
|
|
2
|
-
/**
|
|
3
|
-
* Executes a function and returns its result as a tuple `[value, error]`.
|
|
4
|
-
* Works with both sync and async functions. Never throws.
|
|
5
|
-
*
|
|
6
|
-
* @template {() => any} F
|
|
7
|
-
* @template {Error} E
|
|
8
|
-
* @param {F} fn
|
|
9
|
-
*/
|
|
10
|
-
export declare function resultify<F extends () => any, E = Error>(fn: F): ReturnType<F> extends Promise<infer R> ? Promise<ErrorResult<R, E>> : ErrorResult<ReturnType<F>, E>;
|
package/dist/types/wait.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Waits asynchronously for the specified amount of milliseconds before resolving.
|
|
3
|
-
*
|
|
4
|
-
* @param {number} wait_ms - The number of milliseconds to wait. If less than 1, the promise resolves immediately.
|
|
5
|
-
* @param {AbortSignal} [signal]
|
|
6
|
-
* @returns {Promise<void>} A promise that resolves after the specified wait time.
|
|
7
|
-
*/
|
|
8
|
-
export declare const wait: (wait_ms: number, signal?: AbortSignal) => Promise<void>;
|