@oscarpalmer/timer 0.43.0 → 0.45.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/dist/constants.d.mts +6 -19
- package/dist/constants.mjs +5 -13
- package/dist/global.d.mts +4 -2
- package/dist/global.mjs +5 -14
- package/dist/index.d.mts +52 -95
- package/dist/index.mjs +232 -411
- package/dist/is.d.mts +1 -3
- package/dist/misc.d.mts +10 -0
- package/dist/misc.mjs +34 -0
- package/dist/models.d.mts +110 -7
- package/dist/repeat.d.mts +3 -3
- package/dist/repeat.mjs +3 -3
- package/dist/timer.d.mts +3 -50
- package/dist/timer.mjs +50 -94
- package/dist/wait.d.mts +3 -2
- package/dist/wait.mjs +3 -3
- package/dist/when.d.mts +3 -46
- package/dist/when.mjs +77 -117
- package/dist/work.d.mts +3 -5
- package/dist/work.mjs +26 -31
- package/package.json +8 -8
- package/src/constants.ts +8 -19
- package/src/global.ts +12 -22
- package/src/index.ts +4 -5
- package/src/is.ts +1 -2
- package/src/misc.ts +49 -0
- package/src/models.ts +129 -6
- package/src/repeat.ts +4 -6
- package/src/timer.ts +60 -130
- package/src/wait.ts +4 -6
- package/src/when.ts +98 -153
- package/src/work.ts +33 -57
- package/dist/delay.d.mts +0 -3
- package/dist/delay.mjs +0 -2
- package/dist/get.d.mts +0 -8
- package/dist/get.mjs +0 -15
- package/src/delay.ts +0 -2
- package/src/get.ts +0 -17
package/dist/get.d.mts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { GenericCallback } from "@oscarpalmer/atoms/models";
|
|
2
|
-
|
|
3
|
-
//#region src/get.d.ts
|
|
4
|
-
declare function getCallback(value: unknown): GenericCallback;
|
|
5
|
-
declare function getValidTimeout(value: unknown): number;
|
|
6
|
-
declare function getValidNumber(value: unknown, defaultValue?: number): number;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { getCallback, getValidNumber, getValidTimeout };
|
package/dist/get.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_TIMEOUT } from "./constants.mjs";
|
|
2
|
-
import { noop } from "@oscarpalmer/atoms/function";
|
|
3
|
-
//#region src/get.ts
|
|
4
|
-
function getCallback(value) {
|
|
5
|
-
return typeof value === "function" ? value : noop;
|
|
6
|
-
}
|
|
7
|
-
function getValidTimeout(value) {
|
|
8
|
-
return typeof value === "number" && value > 0 ? value : DEFAULT_TIMEOUT;
|
|
9
|
-
}
|
|
10
|
-
function getValidNumber(value, defaultValue) {
|
|
11
|
-
const actualDefault = defaultValue ?? 0;
|
|
12
|
-
return typeof value === "number" && value > actualDefault ? value : actualDefault;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { getCallback, getValidNumber, getValidTimeout };
|
package/src/delay.ts
DELETED
package/src/get.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type {GenericCallback} from '@oscarpalmer/atoms/models';
|
|
2
|
-
import {noop} from '@oscarpalmer/atoms/function';
|
|
3
|
-
import {DEFAULT_TIMEOUT} from './constants';
|
|
4
|
-
|
|
5
|
-
export function getCallback(value: unknown): GenericCallback {
|
|
6
|
-
return typeof value === 'function' ? (value as GenericCallback) : noop;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function getValidTimeout(value: unknown): number {
|
|
10
|
-
return typeof value === 'number' && value > 0 ? value : DEFAULT_TIMEOUT;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function getValidNumber(value: unknown, defaultValue?: number): number {
|
|
14
|
-
const actualDefault = defaultValue ?? 0;
|
|
15
|
-
|
|
16
|
-
return typeof value === 'number' && value > actualDefault ? value : actualDefault;
|
|
17
|
-
}
|