@ix-xs/node-comfort 1.2.0 → 2.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/CHANGELOG.md +340 -0
- package/README.md +137 -548
- package/index.js +80 -35
- package/package.json +161 -33
- package/src/Arr.js +1050 -418
- package/src/Async.js +817 -0
- package/src/Cache.js +433 -0
- package/src/Checker.js +1202 -539
- package/src/Cli.js +1293 -0
- package/src/Color.js +556 -0
- package/src/Crypto.js +1082 -0
- package/src/Emitter.js +356 -0
- package/src/Env.js +689 -0
- package/src/FS.js +1626 -894
- package/src/Func.js +823 -356
- package/src/Http.js +700 -0
- package/src/Id.js +568 -200
- package/src/Logger.js +963 -378
- package/src/Num.js +965 -360
- package/src/Obj.js +1077 -379
- package/src/SQLite.js +1629 -1005
- package/src/Schema.js +2101 -0
- package/src/Str.js +1209 -432
- package/src/Sys.js +654 -0
- package/src/Time.js +1533 -440
- package/src/Utils.js +342 -325
- package/src/errors.js +335 -0
- package/src/internal/shared.js +415 -0
- package/types/index.d.ts +735 -526
- package/types/src/Arr.d.ts +533 -145
- package/types/src/Arr.d.ts.map +1 -1
- package/types/src/Async.d.ts +372 -0
- package/types/src/Async.d.ts.map +1 -0
- package/types/src/Cache.d.ts +221 -0
- package/types/src/Cache.d.ts.map +1 -0
- package/types/src/Checker.d.ts +651 -232
- package/types/src/Checker.d.ts.map +1 -1
- package/types/src/Cli.d.ts +664 -0
- package/types/src/Cli.d.ts.map +1 -0
- package/types/src/Color.d.ts +300 -0
- package/types/src/Color.d.ts.map +1 -0
- package/types/src/Crypto.d.ts +620 -0
- package/types/src/Crypto.d.ts.map +1 -0
- package/types/src/Emitter.d.ts +189 -0
- package/types/src/Emitter.d.ts.map +1 -0
- package/types/src/Env.d.ts +412 -0
- package/types/src/Env.d.ts.map +1 -0
- package/types/src/FS.d.ts +717 -238
- package/types/src/FS.d.ts.map +1 -1
- package/types/src/Func.d.ts +508 -135
- package/types/src/Func.d.ts.map +1 -1
- package/types/src/Http.d.ts +444 -0
- package/types/src/Http.d.ts.map +1 -0
- package/types/src/Id.d.ts +199 -66
- package/types/src/Id.d.ts.map +1 -1
- package/types/src/Logger.d.ts +414 -46
- package/types/src/Logger.d.ts.map +1 -1
- package/types/src/Num.d.ts +514 -137
- package/types/src/Num.d.ts.map +1 -1
- package/types/src/Obj.d.ts +453 -104
- package/types/src/Obj.d.ts.map +1 -1
- package/types/src/SQLite.d.ts +754 -308
- package/types/src/SQLite.d.ts.map +1 -1
- package/types/src/Schema.d.ts +1189 -0
- package/types/src/Schema.d.ts.map +1 -0
- package/types/src/Str.d.ts +617 -166
- package/types/src/Str.d.ts.map +1 -1
- package/types/src/Sys.d.ts +314 -0
- package/types/src/Sys.d.ts.map +1 -0
- package/types/src/Time.d.ts +759 -204
- package/types/src/Time.d.ts.map +1 -1
- package/types/src/Utils.d.ts +158 -102
- package/types/src/Utils.d.ts.map +1 -1
- package/types/src/errors.d.ts +316 -0
- package/types/src/errors.d.ts.map +1 -0
- package/types/src/internal/shared.d.ts +123 -0
- package/types/src/internal/shared.d.ts.map +1 -0
- package/types/index.d.ts.map +0 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parsed cron fields. `lastDay` is set by `L` in the day-of-month field.
|
|
3
|
+
*/
|
|
4
|
+
export type CronSpec = {
|
|
5
|
+
seconds: Set<number>;
|
|
6
|
+
minutes: Set<number>;
|
|
7
|
+
hours: Set<number>;
|
|
8
|
+
days: Set<number>;
|
|
9
|
+
months: Set<number>;
|
|
10
|
+
weekdays: Set<number>;
|
|
11
|
+
anyDay: boolean;
|
|
12
|
+
anyWeekday: boolean;
|
|
13
|
+
lastDay: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** Keys that must never be copied onto an object: they reach its prototype. */
|
|
16
|
+
export const UNSAFE_KEYS: Set<string>;
|
|
17
|
+
export namespace MS {
|
|
18
|
+
let ms: number;
|
|
19
|
+
let s: number;
|
|
20
|
+
let m: number;
|
|
21
|
+
let h: number;
|
|
22
|
+
let d: number;
|
|
23
|
+
let w: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The defaults set with `time.setLocale()` and `time.setTimezone()`. English
|
|
27
|
+
* by default, so output never depends on the machine.
|
|
28
|
+
* @type {{ locale: string, timeZone: string | undefined }}
|
|
29
|
+
*/
|
|
30
|
+
export const timeConfig: {
|
|
31
|
+
locale: string;
|
|
32
|
+
timeZone: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
export const ASCII: RegExp;
|
|
35
|
+
/**
|
|
36
|
+
* @param {unknown} value
|
|
37
|
+
* @returns {value is Record<string, any>}
|
|
38
|
+
*/
|
|
39
|
+
export function isPlainObject(value: unknown): value is Record<string, any>;
|
|
40
|
+
/**
|
|
41
|
+
* @param {string} unit
|
|
42
|
+
* @returns {keyof typeof MS | "M" | "y" | undefined}
|
|
43
|
+
*/
|
|
44
|
+
export function unitOf(unit: string): keyof typeof MS | "M" | "y" | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* A duration in milliseconds, or `null` when the input isn't one.
|
|
47
|
+
* @param {unknown} input
|
|
48
|
+
* @returns {number | null}
|
|
49
|
+
*/
|
|
50
|
+
export function parseDuration(input: unknown): number | null;
|
|
51
|
+
/**
|
|
52
|
+
* Milliseconds from a number or a duration string.
|
|
53
|
+
* @param {number | string} value
|
|
54
|
+
* @param {string} [what="duration"] Names the value in the error message.
|
|
55
|
+
* @returns {number}
|
|
56
|
+
* @throws {TypeError} If it can't be read.
|
|
57
|
+
*/
|
|
58
|
+
export function toMs(value: number | string, what?: string): number;
|
|
59
|
+
/**
|
|
60
|
+
* `setTimeout` that also works past its 24.8-day limit. `Infinity` never fires.
|
|
61
|
+
* @param {() => void} fn
|
|
62
|
+
* @param {number} ms
|
|
63
|
+
* @param {boolean} [unref=false]
|
|
64
|
+
* @returns {() => void} Cancels the timer.
|
|
65
|
+
*/
|
|
66
|
+
export function setLongTimeout(fn: () => void, ms: number, unref?: boolean): () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Resolves after `ms`, or rejects with an `AbortError` when the signal fires.
|
|
69
|
+
* @param {number} ms
|
|
70
|
+
* @param {AbortSignal} [signal]
|
|
71
|
+
* @param {boolean} [unref=false]
|
|
72
|
+
* @returns {Promise<void>}
|
|
73
|
+
*/
|
|
74
|
+
export function sleep(ms: number, signal?: AbortSignal, unref?: boolean): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Blocks the thread for a few milliseconds. Only for short retries of
|
|
77
|
+
* synchronous file operations.
|
|
78
|
+
* @param {number} ms
|
|
79
|
+
*/
|
|
80
|
+
export function sleepSync(ms: number): void;
|
|
81
|
+
export namespace intl {
|
|
82
|
+
let number: (locale?: string, options?: object) => Intl.NumberFormat;
|
|
83
|
+
let dateTime: (locale?: string, options?: object) => Intl.DateTimeFormat;
|
|
84
|
+
let plural: (locale?: string, options?: object) => Intl.PluralRules;
|
|
85
|
+
let collator: (locale?: string, options?: object) => Intl.Collator;
|
|
86
|
+
let relativeTime: (locale?: string, options?: object) => Intl.RelativeTimeFormat;
|
|
87
|
+
let list: (locale?: string, options?: object) => Intl.ListFormat;
|
|
88
|
+
}
|
|
89
|
+
/** The grapheme segmenter, built on first use. */
|
|
90
|
+
export function segmenter(): Intl.Segmenter;
|
|
91
|
+
/**
|
|
92
|
+
* Splits text into graphemes, so emoji and accents stay whole.
|
|
93
|
+
* @param {string} input
|
|
94
|
+
* @returns {string[]}
|
|
95
|
+
*/
|
|
96
|
+
export function graphemes(input: string): string[];
|
|
97
|
+
/**
|
|
98
|
+
* Counts graphemes without building an array.
|
|
99
|
+
* @param {string} input
|
|
100
|
+
* @returns {number}
|
|
101
|
+
*/
|
|
102
|
+
export function graphemeCount(input: string): number;
|
|
103
|
+
/**
|
|
104
|
+
* Adds numbers with Neumaier's compensation, so `0.1 + 0.2 + 0.3` is `0.6`.
|
|
105
|
+
* @param {Iterable<number>} values
|
|
106
|
+
* @returns {number}
|
|
107
|
+
*/
|
|
108
|
+
export function preciseSum(values: Iterable<number>): number;
|
|
109
|
+
/**
|
|
110
|
+
* A cache key for a list of arguments. Primitives are compared by value and
|
|
111
|
+
* type, plain objects and arrays by content, everything else by identity.
|
|
112
|
+
* @param {readonly unknown[]} args
|
|
113
|
+
* @returns {unknown} A primitive usable as a `Map` key.
|
|
114
|
+
*/
|
|
115
|
+
export function argsKey(args: readonly unknown[]): unknown;
|
|
116
|
+
/**
|
|
117
|
+
* Parses a cron expression with 5 fields, or 6 with seconds first.
|
|
118
|
+
* @param {string} expression
|
|
119
|
+
* @returns {CronSpec}
|
|
120
|
+
* @throws {SyntaxError} If the expression is invalid.
|
|
121
|
+
*/
|
|
122
|
+
export function parseCron(expression: string): CronSpec;
|
|
123
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/internal/shared.js"],"names":[],"mappings":";;;uBAmTa;IAAE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE;AA7StM,+EAA+E;AAC/E,sCAAuE;;;;;;;;;AAevE;;;;GAIG;AACH,yBAFU;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAED;AA8KzD,2BAA+B;AAhM/B;;;GAGG;AACH,qCAHW,OAAO,GACL,KAAK,IAAI,MAAM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