@ztimson/utils 0.27.4 → 0.27.6
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/cache.d.ts +8 -2
- package/dist/index.cjs +116 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +116 -30
- package/dist/index.mjs.map +1 -1
- package/dist/logger.d.ts +1 -0
- package/dist/misc.d.ts +24 -0
- package/dist/time.d.ts +44 -0
- package/package.json +1 -1
package/dist/logger.d.ts
CHANGED
package/dist/misc.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LogLevels } from './logger.ts';
|
|
1
2
|
import { PathEvent } from './path-events.ts';
|
|
2
3
|
/**
|
|
3
4
|
* Compare version numbers
|
|
@@ -6,6 +7,29 @@ import { PathEvent } from './path-events.ts';
|
|
|
6
7
|
* @return {number} -1 = target is lower, 0 = equal, 1 = higher
|
|
7
8
|
*/
|
|
8
9
|
export declare function compareVersions(target: string, vs: string): -1 | 0 | 1;
|
|
10
|
+
/**
|
|
11
|
+
* Create a console object to intercept logs with optional passthrough
|
|
12
|
+
* @param {null | {debug: Function, log: Function, info: Function, warn: Function, error: Function}} out Passthrough logs, null to silence
|
|
13
|
+
* @param {{[K in LogLevels]?: LogLevels | "none"}} map Map log levels: {log: 'debug', warn: 'error'} = Suppress debug logs, elevate warnings
|
|
14
|
+
* @returns {{debug: Function, log: Function, info: Function, warn: Function, error: Function, stderr: string[], stdout: string[]}}
|
|
15
|
+
*/
|
|
16
|
+
export declare function consoleInterceptor(out?: null | {
|
|
17
|
+
debug: Function;
|
|
18
|
+
log: Function;
|
|
19
|
+
info: Function;
|
|
20
|
+
warn: Function;
|
|
21
|
+
error: Function;
|
|
22
|
+
}, map?: {
|
|
23
|
+
[K in LogLevels]?: LogLevels | 'none';
|
|
24
|
+
}): {
|
|
25
|
+
debug: Function;
|
|
26
|
+
log: Function;
|
|
27
|
+
info: Function;
|
|
28
|
+
warn: Function;
|
|
29
|
+
error: Function;
|
|
30
|
+
stderr: string[];
|
|
31
|
+
stdout: string[];
|
|
32
|
+
};
|
|
9
33
|
/**
|
|
10
34
|
* Escape any regex special characters to avoid misinterpretation during search
|
|
11
35
|
* @param {string} value String which should be escaped
|
package/dist/time.d.ts
CHANGED
|
@@ -10,6 +10,50 @@ export declare function dayOfYear(date: Date): number;
|
|
|
10
10
|
/**
|
|
11
11
|
* Format date
|
|
12
12
|
*
|
|
13
|
+
* Year:
|
|
14
|
+
* - YYYY = 2025 (4-digit year)
|
|
15
|
+
* - YY = 25 (2-digit year)
|
|
16
|
+
*
|
|
17
|
+
* Month:
|
|
18
|
+
* - MMMM = January (full month name)
|
|
19
|
+
* - MMM = Jan (abbreviated month name)
|
|
20
|
+
* - MM = 01 (zero-padded month number)
|
|
21
|
+
* - M = 1 (month number)
|
|
22
|
+
*
|
|
23
|
+
* Day:
|
|
24
|
+
* - DDD = 123 (day of year)
|
|
25
|
+
* - DD = 01 (zero-padded day)
|
|
26
|
+
* - Do = 1st (day with ordinal suffix)
|
|
27
|
+
* - D = 1 (day number)
|
|
28
|
+
* - dddd = Monday (full day name)
|
|
29
|
+
* - ddd = Mon (abbreviated day name)
|
|
30
|
+
*
|
|
31
|
+
* Hour:
|
|
32
|
+
* - HH = 13 (24-hour format, zero-padded)
|
|
33
|
+
* - H = 13 (24-hour format)
|
|
34
|
+
* - hh = 01 (12-hour format, zero-padded)
|
|
35
|
+
* - h = 1 (12-hour format)
|
|
36
|
+
*
|
|
37
|
+
* Minute:
|
|
38
|
+
* - mm = 05 (zero-padded minutes)
|
|
39
|
+
* - m = 5 (minutes)
|
|
40
|
+
*
|
|
41
|
+
* Second:
|
|
42
|
+
* - ss = 09 (zero-padded seconds)
|
|
43
|
+
* - s = 9 (seconds)
|
|
44
|
+
*
|
|
45
|
+
* Millisecond:
|
|
46
|
+
* - SSS = 123 (3-digit milliseconds)
|
|
47
|
+
*
|
|
48
|
+
* AM/PM:
|
|
49
|
+
* - A = AM/PM (uppercase)
|
|
50
|
+
* - a = am/pm (lowercase)
|
|
51
|
+
*
|
|
52
|
+
* Timezone:
|
|
53
|
+
* - ZZ = +0500 (timezone offset without colon)
|
|
54
|
+
* - Z = +05:00 (timezone offset with colon)
|
|
55
|
+
* - z = EST (timezone abbreviation)
|
|
56
|
+
*
|
|
13
57
|
* @param {string} format How date string will be formatted, default: `YYYY-MM-DD H:mm A`
|
|
14
58
|
* @param {Date | number | string} date Date or timestamp, defaults to now
|
|
15
59
|
* @param tz Set timezone offset
|