@develia/commons 0.4.14 → 0.4.16
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/cjs/array.js +43 -1
- package/dist/cjs/array.js.map +1 -1
- package/dist/cjs/async-pool-executor.js +15 -0
- package/dist/cjs/async-pool-executor.js.map +1 -1
- package/dist/cjs/browser/form-utilities.js +26 -0
- package/dist/cjs/browser/form-utilities.js.map +1 -1
- package/dist/cjs/browser/geo-location.js +5 -0
- package/dist/cjs/browser/geo-location.js.map +1 -1
- package/dist/cjs/browser/index.js.map +1 -1
- package/dist/cjs/browser/native-bridge.js +9 -0
- package/dist/cjs/browser/native-bridge.js.map +1 -1
- package/dist/cjs/cancellable-promise.js.map +1 -1
- package/dist/cjs/clean-url-search-params.js +1 -0
- package/dist/cjs/clean-url-search-params.js.map +1 -1
- package/dist/cjs/collections/cache-dictionary.js +39 -0
- package/dist/cjs/collections/cache-dictionary.js.map +1 -1
- package/dist/cjs/collections/default-map.js +25 -1
- package/dist/cjs/collections/default-map.js.map +1 -1
- package/dist/cjs/collections/default-weak-map.js +23 -3
- package/dist/cjs/collections/default-weak-map.js.map +1 -1
- package/dist/cjs/{from.js → collections/from.js} +278 -4
- package/dist/cjs/collections/from.js.map +1 -0
- package/dist/cjs/collections/index.js +3 -1
- package/dist/cjs/collections/index.js.map +1 -1
- package/dist/cjs/draft.js +37 -0
- package/dist/cjs/draft.js.map +1 -1
- package/dist/cjs/event-bus.js +1 -0
- package/dist/cjs/event-bus.js.map +1 -1
- package/dist/cjs/index.js +16 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/key-value-pair.js +6 -0
- package/dist/cjs/key-value-pair.js.map +1 -1
- package/dist/cjs/lazy.js +4 -0
- package/dist/cjs/lazy.js.map +1 -1
- package/dist/cjs/math.js +19 -0
- package/dist/cjs/math.js.map +1 -1
- package/dist/cjs/order.js.map +1 -1
- package/dist/cjs/parse.js +96 -0
- package/dist/cjs/parse.js.map +1 -1
- package/dist/cjs/patch.js +10 -2
- package/dist/cjs/patch.js.map +1 -1
- package/dist/cjs/range.js +154 -0
- package/dist/cjs/range.js.map +1 -0
- package/dist/cjs/stopwatch.js +10 -0
- package/dist/cjs/stopwatch.js.map +1 -1
- package/dist/cjs/string.js +62 -0
- package/dist/cjs/string.js.map +1 -1
- package/dist/cjs/timer.js +7 -0
- package/dist/cjs/timer.js.map +1 -1
- package/dist/cjs/timespan.js +202 -0
- package/dist/cjs/timespan.js.map +1 -1
- package/dist/cjs/type-code.js.map +1 -1
- package/dist/cjs/type.js +80 -1
- package/dist/cjs/type.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utilities.js +183 -0
- package/dist/cjs/utilities.js.map +1 -1
- package/dist/esm/array.js +42 -1
- package/dist/esm/array.js.map +1 -1
- package/dist/esm/async-pool-executor.js +15 -0
- package/dist/esm/async-pool-executor.js.map +1 -1
- package/dist/esm/browser/form-utilities.js +26 -0
- package/dist/esm/browser/form-utilities.js.map +1 -1
- package/dist/esm/browser/geo-location.js +5 -0
- package/dist/esm/browser/geo-location.js.map +1 -1
- package/dist/esm/browser/index.js.map +1 -1
- package/dist/esm/browser/native-bridge.js +9 -0
- package/dist/esm/browser/native-bridge.js.map +1 -1
- package/dist/esm/cancellable-promise.js.map +1 -1
- package/dist/esm/clean-url-search-params.js +1 -0
- package/dist/esm/clean-url-search-params.js.map +1 -1
- package/dist/esm/collections/cache-dictionary.js +39 -0
- package/dist/esm/collections/cache-dictionary.js.map +1 -1
- package/dist/esm/collections/default-map.js +25 -1
- package/dist/esm/collections/default-map.js.map +1 -1
- package/dist/esm/collections/default-weak-map.js +22 -2
- package/dist/esm/collections/default-weak-map.js.map +1 -1
- package/dist/esm/{from.js → collections/from.js} +278 -4
- package/dist/esm/collections/from.js.map +1 -0
- package/dist/esm/collections/index.js +1 -0
- package/dist/esm/collections/index.js.map +1 -1
- package/dist/esm/draft.js +37 -0
- package/dist/esm/draft.js.map +1 -1
- package/dist/esm/event-bus.js +1 -0
- package/dist/esm/event-bus.js.map +1 -1
- package/dist/esm/index.js +14 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/key-value-pair.js +6 -0
- package/dist/esm/key-value-pair.js.map +1 -1
- package/dist/esm/lazy.js +4 -0
- package/dist/esm/lazy.js.map +1 -1
- package/dist/esm/math.js +19 -0
- package/dist/esm/math.js.map +1 -1
- package/dist/esm/order.js.map +1 -1
- package/dist/esm/parse.js +96 -0
- package/dist/esm/parse.js.map +1 -1
- package/dist/esm/patch.js +10 -2
- package/dist/esm/patch.js.map +1 -1
- package/dist/esm/range.js +151 -0
- package/dist/esm/range.js.map +1 -0
- package/dist/esm/stopwatch.js +10 -0
- package/dist/esm/stopwatch.js.map +1 -1
- package/dist/esm/string.js +62 -0
- package/dist/esm/string.js.map +1 -1
- package/dist/esm/timer.js +7 -0
- package/dist/esm/timer.js.map +1 -1
- package/dist/esm/timespan.js +202 -0
- package/dist/esm/timespan.js.map +1 -1
- package/dist/esm/type-code.js.map +1 -1
- package/dist/esm/type.js +80 -1
- package/dist/esm/type.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utilities.js +183 -0
- package/dist/esm/utilities.js.map +1 -1
- package/dist/types/array.d.ts +35 -0
- package/dist/types/array.d.ts.map +1 -1
- package/dist/types/async-pool-executor.d.ts +15 -0
- package/dist/types/async-pool-executor.d.ts.map +1 -1
- package/dist/types/browser/form-utilities.d.ts +13 -0
- package/dist/types/browser/form-utilities.d.ts.map +1 -1
- package/dist/types/browser/index.d.ts.map +1 -1
- package/dist/types/browser/native-bridge.d.ts +6 -0
- package/dist/types/browser/native-bridge.d.ts.map +1 -1
- package/dist/types/collections/cache-dictionary.d.ts +39 -0
- package/dist/types/collections/cache-dictionary.d.ts.map +1 -1
- package/dist/types/collections/default-map.d.ts +23 -0
- package/dist/types/collections/default-map.d.ts.map +1 -1
- package/dist/types/collections/default-weak-map.d.ts +20 -1
- package/dist/types/collections/default-weak-map.d.ts.map +1 -1
- package/dist/types/collections/from.d.ts +333 -0
- package/dist/types/collections/from.d.ts.map +1 -0
- package/dist/types/collections/index.d.ts +1 -0
- package/dist/types/collections/index.d.ts.map +1 -1
- package/dist/types/draft.d.ts +68 -0
- package/dist/types/draft.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/key-value-pair.d.ts +6 -0
- package/dist/types/key-value-pair.d.ts.map +1 -1
- package/dist/types/lazy.d.ts +4 -0
- package/dist/types/lazy.d.ts.map +1 -1
- package/dist/types/math.d.ts +19 -0
- package/dist/types/math.d.ts.map +1 -1
- package/dist/types/parse.d.ts +121 -0
- package/dist/types/parse.d.ts.map +1 -1
- package/dist/types/range.d.ts +72 -0
- package/dist/types/range.d.ts.map +1 -0
- package/dist/types/string.d.ts +51 -0
- package/dist/types/string.d.ts.map +1 -1
- package/dist/types/timer.d.ts +7 -0
- package/dist/types/timer.d.ts.map +1 -1
- package/dist/types/timespan.d.ts +202 -0
- package/dist/types/timespan.d.ts.map +1 -1
- package/dist/types/type.d.ts +40 -0
- package/dist/types/type.d.ts.map +1 -1
- package/dist/types/utilities.d.ts +171 -0
- package/dist/types/utilities.d.ts.map +1 -1
- package/dist/web/array.js +42 -1
- package/dist/web/array.js.map +1 -1
- package/dist/web/async-pool-executor.js +15 -0
- package/dist/web/async-pool-executor.js.map +1 -1
- package/dist/web/browser/form-utilities.js +26 -0
- package/dist/web/browser/form-utilities.js.map +1 -1
- package/dist/web/browser/geo-location.js +5 -0
- package/dist/web/browser/geo-location.js.map +1 -1
- package/dist/web/browser/index.js.map +1 -1
- package/dist/web/browser/native-bridge.js +9 -0
- package/dist/web/browser/native-bridge.js.map +1 -1
- package/dist/web/cancellable-promise.js.map +1 -1
- package/dist/web/clean-url-search-params.js +1 -0
- package/dist/web/clean-url-search-params.js.map +1 -1
- package/dist/web/collections/cache-dictionary.js +39 -0
- package/dist/web/collections/cache-dictionary.js.map +1 -1
- package/dist/web/collections/default-map.js +25 -1
- package/dist/web/collections/default-map.js.map +1 -1
- package/dist/web/collections/default-weak-map.js +22 -2
- package/dist/web/collections/default-weak-map.js.map +1 -1
- package/dist/web/{from.js → collections/from.js} +279 -5
- package/dist/web/collections/from.js.map +1 -0
- package/dist/web/collections/index.js +1 -0
- package/dist/web/collections/index.js.map +1 -1
- package/dist/web/draft.js +37 -0
- package/dist/web/draft.js.map +1 -1
- package/dist/web/event-bus.js +1 -0
- package/dist/web/event-bus.js.map +1 -1
- package/dist/web/index.js +14 -1
- package/dist/web/index.js.map +1 -1
- package/dist/web/key-value-pair.js +6 -0
- package/dist/web/key-value-pair.js.map +1 -1
- package/dist/web/lazy.js +4 -0
- package/dist/web/lazy.js.map +1 -1
- package/dist/web/math.js +19 -0
- package/dist/web/math.js.map +1 -1
- package/dist/web/order.js.map +1 -1
- package/dist/web/parse.js +96 -0
- package/dist/web/parse.js.map +1 -1
- package/dist/web/patch.js +10 -2
- package/dist/web/patch.js.map +1 -1
- package/dist/web/range.js +151 -0
- package/dist/web/range.js.map +1 -0
- package/dist/web/stopwatch.js +10 -0
- package/dist/web/stopwatch.js.map +1 -1
- package/dist/web/string.js +62 -0
- package/dist/web/string.js.map +1 -1
- package/dist/web/timer.js +7 -0
- package/dist/web/timer.js.map +1 -1
- package/dist/web/timespan.js +202 -0
- package/dist/web/timespan.js.map +1 -1
- package/dist/web/type-code.js.map +1 -1
- package/dist/web/type.js +80 -1
- package/dist/web/type.js.map +1 -1
- package/dist/web/types.js.map +1 -1
- package/dist/web/utilities.js +183 -0
- package/dist/web/utilities.js.map +1 -1
- package/package.json +1 -1
- package/src/array.ts +16 -0
- package/src/browser/index.ts +2 -2
- package/src/collections/cache-dictionary.ts +39 -1
- package/src/collections/default-map.ts +15 -9
- package/src/collections/default-weak-map.ts +14 -12
- package/src/{from.ts → collections/from.ts} +285 -15
- package/src/collections/index.ts +4 -3
- package/src/index.ts +43 -42
- package/src/range.ts +165 -0
- package/src/timespan.ts +199 -20
- package/dist/cjs/from.js.map +0 -1
- package/dist/esm/from.js.map +0 -1
- package/dist/types/from.d.ts +0 -59
- package/dist/types/from.d.ts.map +0 -1
- package/dist/web/from.js.map +0 -1
package/dist/types/parse.d.ts
CHANGED
|
@@ -1,16 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for {@link parseBoolean}.
|
|
3
|
+
*/
|
|
1
4
|
export interface ParseBooleanOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Additional strings to consider as `true`.
|
|
7
|
+
* These are matched case-insensitively.
|
|
8
|
+
* @example ["oui", "ja"]
|
|
9
|
+
*/
|
|
2
10
|
extraTruthy?: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Additional strings to consider as `false`.
|
|
13
|
+
* These are matched case-insensitively.
|
|
14
|
+
* @example ["non", "nein"]
|
|
15
|
+
*/
|
|
3
16
|
extraFalsy?: string[];
|
|
4
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for {@link parseInteger}.
|
|
20
|
+
*/
|
|
5
21
|
export interface ParseIntegerOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Numeric base for conversion.
|
|
24
|
+
* @default 10
|
|
25
|
+
*/
|
|
6
26
|
radix?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Thousands separator to strip before parsing.
|
|
29
|
+
* @example "." for "1.234.567" → 1234567
|
|
30
|
+
* @example "," for "1,234,567" → 1234567
|
|
31
|
+
*/
|
|
7
32
|
thousandsSeparator?: string;
|
|
8
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Options for {@link parseDecimal}.
|
|
36
|
+
*/
|
|
9
37
|
export interface ParseDecimalOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Character used as decimal point.
|
|
40
|
+
* @default "."
|
|
41
|
+
*/
|
|
10
42
|
decimalSeparator?: "." | ",";
|
|
43
|
+
/**
|
|
44
|
+
* Thousands separator to strip before parsing.
|
|
45
|
+
* @example "." for "1.234,56" (EU format)
|
|
46
|
+
* @example "," for "1,234.56" (US format)
|
|
47
|
+
*/
|
|
11
48
|
thousandsSeparator?: string;
|
|
12
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Safely parses a value into an integer.
|
|
52
|
+
* Returns `null` if the value cannot be parsed.
|
|
53
|
+
*
|
|
54
|
+
* - `null` or `undefined` → `null`
|
|
55
|
+
* - `number` → returned as-is (floats are truncated)
|
|
56
|
+
* - `string` → parsed with the given options
|
|
57
|
+
*
|
|
58
|
+
* @param value - The value to parse.
|
|
59
|
+
* @param options - Optional parsing configuration.
|
|
60
|
+
* @returns The parsed integer, or `null` on failure.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* parseInteger(42) // 42
|
|
65
|
+
* parseInteger(3.7) // 3
|
|
66
|
+
* parseInteger(null) // null
|
|
67
|
+
* parseInteger(undefined) // null
|
|
68
|
+
* parseInteger("42") // 42
|
|
69
|
+
* parseInteger("1.234.567", { thousandsSeparator: "." }) // 1234567
|
|
70
|
+
* parseInteger("FF", { radix: 16 }) // 255
|
|
71
|
+
* parseInteger("abc") // null
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
13
74
|
export declare function parseInteger(value: string | number | null | undefined, options?: ParseIntegerOptions): number | null;
|
|
75
|
+
/**
|
|
76
|
+
* Safely parses a value into a floating-point number.
|
|
77
|
+
* Returns `null` if the value cannot be parsed.
|
|
78
|
+
*
|
|
79
|
+
* - `null` or `undefined` → `null`
|
|
80
|
+
* - `number` → returned as-is (if finite)
|
|
81
|
+
* - `string` → parsed with the given options
|
|
82
|
+
*
|
|
83
|
+
* Supports custom decimal and thousands separators, making it suitable
|
|
84
|
+
* for both US (`1,234.56`) and EU (`1.234,56`) number formats.
|
|
85
|
+
*
|
|
86
|
+
* @param value - The value to parse.
|
|
87
|
+
* @param options - Optional parsing configuration.
|
|
88
|
+
* @returns The parsed float, or `null` on failure.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* parseDecimal(3.14) // 3.14
|
|
93
|
+
* parseDecimal(null) // null
|
|
94
|
+
* parseDecimal(undefined) // null
|
|
95
|
+
* parseDecimal("3.14") // 3.14
|
|
96
|
+
* parseDecimal("3,14", { decimalSeparator: "," }) // 3.14
|
|
97
|
+
* parseDecimal("1.234,56", { decimalSeparator: ",", thousandsSeparator: "." }) // 1234.56
|
|
98
|
+
* parseDecimal("abc") // null
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
14
101
|
export declare function parseDecimal(value: string | number | null | undefined, options?: ParseDecimalOptions): number | null;
|
|
102
|
+
/**
|
|
103
|
+
* Safely parses a value into a boolean.
|
|
104
|
+
* Returns `null` if the value cannot be interpreted as boolean.
|
|
105
|
+
*
|
|
106
|
+
* - `null` or `undefined` → `null`
|
|
107
|
+
* - `boolean` → returned as-is
|
|
108
|
+
* - `number` → `0` is `false`, any other finite number is `true`
|
|
109
|
+
* - `string` → matched case-insensitively against known truthy/falsy values
|
|
110
|
+
*
|
|
111
|
+
* Default truthy: `"true"`, `"1"`, `"yes"`, `"si"`, `"sí"`, `"on"`
|
|
112
|
+
* Default falsy: `"false"`, `"0"`, `"no"`, `"off"`
|
|
113
|
+
*
|
|
114
|
+
* @param value - The value to parse.
|
|
115
|
+
* @param options - Optional parsing configuration.
|
|
116
|
+
* @returns The parsed boolean, or `null` on failure.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* parseBoolean(true) // true
|
|
121
|
+
* parseBoolean(false) // false
|
|
122
|
+
* parseBoolean(1) // true
|
|
123
|
+
* parseBoolean(0) // false
|
|
124
|
+
* parseBoolean(null) // null
|
|
125
|
+
* parseBoolean(undefined) // null
|
|
126
|
+
* parseBoolean("yes") // true
|
|
127
|
+
* parseBoolean("no") // false
|
|
128
|
+
* parseBoolean("sí") // true
|
|
129
|
+
* parseBoolean("TRUE") // true
|
|
130
|
+
* parseBoolean("oui") // null
|
|
131
|
+
* parseBoolean("oui", { extraTruthy: ["oui"] }) // true
|
|
132
|
+
* parseBoolean("nein", { extraFalsy: ["nein"] }) // false
|
|
133
|
+
* parseBoolean("whatever") // null
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
15
136
|
export declare function parseBoolean(value: string | number | boolean | null | undefined, options?: ParseBooleanOptions): boolean | null;
|
|
16
137
|
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/parse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/parse.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAEvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IAE7B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAeD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,OAAO,GAAE,mBAAwB,GAClC,MAAM,GAAG,IAAI,CAiBf;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,OAAO,GAAE,mBAAwB,GAClC,MAAM,GAAG,IAAI,CAwBf;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EACnD,OAAO,GAAE,mBAAwB,GAClC,OAAO,GAAG,IAAI,CAsBhB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export default class Range<T> {
|
|
2
|
+
private readonly start;
|
|
3
|
+
private readonly end;
|
|
4
|
+
/**
|
|
5
|
+
* Range constructor.
|
|
6
|
+
* @param start
|
|
7
|
+
* @param end
|
|
8
|
+
*/
|
|
9
|
+
constructor(start: T, end: T);
|
|
10
|
+
/**
|
|
11
|
+
* Finds the intersection between two ranges.
|
|
12
|
+
*
|
|
13
|
+
* @param other The Range object to intersect with.
|
|
14
|
+
* @returns The intersected Range object, or null if there is no intersection.
|
|
15
|
+
*/
|
|
16
|
+
intersect(other: Range<T>): Range<T> | null;
|
|
17
|
+
/**
|
|
18
|
+
* Subtract the given range from this range.
|
|
19
|
+
*
|
|
20
|
+
* @param other The range to subtract from this range.
|
|
21
|
+
* @returns An array of Range objects representing the result of the subtraction.
|
|
22
|
+
*/
|
|
23
|
+
subtract(other: Range<T>): Range<T>[];
|
|
24
|
+
/**
|
|
25
|
+
* Determines if the given range overlaps with the current range.
|
|
26
|
+
*
|
|
27
|
+
* @param other The range to be checked for overlap.
|
|
28
|
+
* @returns Returns true if there is an overlap between the ranges, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
overlaps(other: Range<T>): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Determines whether the specified value is within the range defined by the start and end values.
|
|
33
|
+
*
|
|
34
|
+
* @param obj The value to check if it is within the range.
|
|
35
|
+
* @param inclusive Optional. If set to true, the range boundaries are considered inclusive.
|
|
36
|
+
* @returns Returns true if the specified value is within the range, false otherwise.
|
|
37
|
+
*/
|
|
38
|
+
contains(obj: T, inclusive?: boolean): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @returns T
|
|
41
|
+
*/
|
|
42
|
+
getStart(): T;
|
|
43
|
+
/**
|
|
44
|
+
* @returns T
|
|
45
|
+
*/
|
|
46
|
+
getEnd(): T;
|
|
47
|
+
/**
|
|
48
|
+
* Finds the intersection between two sets of ranges.
|
|
49
|
+
*
|
|
50
|
+
* @param ranges1
|
|
51
|
+
* @param ranges2
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
static intersectRanges<T>(ranges1: Range<T>[], ranges2: Range<T>[]): Range<T>[];
|
|
55
|
+
/**
|
|
56
|
+
* Determines if any range in the first set overlaps with any range in the second set.
|
|
57
|
+
*
|
|
58
|
+
* @param ranges1
|
|
59
|
+
* @param ranges2
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
static overlapsAny<T>(ranges1: Range<T>[], ranges2: Range<T>[]): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Subtracts the second set of ranges from the first set of ranges.
|
|
65
|
+
*
|
|
66
|
+
* @param ranges1
|
|
67
|
+
* @param ranges2
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
static subtractRanges<T>(ranges1: Range<T>[], ranges2: Range<T>[]): Range<T>[];
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=range.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../src/range.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,KAAK,CAAC,CAAC;IAExB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAI;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAI;IAExB;;;;OAIG;gBACS,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;IAK5B;;;;;OAKG;IACI,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI;IAWlD;;;;;OAKG;IACI,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;IAoB5C;;;;;OAKG;IACI,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO;IAWzC;;;;;;OAMG;IACI,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,SAAS,GAAE,OAAc,GAAG,OAAO;IAM3D;;OAEG;IACI,QAAQ,IAAI,CAAC;IAIpB;;OAEG;IACI,MAAM,IAAI,CAAC;IAIlB;;;;;;OAMG;WACW,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;IAatF;;;;;;OAMG;WACW,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO;IAW/E;;;;;;OAMG;WACW,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;CAiBxF"}
|
package/dist/types/string.d.ts
CHANGED
|
@@ -1,9 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures that a given string has a specific prefix.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} str - The string to ensure the prefix on.
|
|
5
|
+
* @param {string} prefix - The prefix to ensure on the string.
|
|
6
|
+
* @return {string} - The resulting string with the ensured prefix.
|
|
7
|
+
*/
|
|
1
8
|
export declare function ensurePrefix(str: string, prefix: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Ensures that a string ends with a specified suffix.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} str - The original string.
|
|
13
|
+
* @param {string} suffix - The suffix to ensure.
|
|
14
|
+
* @return {string} - The modified string with the suffix added if it was not already present.
|
|
15
|
+
*/
|
|
2
16
|
export declare function ensureSuffix(str: string, suffix: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Formats a string using a template and provided arguments.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} template - The template string containing placeholders.
|
|
21
|
+
* @param {any[]} args - Optional arguments to replace the placeholders in the template.
|
|
22
|
+
* @return {string} The formatted string.
|
|
23
|
+
*/
|
|
3
24
|
export declare function format(template: string, ...args: any[]): string;
|
|
25
|
+
/**
|
|
26
|
+
* Converts a string to snake_case.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} str - The string to convert.
|
|
29
|
+
* @return {string} - The string converted to snake_case.
|
|
30
|
+
*/
|
|
4
31
|
export declare function toSnakeCase(str: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Converts a string to kebab-case.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} str - The string to convert.
|
|
36
|
+
* @return {string} - The string converted to kebab-case.
|
|
37
|
+
*/
|
|
5
38
|
export declare function toKebabCase(str: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Converts a string to camelCase.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} str - The string to convert.
|
|
43
|
+
* @return {string} - The string converted to camelCase.
|
|
44
|
+
*/
|
|
6
45
|
export declare function toCamelCase(str: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Converts a string to PascalCase.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} str - The string to convert.
|
|
50
|
+
* @return {string} - The string converted to PascalCase.
|
|
51
|
+
*/
|
|
7
52
|
export declare function toPascalCase(str: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Converts a string to CONSTANT_CASE (a.k.a. SCREAMING_SNAKE_CASE).
|
|
55
|
+
*
|
|
56
|
+
* @param {string} str - The string to convert.
|
|
57
|
+
* @return {string} - The string converted to CONSTANT_CASE.
|
|
58
|
+
*/
|
|
8
59
|
export declare function toConstantCase(str: string): string;
|
|
9
60
|
//# sourceMappingURL=string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/string.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/string.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIhE;AAGD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIhE;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAa/D;AA0BD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
package/dist/types/timer.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A class representing a timer that executes a callback function at a specified interval.
|
|
3
|
+
*/
|
|
1
4
|
export default class Timer {
|
|
2
5
|
private _callback;
|
|
3
6
|
private _interval;
|
|
4
7
|
private _intervalId;
|
|
8
|
+
/**
|
|
9
|
+
* @param callback Callback
|
|
10
|
+
* @param interval Seconds between calls
|
|
11
|
+
*/
|
|
5
12
|
constructor(callback: () => void, interval: number);
|
|
6
13
|
get running(): boolean;
|
|
7
14
|
get interval(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/timer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/timer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,KAAK;IAEtB,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAa;IAEhC;;;OAGG;gBACS,QAAQ,EAAE,MAAM,IAAI,EAAE,QAAQ,EAAE,MAAM;IAOlD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAMzB;IAED,IAAI,QAAQ,IAAI,MAAM,IAAI,CAEzB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,EAI7B;IAGD,KAAK,IAAI,IAAI;IASb,IAAI,IAAI,IAAI;IAOZ,OAAO,IAAI,IAAI;CAIlB"}
|
package/dist/types/timespan.d.ts
CHANGED
|
@@ -1,47 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a duration of time in milliseconds.
|
|
3
|
+
*/
|
|
1
4
|
export default class TimeSpan {
|
|
2
5
|
milliseconds: number;
|
|
3
6
|
private constructor();
|
|
7
|
+
/**
|
|
8
|
+
* Gets the time interval in seconds.
|
|
9
|
+
* @returns {number} The duration in seconds.
|
|
10
|
+
*/
|
|
4
11
|
seconds(): number;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the time interval in minutes.
|
|
14
|
+
* @returns {number} The duration in minutes.
|
|
15
|
+
*/
|
|
5
16
|
minutes(): number;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the time interval in hours.
|
|
19
|
+
* @returns {number} The duration in hours.
|
|
20
|
+
*/
|
|
6
21
|
hours(): number;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the time interval in days.
|
|
24
|
+
* @returns {number} The duration in days.
|
|
25
|
+
*/
|
|
7
26
|
days(): number;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the time interval in weeks.
|
|
29
|
+
* @returns {number} The duration in weeks.
|
|
30
|
+
*/
|
|
8
31
|
weeks(): number;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a TimeSpan from a specified number of milliseconds.
|
|
34
|
+
* @param {number} milliseconds - The number of milliseconds.
|
|
35
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
36
|
+
*/
|
|
9
37
|
static fromMilliseconds(milliseconds: number): TimeSpan;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a TimeSpan from a specified number of seconds.
|
|
40
|
+
* @param {number} seconds - The number of seconds.
|
|
41
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
42
|
+
*/
|
|
10
43
|
static fromSeconds(seconds: number): TimeSpan;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a TimeSpan from a specified number of minutes.
|
|
46
|
+
* @param {number} minutes - The number of minutes.
|
|
47
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
48
|
+
*/
|
|
11
49
|
static fromMinutes(minutes: number): TimeSpan;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a TimeSpan from a specified number of hours.
|
|
52
|
+
* @param {number} hours - The number of hours.
|
|
53
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
54
|
+
*/
|
|
12
55
|
static fromHours(hours: number): TimeSpan;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a TimeSpan from a specified number of days.
|
|
58
|
+
* @param {number} days - The number of days.
|
|
59
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
60
|
+
*/
|
|
13
61
|
static fromDays(days: number): TimeSpan;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a TimeSpan from a specified number of weeks.
|
|
64
|
+
* @param {number} weeks - The number of weeks.
|
|
65
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
66
|
+
*/
|
|
14
67
|
static fromWeeks(weeks: number): TimeSpan;
|
|
68
|
+
/**
|
|
69
|
+
* Returns a new TimeSpan that adds the specified number of milliseconds to this instance.
|
|
70
|
+
* @param {number} milliseconds - The milliseconds to add.
|
|
71
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
72
|
+
*/
|
|
15
73
|
addMilliseconds(milliseconds: number): TimeSpan;
|
|
74
|
+
/**
|
|
75
|
+
* Returns a new TimeSpan that adds the specified number of seconds to this instance.
|
|
76
|
+
* @param {number} seconds - The seconds to add.
|
|
77
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
78
|
+
*/
|
|
16
79
|
addSeconds(seconds: number): TimeSpan;
|
|
80
|
+
/**
|
|
81
|
+
* Returns a new TimeSpan that adds the specified number of minutes to this instance.
|
|
82
|
+
* @param {number} minutes - The minutes to add.
|
|
83
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
84
|
+
*/
|
|
17
85
|
addMinutes(minutes: number): TimeSpan;
|
|
86
|
+
/**
|
|
87
|
+
* Returns a new TimeSpan that adds the specified number of hours to this instance.
|
|
88
|
+
* @param {number} hours - The hours to add.
|
|
89
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
90
|
+
*/
|
|
18
91
|
addHours(hours: number): TimeSpan;
|
|
92
|
+
/**
|
|
93
|
+
* Returns a new TimeSpan that adds the specified number of days to this instance.
|
|
94
|
+
* @param {number} days - The days to add.
|
|
95
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
96
|
+
*/
|
|
19
97
|
addDays(days: number): TimeSpan;
|
|
98
|
+
/**
|
|
99
|
+
* Returns a new TimeSpan that adds the specified number of weeks to this instance.
|
|
100
|
+
* @param {number} weeks - The weeks to add.
|
|
101
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
102
|
+
*/
|
|
20
103
|
addWeeks(weeks: number): TimeSpan;
|
|
104
|
+
/**
|
|
105
|
+
* Returns a new TimeSpan that subtracts the specified number of milliseconds from this instance.
|
|
106
|
+
* @param {number} milliseconds - The milliseconds to subtract.
|
|
107
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
108
|
+
*/
|
|
21
109
|
subtractMilliseconds(milliseconds: number): TimeSpan;
|
|
110
|
+
/**
|
|
111
|
+
* Returns a new TimeSpan that subtracts the specified number of seconds from this instance.
|
|
112
|
+
* @param {number} seconds - The seconds to subtract.
|
|
113
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
114
|
+
*/
|
|
22
115
|
subtractSeconds(seconds: number): TimeSpan;
|
|
116
|
+
/**
|
|
117
|
+
* Returns a new TimeSpan that subtracts the specified number of minutes from this instance.
|
|
118
|
+
* @param {number} minutes - The minutes to subtract.
|
|
119
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
120
|
+
*/
|
|
23
121
|
subtractMinutes(minutes: number): TimeSpan;
|
|
122
|
+
/**
|
|
123
|
+
* Returns a new TimeSpan that subtracts the specified number of hours from this instance.
|
|
124
|
+
* @param {number} hours - The hours to subtract.
|
|
125
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
126
|
+
*/
|
|
24
127
|
subtractHours(hours: number): TimeSpan;
|
|
128
|
+
/**
|
|
129
|
+
* Returns a new TimeSpan that subtracts the specified number of days from this instance.
|
|
130
|
+
* @param {number} days - The days to subtract.
|
|
131
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
132
|
+
*/
|
|
25
133
|
subtractDays(days: number): TimeSpan;
|
|
134
|
+
/**
|
|
135
|
+
* Returns a new TimeSpan that subtracts the specified number of weeks from this instance.
|
|
136
|
+
* @param {number} weeks - The weeks to subtract.
|
|
137
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
138
|
+
*/
|
|
26
139
|
subtractWeeks(weeks: number): TimeSpan;
|
|
140
|
+
/**
|
|
141
|
+
* Returns a new TimeSpan that adds the specified TimeSpan to this instance.
|
|
142
|
+
* @param {TimeSpan} other - The TimeSpan to add.
|
|
143
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
144
|
+
*/
|
|
27
145
|
add(other: TimeSpan): TimeSpan;
|
|
146
|
+
/**
|
|
147
|
+
* Returns a new TimeSpan that subtracts the specified TimeSpan from this instance.
|
|
148
|
+
* @param {TimeSpan} other - The TimeSpan to subtract.
|
|
149
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
150
|
+
*/
|
|
28
151
|
subtract(other: TimeSpan): TimeSpan;
|
|
152
|
+
/**
|
|
153
|
+
* Adds this TimeSpan to a specified Date.
|
|
154
|
+
* @param {Date} date - The date to add to.
|
|
155
|
+
* @returns {Date} A new Date instance.
|
|
156
|
+
*/
|
|
29
157
|
addTo(date: Date): Date;
|
|
158
|
+
/**
|
|
159
|
+
* Subtracts this TimeSpan from a specified Date.
|
|
160
|
+
* @param {Date} date - The date to subtract from.
|
|
161
|
+
* @returns {Date} A new Date instance.
|
|
162
|
+
*/
|
|
30
163
|
subtractFrom(date: Date): Date;
|
|
164
|
+
/**
|
|
165
|
+
* Creates a TimeSpan from the difference between two dates.
|
|
166
|
+
* @param {Date} earlierDate - The earlier date.
|
|
167
|
+
* @param {Date} laterDate - The later date.
|
|
168
|
+
* @returns {TimeSpan} A new TimeSpan instance representing the difference.
|
|
169
|
+
*/
|
|
31
170
|
static fromDifference(earlierDate: Date, laterDate: Date): TimeSpan;
|
|
171
|
+
/**
|
|
172
|
+
* Formats the TimeSpan as a string.
|
|
173
|
+
* Supported tokens: hh, h, mm, m, ss, s.
|
|
174
|
+
* @param {string} format - The format string (default: 'hh:mm:ss').
|
|
175
|
+
* @returns {string} The formatted string.
|
|
176
|
+
*/
|
|
32
177
|
format(format?: string): string;
|
|
178
|
+
/**
|
|
179
|
+
* Checks if this TimeSpan is equal to another.
|
|
180
|
+
* @param {TimeSpan} other - The other TimeSpan.
|
|
181
|
+
* @returns {boolean} True if equal.
|
|
182
|
+
*/
|
|
33
183
|
eq(other: TimeSpan): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Checks if this TimeSpan is less than or equal to another.
|
|
186
|
+
* @param {TimeSpan} other - The other TimeSpan.
|
|
187
|
+
* @returns {boolean} True if less than or equal.
|
|
188
|
+
*/
|
|
34
189
|
le(other: TimeSpan): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Checks if this TimeSpan is less than another.
|
|
192
|
+
* @param {TimeSpan} other - The other TimeSpan.
|
|
193
|
+
* @returns {boolean} True if less than.
|
|
194
|
+
*/
|
|
35
195
|
lt(other: TimeSpan): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Checks if this TimeSpan is greater than or equal to another.
|
|
198
|
+
* @param {TimeSpan} other - The other TimeSpan.
|
|
199
|
+
* @returns {boolean} True if greater than or equal.
|
|
200
|
+
*/
|
|
36
201
|
ge(other: TimeSpan): boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Checks if this TimeSpan is greater than another.
|
|
204
|
+
* @param {TimeSpan} other - The other TimeSpan.
|
|
205
|
+
* @returns {boolean} True if greater than.
|
|
206
|
+
*/
|
|
37
207
|
gt(other: TimeSpan): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Multiplies the TimeSpan by a number.
|
|
210
|
+
* @param {number} number - The multiplier.
|
|
211
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
212
|
+
*/
|
|
38
213
|
multiply(number: number): TimeSpan;
|
|
214
|
+
/**
|
|
215
|
+
* Divides the TimeSpan by a number.
|
|
216
|
+
* @param {number} number - The divisor.
|
|
217
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
218
|
+
*/
|
|
39
219
|
divide(number: number): TimeSpan;
|
|
220
|
+
/**
|
|
221
|
+
* Returns the absolute value of the TimeSpan.
|
|
222
|
+
* @returns {TimeSpan} A new TimeSpan instance.
|
|
223
|
+
*/
|
|
40
224
|
abs(): TimeSpan;
|
|
225
|
+
/**
|
|
226
|
+
* Infinite duration.
|
|
227
|
+
*/
|
|
41
228
|
static readonly INFINITE: TimeSpan;
|
|
229
|
+
/**
|
|
230
|
+
* Negative infinite duration.
|
|
231
|
+
*/
|
|
42
232
|
static readonly NEGATIVE_INFINITE: TimeSpan;
|
|
233
|
+
/**
|
|
234
|
+
* Checks if the TimeSpan is infinite.
|
|
235
|
+
* @returns {boolean} True if infinite.
|
|
236
|
+
*/
|
|
43
237
|
isInfinite(): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Checks if the TimeSpan is positive infinite.
|
|
240
|
+
* @returns {boolean} True if positive infinite.
|
|
241
|
+
*/
|
|
44
242
|
isPositiveInfinite(): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Checks if the TimeSpan is negative infinite.
|
|
245
|
+
* @returns {boolean} True if negative infinite.
|
|
246
|
+
*/
|
|
45
247
|
isNegativeInfinite(): boolean;
|
|
46
248
|
}
|
|
47
249
|
//# sourceMappingURL=timespan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timespan.d.ts","sourceRoot":"","sources":["../../src/timespan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timespan.d.ts","sourceRoot":"","sources":["../../src/timespan.ts"],"names":[],"mappings":"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"}
|
package/dist/types/type.d.ts
CHANGED
|
@@ -16,9 +16,49 @@ export default class Type<T = unknown> {
|
|
|
16
16
|
readonly constructorRef: Constructor<T> | undefined;
|
|
17
17
|
readonly typeCode: TypeCode;
|
|
18
18
|
private constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Obtiene el `Type` de cualquier valor, constructor o primitivo.
|
|
21
|
+
*
|
|
22
|
+
* Unifica `typeof()` y `.GetType()` de C# en un solo método.
|
|
23
|
+
*
|
|
24
|
+
* **Reglas de resolución:**
|
|
25
|
+
* 1. `null` / `undefined` → tipo nullish correspondiente
|
|
26
|
+
* 2. Primitivo (`number`, `string`, etc.) → tipo primitivo
|
|
27
|
+
* 3. Array → `Type.Array`
|
|
28
|
+
* 4. Función/Constructor → tipo del constructor (no "Function")
|
|
29
|
+
* 5. Objeto → tipo basado en su constructor
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* Type.of(42) // Type<number> — primitivo
|
|
34
|
+
* Type.of('hello') // Type<string> — primitivo
|
|
35
|
+
* Type.of(new Date()) // Type<Date> — desde instancia
|
|
36
|
+
* Type.of(Date) // Type<Date> — desde constructor
|
|
37
|
+
* Type.of(null) // Type<null>
|
|
38
|
+
* Type.of([1, 2, 3]) // Type<Array>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
19
41
|
static of<U>(target: U | Constructor<U>): Type<U>;
|
|
42
|
+
/**
|
|
43
|
+
* Resuelve funciones y constructores.
|
|
44
|
+
*
|
|
45
|
+
* Decisión clave: si la función tiene un `prototype` con
|
|
46
|
+
* miembros propios o empieza con `class`, es un constructor
|
|
47
|
+
* y devolvemos el tipo que construye. Si no, es una función.
|
|
48
|
+
*/
|
|
20
49
|
private static _resolveFunction;
|
|
50
|
+
/**
|
|
51
|
+
* Resuelve objetos por su cadena de prototipos.
|
|
52
|
+
*/
|
|
21
53
|
private static _resolveObject;
|
|
54
|
+
/**
|
|
55
|
+
* Heurística para distinguir constructores de funciones planas.
|
|
56
|
+
*
|
|
57
|
+
* Un "constructor" cumple al menos una de:
|
|
58
|
+
* - Su `toString()` empieza con "class "
|
|
59
|
+
* - Tiene propiedades propias en su prototype (más allá de constructor)
|
|
60
|
+
* - Es un built-in conocido (Date, Map, Set, etc.)
|
|
61
|
+
*/
|
|
22
62
|
private static _isConstructorLike;
|
|
23
63
|
get isPrimitive(): boolean;
|
|
24
64
|
get isNullish(): boolean;
|
package/dist/types/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,OAAO,OAAO,IAAI,CAAC,CAAC,GAAG,OAAO;IAMjC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAA4B;IAM1D,gBAAuB,MAAM,eAA6E;IAC1G,gBAAuB,MAAM,eAA6E;IAC1G,gBAAuB,OAAO,gBAAiF;IAC/G,gBAAuB,MAAM,eAA6E;IAC1G,gBAAuB,MAAM,eAA6E;IAC1G,gBAAuB,IAAI,aAAqE;IAChG,gBAAuB,SAAS,kBAAyF;IACzH,gBAAuB,MAAM,eAAwE;IACrG,gBAAuB,QAAQ,iBAAkF;IACjH,gBAAuB,KAAK,kBAAuE;IAMnG,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,cAAc,EAC1B,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC/B,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IAEnC,OAAO;
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,OAAO,OAAO,IAAI,CAAC,CAAC,GAAG,OAAO;IAMjC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAA4B;IAM1D,gBAAuB,MAAM,eAA6E;IAC1G,gBAAuB,MAAM,eAA6E;IAC1G,gBAAuB,OAAO,gBAAiF;IAC/G,gBAAuB,MAAM,eAA6E;IAC1G,gBAAuB,MAAM,eAA6E;IAC1G,gBAAuB,IAAI,aAAqE;IAChG,gBAAuB,SAAS,kBAAyF;IACzH,gBAAuB,MAAM,eAAwE;IACrG,gBAAuB,QAAQ,iBAAkF;IACjH,gBAAuB,KAAK,kBAAuE;IAMnG,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,cAAc,EAC1B,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC/B,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IAEnC,OAAO;IAcP;;;;;;;;;;;;;;;;;;;;;OAqBG;WACW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IA8BxD;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAiB/B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAY7B;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAuBjC,IAAW,WAAW,IAAI,OAAO,CAQhC;IAED,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED,IAAW,OAAO,IAAI,OAAO,CAG5B;IAED,IAAW,UAAU,IAAI,OAAO,CAE/B;IAED,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED,IAAW,OAAO,IAAI,OAAO,CAO5B;IAED,IAAW,QAAQ,IAAI,MAAM,CAK5B;IAMD,IAAW,QAAQ,IAAI,IAAI,GAAG,SAAS,CAUtC;IAEM,mBAAmB,IAAI,aAAa,CAAC,IAAI,CAAC;IAY1C,cAAc,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO;IAYrC,gBAAgB,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO;IAIvC,YAAY,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO;IAUnC,cAAc,IAAI,aAAa,CAAC,MAAM,CAAC;IAYvC,gBAAgB,IAAI,aAAa,CAAC,MAAM,CAAC;IAYzC,cAAc,IAAI,aAAa,CAAC,MAAM,CAAC;IAQvC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAKhC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAKlC,oBAAoB,IAAI,aAAa,CAAC,MAAM,CAAC;IAc7C,QAAQ,IAAI,MAAM;IAKlB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAU1D,IAAW,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAExC;IAMD,OAAO,CAAC,MAAM,CAAC,YAAY;CAoB9B"}
|