@kikiutils/shared 18.0.1 → 18.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/dist/buffer.d.ts +19 -21
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +18 -19
- package/dist/buffer.js.map +1 -1
- package/dist/classes/enhanced-date.d.ts +425 -0
- package/dist/classes/enhanced-date.d.ts.map +1 -0
- package/dist/classes/enhanced-date.js +591 -0
- package/dist/classes/enhanced-date.js.map +1 -0
- package/dist/classes/path.d.ts +211 -48
- package/dist/classes/path.d.ts.map +1 -1
- package/dist/classes/path.js +181 -52
- package/dist/classes/path.js.map +1 -1
- package/dist/classes/precision-number.d.ts +44 -39
- package/dist/classes/precision-number.d.ts.map +1 -1
- package/dist/classes/precision-number.js +51 -45
- package/dist/classes/precision-number.js.map +1 -1
- package/dist/classes/ssh-client.d.ts +3 -4
- package/dist/classes/ssh-client.d.ts.map +1 -1
- package/dist/classes/ssh-client.js +2 -2
- package/dist/classes/ssh-client.js.map +1 -1
- package/dist/clipboard.d.ts +25 -26
- package/dist/clipboard.d.ts.map +1 -1
- package/dist/clipboard.js +23 -23
- package/dist/clipboard.js.map +1 -1
- package/dist/consola.d.ts +12 -15
- package/dist/consola.d.ts.map +1 -1
- package/dist/consola.js +10 -12
- package/dist/consola.js.map +1 -1
- package/dist/crypto-hash.d.ts +65 -56
- package/dist/crypto-hash.d.ts.map +1 -1
- package/dist/crypto-hash.js +55 -45
- package/dist/crypto-hash.js.map +1 -1
- package/dist/datetime.d.ts +41 -53
- package/dist/datetime.d.ts.map +1 -1
- package/dist/datetime.js +53 -66
- package/dist/datetime.js.map +1 -1
- package/dist/element-plus.d.ts +13 -14
- package/dist/element-plus.d.ts.map +1 -1
- package/dist/element-plus.js +11 -11
- package/dist/element-plus.js.map +1 -1
- package/dist/enum.d.ts +39 -36
- package/dist/enum.d.ts.map +1 -1
- package/dist/enum.js +36 -32
- package/dist/enum.js.map +1 -1
- package/dist/env.d.ts +22 -15
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +20 -12
- package/dist/env.js.map +1 -1
- package/dist/event-awaiter.d.ts +47 -52
- package/dist/event-awaiter.d.ts.map +1 -1
- package/dist/event-awaiter.js +46 -50
- package/dist/event-awaiter.js.map +1 -1
- package/dist/general.d.ts +22 -17
- package/dist/general.d.ts.map +1 -1
- package/dist/general.js.map +1 -1
- package/dist/hash.d.ts +24 -21
- package/dist/hash.d.ts.map +1 -1
- package/dist/hash.js +20 -16
- package/dist/hash.js.map +1 -1
- package/dist/math.d.ts +20 -19
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +14 -12
- package/dist/math.js.map +1 -1
- package/dist/number.d.ts +10 -9
- package/dist/number.d.ts.map +1 -1
- package/dist/number.js +9 -7
- package/dist/number.js.map +1 -1
- package/dist/object.d.ts +22 -10
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +21 -8
- package/dist/object.js.map +1 -1
- package/dist/pino.d.ts +12 -15
- package/dist/pino.d.ts.map +1 -1
- package/dist/pino.js +10 -15
- package/dist/pino.js.map +1 -1
- package/dist/random.d.ts +17 -15
- package/dist/random.d.ts.map +1 -1
- package/dist/random.js +16 -13
- package/dist/random.js.map +1 -1
- package/dist/redis/script-runner.d.ts +57 -0
- package/dist/redis/script-runner.d.ts.map +1 -0
- package/dist/redis/script-runner.js +46 -0
- package/dist/redis/script-runner.js.map +1 -0
- package/dist/storages/lru/keyed-store.d.ts +18 -14
- package/dist/storages/lru/keyed-store.d.ts.map +1 -1
- package/dist/storages/lru/keyed-store.js +17 -12
- package/dist/storages/lru/keyed-store.js.map +1 -1
- package/dist/storages/redis/keyed-store.d.ts +11 -21
- package/dist/storages/redis/keyed-store.d.ts.map +1 -1
- package/dist/storages/redis/keyed-store.js +10 -19
- package/dist/storages/redis/keyed-store.js.map +1 -1
- package/dist/storages/redis/msgpack.d.ts +33 -13
- package/dist/storages/redis/msgpack.d.ts.map +1 -1
- package/dist/storages/redis/msgpack.js +32 -11
- package/dist/storages/redis/msgpack.js.map +1 -1
- package/dist/storages/redis/types.d.ts +34 -17
- package/dist/storages/redis/types.d.ts.map +1 -1
- package/dist/string.d.ts +12 -11
- package/dist/string.d.ts.map +1 -1
- package/dist/string.js +20 -15
- package/dist/string.js.map +1 -1
- package/dist/time.d.ts +26 -21
- package/dist/time.d.ts.map +1 -1
- package/dist/time.js +24 -18
- package/dist/time.js.map +1 -1
- package/dist/types/filtered-key-path.d.ts +4 -15
- package/dist/types/filtered-key-path.d.ts.map +1 -1
- package/dist/types/index.d.ts +10 -10
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/vue.d.ts +7 -7
- package/dist/types/vue.d.ts.map +1 -1
- package/dist/url.d.ts +15 -14
- package/dist/url.d.ts.map +1 -1
- package/dist/url.js +12 -10
- package/dist/url.js.map +1 -1
- package/dist/vue.d.ts +19 -21
- package/dist/vue.d.ts.map +1 -1
- package/dist/vue.js +15 -16
- package/dist/vue.js.map +1 -1
- package/dist/web.d.ts +14 -11
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +12 -8
- package/dist/web.js.map +1 -1
- package/package.json +20 -20
- package/src/buffer.ts +18 -19
- package/src/classes/enhanced-date.ts +665 -0
- package/src/classes/path.ts +232 -91
- package/src/classes/precision-number.ts +61 -53
- package/src/classes/ssh-client.ts +8 -5
- package/src/clipboard.ts +23 -23
- package/src/consola.ts +10 -12
- package/src/crypto-hash.ts +55 -45
- package/src/datetime.ts +65 -85
- package/src/element-plus.ts +11 -11
- package/src/enum.ts +36 -32
- package/src/env.ts +20 -12
- package/src/event-awaiter.ts +49 -50
- package/src/general.ts +20 -14
- package/src/hash.ts +20 -16
- package/src/math.ts +18 -16
- package/src/number.ts +9 -7
- package/src/object.ts +21 -8
- package/src/pino.ts +11 -15
- package/src/random.ts +16 -13
- package/src/redis/script-runner.ts +107 -0
- package/src/storages/lru/keyed-store.ts +17 -12
- package/src/storages/redis/keyed-store.ts +10 -19
- package/src/storages/redis/msgpack.ts +32 -11
- package/src/storages/redis/types.ts +32 -14
- package/src/string.ts +10 -8
- package/src/time.ts +24 -18
- package/src/types/filtered-key-path.ts +9 -14
- package/src/types/vue.ts +6 -5
- package/src/url.ts +12 -10
- package/src/vue.ts +15 -16
- package/src/web.ts +12 -8
package/dist/buffer.d.ts
CHANGED
|
@@ -2,36 +2,34 @@ import { BinaryInput } from "./types/index.js";
|
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
//#region src/buffer.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* Converts
|
|
5
|
+
* Converts binary input to a Node.js `Buffer`.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* optimal performance.
|
|
7
|
+
* @remarks
|
|
8
|
+
* An existing `Buffer` is returned unchanged. `ArrayBuffer` and `Uint8Array` inputs share their backing memory
|
|
9
|
+
* with the result, so changes are visible through both views. `Blob` and `File` inputs are read asynchronously.
|
|
11
10
|
*
|
|
12
|
-
* @param
|
|
13
|
-
* Supports Blob, Buffer, File, ArrayBuffer, and Uint8Array.
|
|
11
|
+
* @param input - The binary data to convert.
|
|
14
12
|
*
|
|
15
|
-
* @returns
|
|
13
|
+
* @returns A promise resolving to the original buffer or a new buffer view after the input is available.
|
|
14
|
+
*
|
|
15
|
+
* @throws TypeError through promise rejection if the input is unsupported.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import { toBuffer } from '@kikiutils/shared/buffer';
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* const bufferFromAB = await toBuffer(ab);
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { toBuffer } from '@kikiutils/shared/buffer';
|
|
24
21
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
22
|
+
* const bytes = new Uint8Array([
|
|
23
|
+
* 10,
|
|
24
|
+
* 20,
|
|
25
|
+
* 30,
|
|
26
|
+
* ]);
|
|
28
27
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
28
|
+
* const buffer = await toBuffer(bytes);
|
|
29
|
+
* bytes[0] = 40;
|
|
30
|
+
* console.log(buffer[0]); // => 40
|
|
32
31
|
* ```
|
|
33
32
|
*/
|
|
34
|
-
declare function toBuffer(input: BinaryInput): Promise<Buffer<ArrayBufferLike>>;
|
|
33
|
+
export declare function toBuffer(input: BinaryInput): Promise<Buffer<ArrayBufferLike>>;
|
|
35
34
|
//#endregion
|
|
36
|
-
export { toBuffer };
|
|
37
35
|
//# sourceMappingURL=buffer.d.ts.map
|
package/dist/buffer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.d.ts","names":[],"sources":["../src/buffer.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"buffer.d.ts","names":[],"sources":["../src/buffer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiCsB,SAAS,OAAO,cAAW,QAAA,OAAA"}
|
package/dist/buffer.js
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
2
|
//#region src/buffer.ts
|
|
3
3
|
/**
|
|
4
|
-
* Converts
|
|
4
|
+
* Converts binary input to a Node.js `Buffer`.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* optimal performance.
|
|
6
|
+
* @remarks
|
|
7
|
+
* An existing `Buffer` is returned unchanged. `ArrayBuffer` and `Uint8Array` inputs share their backing memory
|
|
8
|
+
* with the result, so changes are visible through both views. `Blob` and `File` inputs are read asynchronously.
|
|
10
9
|
*
|
|
11
|
-
* @param
|
|
12
|
-
* Supports Blob, Buffer, File, ArrayBuffer, and Uint8Array.
|
|
10
|
+
* @param input - The binary data to convert.
|
|
13
11
|
*
|
|
14
|
-
* @returns
|
|
12
|
+
* @returns A promise resolving to the original buffer or a new buffer view after the input is available.
|
|
13
|
+
*
|
|
14
|
+
* @throws TypeError through promise rejection if the input is unsupported.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { toBuffer } from '@kikiutils/shared/buffer';
|
|
19
17
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* const bufferFromAB = await toBuffer(ab);
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { toBuffer } from '@kikiutils/shared/buffer';
|
|
23
20
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
21
|
+
* const bytes = new Uint8Array([
|
|
22
|
+
* 10,
|
|
23
|
+
* 20,
|
|
24
|
+
* 30,
|
|
25
|
+
* ]);
|
|
27
26
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* const buffer = await toBuffer(bytes);
|
|
28
|
+
* bytes[0] = 40;
|
|
29
|
+
* console.log(buffer[0]); // => 40
|
|
31
30
|
* ```
|
|
32
31
|
*/
|
|
33
32
|
async function toBuffer(input) {
|
package/dist/buffer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.js","names":[],"sources":["../src/buffer.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nimport type { BinaryInput } from './types';\n\n/**\n * Converts
|
|
1
|
+
{"version":3,"file":"buffer.js","names":[],"sources":["../src/buffer.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nimport type { BinaryInput } from './types';\n\n/**\n * Converts binary input to a Node.js `Buffer`.\n *\n * @remarks\n * An existing `Buffer` is returned unchanged. `ArrayBuffer` and `Uint8Array` inputs share their backing memory\n * with the result, so changes are visible through both views. `Blob` and `File` inputs are read asynchronously.\n *\n * @param input - The binary data to convert.\n *\n * @returns A promise resolving to the original buffer or a new buffer view after the input is available.\n *\n * @throws TypeError through promise rejection if the input is unsupported.\n *\n * @example\n *\n * ```ts\n * import { toBuffer } from '@kikiutils/shared/buffer';\n *\n * const bytes = new Uint8Array([\n * 10,\n * 20,\n * 30,\n * ]);\n *\n * const buffer = await toBuffer(bytes);\n * bytes[0] = 40;\n * console.log(buffer[0]); // => 40\n * ```\n */\nexport async function toBuffer(input: BinaryInput) {\n if (Buffer.isBuffer(input)) return input;\n if (input instanceof ArrayBuffer) return Buffer.from(input);\n if (input instanceof Uint8Array) return Buffer.from(input.buffer, input.byteOffset, input.byteLength);\n if (typeof input.arrayBuffer === 'function') return Buffer.from(await input.arrayBuffer());\n // eslint-disable-next-line style/max-len\n throw new TypeError('The provided input is not a supported binary type (Blob, Buffer, File, ArrayBuffer, or Uint8Array).');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,eAAsB,SAAS,OAAoB;CAC/C,IAAI,OAAO,SAAS,KAAK,GAAG,OAAO;CACnC,IAAI,iBAAiB,aAAa,OAAO,OAAO,KAAK,KAAK;CAC1D,IAAI,iBAAiB,YAAY,OAAO,OAAO,KAAK,MAAM,QAAQ,MAAM,YAAY,MAAM,UAAU;CACpG,IAAI,OAAO,MAAM,gBAAgB,YAAY,OAAO,OAAO,KAAK,MAAM,MAAM,YAAY,CAAC;CAEzF,MAAM,IAAI,UAAU,qGAAqG;AAC7H"}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import * as dateFns from "date-fns";
|
|
2
|
+
//#region src/classes/enhanced-date.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* A mutable calendar date with chainable date-fns operations.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Inherits the native constructor, including zero-based month arguments and millisecond timestamps.
|
|
8
|
+
* Native methods retain their original behavior.
|
|
9
|
+
* Mutating arithmetic and boundary methods update this instance and return `this`;
|
|
10
|
+
* their `to`-prefixed counterparts return a new `EnhancedDate` instead.
|
|
11
|
+
* Invalid dates, parsing, rounding, and week defaults follow date-fns semantics.
|
|
12
|
+
* Operations use the system time zone unless configured through date-fns options.
|
|
13
|
+
* Day and week arithmetic uses calendar days, preserving local wall-clock time across daylight saving changes.
|
|
14
|
+
* Hour, minute, second, and millisecond arithmetic uses elapsed durations. Month and year arithmetic clamps
|
|
15
|
+
* to the last valid day of the destination month. Native setters retain their native overflow behavior.
|
|
16
|
+
* Exceptions from date-fns propagate unchanged, and operations can preserve or produce `Invalid Date`.
|
|
17
|
+
*
|
|
18
|
+
* When used in Vue state, prefer replacing the value with a `to`-prefixed result:
|
|
19
|
+
* mutating a Date's internal timestamp does not trigger reactive updates.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { EnhancedDate } from '@kikiutils/shared/classes/enhanced-date';
|
|
25
|
+
*
|
|
26
|
+
* const date = new EnhancedDate('2026-01-31T12:00:00Z');
|
|
27
|
+
* const nextMonth = date.toAddMonths(1); // Original date is unchanged.
|
|
28
|
+
* date.addDays(1).startOfDay(); // Mutates the original date.
|
|
29
|
+
* nextMonth.isAfter(date);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class EnhancedDate extends Date {
|
|
33
|
+
/**
|
|
34
|
+
* Returns a new instance at the end of today in the system time zone.
|
|
35
|
+
*/
|
|
36
|
+
static endOfToday(): EnhancedDate;
|
|
37
|
+
/**
|
|
38
|
+
* Parses a date using date-fns and an explicit reference for missing fields.
|
|
39
|
+
*
|
|
40
|
+
* @param value - Date string to parse.
|
|
41
|
+
* @param pattern - date-fns parsing pattern.
|
|
42
|
+
* @param referenceDate - Reference for fields absent from the pattern.
|
|
43
|
+
* @param options - Options passed to `date-fns/parse`.
|
|
44
|
+
*
|
|
45
|
+
* @returns A new `EnhancedDate`, including `Invalid Date` for invalid values.
|
|
46
|
+
*/
|
|
47
|
+
static fromFormat(value: string, pattern: string, referenceDate: dateFns.DateArg<Date>, options?: dateFns.ParseOptions): EnhancedDate;
|
|
48
|
+
/**
|
|
49
|
+
* Parses an ISO 8601 string using date-fns, including its partial-date support.
|
|
50
|
+
*
|
|
51
|
+
* @param value - ISO date string.
|
|
52
|
+
* @param options - Options passed to `date-fns/parseISO`.
|
|
53
|
+
*
|
|
54
|
+
* @returns A new `EnhancedDate`, or `Invalid Date` when parsing fails.
|
|
55
|
+
*/
|
|
56
|
+
static fromISO(value: string, options?: dateFns.ParseISOOptions): EnhancedDate;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a date from Unix seconds; native constructor numbers remain milliseconds.
|
|
59
|
+
*
|
|
60
|
+
* @param seconds - Seconds since the Unix epoch.
|
|
61
|
+
*/
|
|
62
|
+
static fromUnixSeconds(seconds: number): EnhancedDate;
|
|
63
|
+
/**
|
|
64
|
+
* Returns a new instance at the start of today in the system time zone.
|
|
65
|
+
*/
|
|
66
|
+
static startOfToday(): EnhancedDate;
|
|
67
|
+
/**
|
|
68
|
+
* Adds the specified number of days in place using date-fns.
|
|
69
|
+
*
|
|
70
|
+
* @param amount - Number of days.
|
|
71
|
+
*
|
|
72
|
+
* @returns This instance for chaining.
|
|
73
|
+
*/
|
|
74
|
+
addDays(amount: number): this;
|
|
75
|
+
/**
|
|
76
|
+
* Adds the specified number of hours in place using date-fns.
|
|
77
|
+
*
|
|
78
|
+
* @param amount - Number of hours.
|
|
79
|
+
*
|
|
80
|
+
* @returns This instance for chaining.
|
|
81
|
+
*/
|
|
82
|
+
addHours(amount: number): this;
|
|
83
|
+
/**
|
|
84
|
+
* Adds the specified number of milliseconds in place using date-fns.
|
|
85
|
+
*
|
|
86
|
+
* @param amount - Number of milliseconds.
|
|
87
|
+
*
|
|
88
|
+
* @returns This instance for chaining.
|
|
89
|
+
*/
|
|
90
|
+
addMilliseconds(amount: number): this;
|
|
91
|
+
/**
|
|
92
|
+
* Adds the specified number of minutes in place using date-fns.
|
|
93
|
+
*
|
|
94
|
+
* @param amount - Number of minutes.
|
|
95
|
+
*
|
|
96
|
+
* @returns This instance for chaining.
|
|
97
|
+
*/
|
|
98
|
+
addMinutes(amount: number): this;
|
|
99
|
+
/**
|
|
100
|
+
* Adds the specified number of months in place using date-fns.
|
|
101
|
+
*
|
|
102
|
+
* @param amount - Number of months.
|
|
103
|
+
*
|
|
104
|
+
* @returns This instance for chaining.
|
|
105
|
+
*/
|
|
106
|
+
addMonths(amount: number): this;
|
|
107
|
+
/**
|
|
108
|
+
* Adds the specified number of seconds in place using date-fns.
|
|
109
|
+
*
|
|
110
|
+
* @param amount - Number of seconds.
|
|
111
|
+
*
|
|
112
|
+
* @returns This instance for chaining.
|
|
113
|
+
*/
|
|
114
|
+
addSeconds(amount: number): this;
|
|
115
|
+
/**
|
|
116
|
+
* Adds the specified number of weeks in place using date-fns.
|
|
117
|
+
*
|
|
118
|
+
* @param amount - Number of weeks.
|
|
119
|
+
*
|
|
120
|
+
* @returns This instance for chaining.
|
|
121
|
+
*/
|
|
122
|
+
addWeeks(amount: number): this;
|
|
123
|
+
/**
|
|
124
|
+
* Adds the specified number of years in place using date-fns.
|
|
125
|
+
*
|
|
126
|
+
* @param amount - Number of years.
|
|
127
|
+
*
|
|
128
|
+
* @returns This instance for chaining.
|
|
129
|
+
*/
|
|
130
|
+
addYears(amount: number): this;
|
|
131
|
+
/**
|
|
132
|
+
* Returns a new `EnhancedDate` with the same timestamp, including `Invalid Date`.
|
|
133
|
+
*/
|
|
134
|
+
clone(): EnhancedDate;
|
|
135
|
+
/**
|
|
136
|
+
* Returns the signed difference in calendar days: this date minus the other date.
|
|
137
|
+
*
|
|
138
|
+
* @remarks
|
|
139
|
+
* Defaults and rounding follow date-fns.
|
|
140
|
+
*/
|
|
141
|
+
differenceInCalendarDays(other: dateFns.DateArg<Date>): number;
|
|
142
|
+
/**
|
|
143
|
+
* Returns the signed difference in calendar weeks: this date minus the other date.
|
|
144
|
+
*
|
|
145
|
+
* @remarks
|
|
146
|
+
* Defaults and rounding follow date-fns.
|
|
147
|
+
*/
|
|
148
|
+
differenceInCalendarWeeks(other: dateFns.DateArg<Date>, options?: dateFns.DifferenceInCalendarWeeksOptions): number;
|
|
149
|
+
/**
|
|
150
|
+
* Returns the signed difference in full minutes: this date minus the other date.
|
|
151
|
+
*
|
|
152
|
+
* @remarks
|
|
153
|
+
* Defaults and rounding follow date-fns.
|
|
154
|
+
*/
|
|
155
|
+
differenceInMinutes(other: dateFns.DateArg<Date>, options?: dateFns.DifferenceInMinutesOptions): number;
|
|
156
|
+
/**
|
|
157
|
+
* Moves this date to the end of its day in place.
|
|
158
|
+
*
|
|
159
|
+
* @returns This instance for chaining.
|
|
160
|
+
*/
|
|
161
|
+
endOfDay(): this;
|
|
162
|
+
/**
|
|
163
|
+
* Moves this date to the end of its minute in place.
|
|
164
|
+
*
|
|
165
|
+
* @returns This instance for chaining.
|
|
166
|
+
*/
|
|
167
|
+
endOfMinute(): this;
|
|
168
|
+
/**
|
|
169
|
+
* Moves this date to the end of its month in place.
|
|
170
|
+
*
|
|
171
|
+
* @returns This instance for chaining.
|
|
172
|
+
*/
|
|
173
|
+
endOfMonth(): this;
|
|
174
|
+
/**
|
|
175
|
+
* Moves this date to the end of its week in place.
|
|
176
|
+
*
|
|
177
|
+
* @param options - date-fns week options; defaults are unchanged.
|
|
178
|
+
*
|
|
179
|
+
* @returns This instance for chaining.
|
|
180
|
+
*/
|
|
181
|
+
endOfWeek(options?: dateFns.EndOfWeekOptions): this;
|
|
182
|
+
/**
|
|
183
|
+
* Formats this date using a date-fns pattern (default: `yyyy-MM-dd HH:mm:ss`) and optional locale/options.
|
|
184
|
+
*
|
|
185
|
+
* @remarks
|
|
186
|
+
* Invalid dates and invalid patterns retain date-fns error behavior.
|
|
187
|
+
*/
|
|
188
|
+
format(pattern?: string, options?: dateFns.FormatOptions): string;
|
|
189
|
+
/**
|
|
190
|
+
* Formats the distance from this date to now using date-fns.
|
|
191
|
+
*/
|
|
192
|
+
formatDistanceToNow(options?: dateFns.FormatDistanceToNowOptions): string;
|
|
193
|
+
/**
|
|
194
|
+
* Returns Unix seconds using date-fns; `getTime()` returns milliseconds.
|
|
195
|
+
*/
|
|
196
|
+
getUnixTime(): number;
|
|
197
|
+
/**
|
|
198
|
+
* Checks whether this date occurs after the other date.
|
|
199
|
+
*/
|
|
200
|
+
isAfter(other: dateFns.DateArg<Date>): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Checks whether this date occurs before the other date.
|
|
203
|
+
*/
|
|
204
|
+
isBefore(other: dateFns.DateArg<Date>): boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Checks whether this date has the same timestamp as the other date.
|
|
207
|
+
*/
|
|
208
|
+
isEqual(other: dateFns.DateArg<Date>): boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Checks whether this date is after the current time.
|
|
211
|
+
*/
|
|
212
|
+
isFuture(): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Checks whether this date falls on the same calendar day as the other date.
|
|
215
|
+
*/
|
|
216
|
+
isSameDay(other: dateFns.DateArg<Date>): boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Checks whether this date falls in the same calendar minute as the other date.
|
|
219
|
+
*/
|
|
220
|
+
isSameMinute(other: dateFns.DateArg<Date>): boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Checks whether this date falls on today.
|
|
223
|
+
*/
|
|
224
|
+
isToday(): boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Checks whether this date falls on tomorrow.
|
|
227
|
+
*/
|
|
228
|
+
isTomorrow(): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Checks whether this date has a valid timestamp.
|
|
231
|
+
*/
|
|
232
|
+
isValid(): boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Moves this date to the start of its day in place.
|
|
235
|
+
*
|
|
236
|
+
* @returns This instance for chaining.
|
|
237
|
+
*/
|
|
238
|
+
startOfDay(): this;
|
|
239
|
+
/**
|
|
240
|
+
* Moves this date to the start of its minute in place.
|
|
241
|
+
*
|
|
242
|
+
* @returns This instance for chaining.
|
|
243
|
+
*/
|
|
244
|
+
startOfMinute(): this;
|
|
245
|
+
/**
|
|
246
|
+
* Moves this date to the start of its month in place.
|
|
247
|
+
*
|
|
248
|
+
* @returns This instance for chaining.
|
|
249
|
+
*/
|
|
250
|
+
startOfMonth(): this;
|
|
251
|
+
/**
|
|
252
|
+
* Moves this date to the start of its week in place.
|
|
253
|
+
*
|
|
254
|
+
* @param options - date-fns week options; defaults are unchanged.
|
|
255
|
+
*
|
|
256
|
+
* @returns This instance for chaining.
|
|
257
|
+
*/
|
|
258
|
+
startOfWeek(options?: dateFns.StartOfWeekOptions): this;
|
|
259
|
+
/**
|
|
260
|
+
* Subtracts the specified number of days in place using date-fns.
|
|
261
|
+
*
|
|
262
|
+
* @param amount - Number of days.
|
|
263
|
+
*
|
|
264
|
+
* @returns This instance for chaining.
|
|
265
|
+
*/
|
|
266
|
+
subDays(amount: number): this;
|
|
267
|
+
/**
|
|
268
|
+
* Subtracts the specified number of hours in place using date-fns.
|
|
269
|
+
*
|
|
270
|
+
* @param amount - Number of hours.
|
|
271
|
+
*
|
|
272
|
+
* @returns This instance for chaining.
|
|
273
|
+
*/
|
|
274
|
+
subHours(amount: number): this;
|
|
275
|
+
/**
|
|
276
|
+
* Subtracts the specified number of milliseconds in place using date-fns.
|
|
277
|
+
*
|
|
278
|
+
* @param amount - Number of milliseconds.
|
|
279
|
+
*
|
|
280
|
+
* @returns This instance for chaining.
|
|
281
|
+
*/
|
|
282
|
+
subMilliseconds(amount: number): this;
|
|
283
|
+
/**
|
|
284
|
+
* Subtracts the specified number of minutes in place using date-fns.
|
|
285
|
+
*
|
|
286
|
+
* @param amount - Number of minutes.
|
|
287
|
+
*
|
|
288
|
+
* @returns This instance for chaining.
|
|
289
|
+
*/
|
|
290
|
+
subMinutes(amount: number): this;
|
|
291
|
+
/**
|
|
292
|
+
* Subtracts the specified number of months in place using date-fns.
|
|
293
|
+
*
|
|
294
|
+
* @param amount - Number of months.
|
|
295
|
+
*
|
|
296
|
+
* @returns This instance for chaining.
|
|
297
|
+
*/
|
|
298
|
+
subMonths(amount: number): this;
|
|
299
|
+
/**
|
|
300
|
+
* Subtracts the specified number of seconds in place using date-fns.
|
|
301
|
+
*
|
|
302
|
+
* @param amount - Number of seconds.
|
|
303
|
+
*
|
|
304
|
+
* @returns This instance for chaining.
|
|
305
|
+
*/
|
|
306
|
+
subSeconds(amount: number): this;
|
|
307
|
+
/**
|
|
308
|
+
* Subtracts the specified number of weeks in place using date-fns.
|
|
309
|
+
*
|
|
310
|
+
* @param amount - Number of weeks.
|
|
311
|
+
*
|
|
312
|
+
* @returns This instance for chaining.
|
|
313
|
+
*/
|
|
314
|
+
subWeeks(amount: number): this;
|
|
315
|
+
/**
|
|
316
|
+
* Subtracts the specified number of years in place using date-fns.
|
|
317
|
+
*
|
|
318
|
+
* @param amount - Number of years.
|
|
319
|
+
*
|
|
320
|
+
* @returns This instance for chaining.
|
|
321
|
+
*/
|
|
322
|
+
subYears(amount: number): this;
|
|
323
|
+
/**
|
|
324
|
+
* Returns a new instance with days added, leaving this date unchanged.
|
|
325
|
+
*/
|
|
326
|
+
toAddDays(amount: number): EnhancedDate;
|
|
327
|
+
/**
|
|
328
|
+
* Returns a new instance with hours added, leaving this date unchanged.
|
|
329
|
+
*/
|
|
330
|
+
toAddHours(amount: number): EnhancedDate;
|
|
331
|
+
/**
|
|
332
|
+
* Returns a new instance with milliseconds added, leaving this date unchanged.
|
|
333
|
+
*/
|
|
334
|
+
toAddMilliseconds(amount: number): EnhancedDate;
|
|
335
|
+
/**
|
|
336
|
+
* Returns a new instance with minutes added, leaving this date unchanged.
|
|
337
|
+
*/
|
|
338
|
+
toAddMinutes(amount: number): EnhancedDate;
|
|
339
|
+
/**
|
|
340
|
+
* Returns a new instance with months added, leaving this date unchanged.
|
|
341
|
+
*/
|
|
342
|
+
toAddMonths(amount: number): EnhancedDate;
|
|
343
|
+
/**
|
|
344
|
+
* Returns a new instance with seconds added, leaving this date unchanged.
|
|
345
|
+
*/
|
|
346
|
+
toAddSeconds(amount: number): EnhancedDate;
|
|
347
|
+
/**
|
|
348
|
+
* Returns a new instance with weeks added, leaving this date unchanged.
|
|
349
|
+
*/
|
|
350
|
+
toAddWeeks(amount: number): EnhancedDate;
|
|
351
|
+
/**
|
|
352
|
+
* Returns a new instance with years added, leaving this date unchanged.
|
|
353
|
+
*/
|
|
354
|
+
toAddYears(amount: number): EnhancedDate;
|
|
355
|
+
/**
|
|
356
|
+
* Returns a new plain native Date; mutations are not shared with this instance.
|
|
357
|
+
*/
|
|
358
|
+
toDate(): Date;
|
|
359
|
+
/**
|
|
360
|
+
* Returns a new instance at the end of this day, leaving this date unchanged.
|
|
361
|
+
*/
|
|
362
|
+
toEndOfDay(): EnhancedDate;
|
|
363
|
+
/**
|
|
364
|
+
* Returns a new instance at the end of this minute, leaving this date unchanged.
|
|
365
|
+
*/
|
|
366
|
+
toEndOfMinute(): EnhancedDate;
|
|
367
|
+
/**
|
|
368
|
+
* Returns a new instance at the end of this month, leaving this date unchanged.
|
|
369
|
+
*/
|
|
370
|
+
toEndOfMonth(): EnhancedDate;
|
|
371
|
+
/**
|
|
372
|
+
* Returns a new instance at the end of this week, leaving this date unchanged.
|
|
373
|
+
*/
|
|
374
|
+
toEndOfWeek(options?: dateFns.EndOfWeekOptions): EnhancedDate;
|
|
375
|
+
/**
|
|
376
|
+
* Returns a new instance at the start of this day, leaving this date unchanged.
|
|
377
|
+
*/
|
|
378
|
+
toStartOfDay(): EnhancedDate;
|
|
379
|
+
/**
|
|
380
|
+
* Returns a new instance at the start of this minute, leaving this date unchanged.
|
|
381
|
+
*/
|
|
382
|
+
toStartOfMinute(): EnhancedDate;
|
|
383
|
+
/**
|
|
384
|
+
* Returns a new instance at the start of this month, leaving this date unchanged.
|
|
385
|
+
*/
|
|
386
|
+
toStartOfMonth(): EnhancedDate;
|
|
387
|
+
/**
|
|
388
|
+
* Returns a new instance at the start of this week, leaving this date unchanged.
|
|
389
|
+
*/
|
|
390
|
+
toStartOfWeek(options?: dateFns.StartOfWeekOptions): EnhancedDate;
|
|
391
|
+
/**
|
|
392
|
+
* Returns a new instance with days subtracted, leaving this date unchanged.
|
|
393
|
+
*/
|
|
394
|
+
toSubDays(amount: number): EnhancedDate;
|
|
395
|
+
/**
|
|
396
|
+
* Returns a new instance with hours subtracted, leaving this date unchanged.
|
|
397
|
+
*/
|
|
398
|
+
toSubHours(amount: number): EnhancedDate;
|
|
399
|
+
/**
|
|
400
|
+
* Returns a new instance with milliseconds subtracted, leaving this date unchanged.
|
|
401
|
+
*/
|
|
402
|
+
toSubMilliseconds(amount: number): EnhancedDate;
|
|
403
|
+
/**
|
|
404
|
+
* Returns a new instance with minutes subtracted, leaving this date unchanged.
|
|
405
|
+
*/
|
|
406
|
+
toSubMinutes(amount: number): EnhancedDate;
|
|
407
|
+
/**
|
|
408
|
+
* Returns a new instance with months subtracted, leaving this date unchanged.
|
|
409
|
+
*/
|
|
410
|
+
toSubMonths(amount: number): EnhancedDate;
|
|
411
|
+
/**
|
|
412
|
+
* Returns a new instance with seconds subtracted, leaving this date unchanged.
|
|
413
|
+
*/
|
|
414
|
+
toSubSeconds(amount: number): EnhancedDate;
|
|
415
|
+
/**
|
|
416
|
+
* Returns a new instance with weeks subtracted, leaving this date unchanged.
|
|
417
|
+
*/
|
|
418
|
+
toSubWeeks(amount: number): EnhancedDate;
|
|
419
|
+
/**
|
|
420
|
+
* Returns a new instance with years subtracted, leaving this date unchanged.
|
|
421
|
+
*/
|
|
422
|
+
toSubYears(amount: number): EnhancedDate;
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
425
|
+
//# sourceMappingURL=enhanced-date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhanced-date.d.ts","names":[],"sources":["../../src/classes/enhanced-date.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA+Ba,qBAAqB;;;;SAMvB,cAAU;;;;;;;;;;;SAcV,WACH,eACA,iBACA,eAAe,QAAQ,QAAQ,OAC/B,UAAU,QAAQ,eAAY;;;;;;;;;SAa3B,QAAQ,eAAe,UAAU,QAAQ,kBAAe;;;;;;SASxD,gBAAgB,kBAAe;;;;SAO/B,gBAAY;;;;;;;;EAanB,QAAQ;;;;;;;;EAYR,SAAS;;;;;;;;EAYT,gBAAgB;;;;;;;;EAYhB,WAAW;;;;;;;;EAYX,UAAU;;;;;;;;EAYV,WAAW;;;;;;;;EAYX,SAAS;;;;;;;;EAYT,SAAS;;;;EAQT,SAAK;;;;;;;EAUL,yBAAyB,OAAO,QAAQ,QAAQ;;;;;;;EAUhD,0BAA0B,OAAO,QAAQ,QAAQ,OAAO,UAAU,QAAQ;;;;;;;EAU1E,oBAAoB,OAAO,QAAQ,QAAQ,OAAO,UAAU,QAAQ;;;;;;EASpE;;;;;;EAUA;;;;;;EAUA;;;;;;;;EAYA,UAAU,UAAU,QAAQ;;;;;;;EAW5B,OAAO,kBAAyC,UAAU,QAAQ;;;;EAOlE,oBAAoB,UAAU,QAAQ;;;;EAOtC;;;;EAOA,QAAQ,OAAO,QAAQ,QAAQ;;;;EAO/B,SAAS,OAAO,QAAQ,QAAQ;;;;EAOhC,QAAQ,OAAO,QAAQ,QAAQ;;;;EAO/B;;;;EAOA,UAAU,OAAO,QAAQ,QAAQ;;;;EAOjC,aAAa,OAAO,QAAQ,QAAQ;;;;EAOpC;;;;EAOA;;;;EAOA;;;;;;EASA;;;;;;EAUA;;;;;;EAUA;;;;;;;;EAYA,YAAY,UAAU,QAAQ;;;;;;;;EAY9B,QAAQ;;;;;;;;EAYR,SAAS;;;;;;;;EAYT,gBAAgB;;;;;;;;EAYhB,WAAW;;;;;;;;EAYX,UAAU;;;;;;;;EAYV,WAAW;;;;;;;;EAYX,SAAS;;;;;;;;EAYT,SAAS;;;;EAQT,UAAU,iBAAc;;;;EAOxB,WAAW,iBAAc;;;;EAOzB,kBAAkB,iBAAc;;;;EAOhC,aAAa,iBAAc;;;;EAO3B,YAAY,iBAAc;;;;EAO1B,aAAa,iBAAc;;;;EAO3B,WAAW,iBAAc;;;;EAOzB,WAAW,iBAAc;;;;EAOzB,UAAM;;;;EAON,cAAU;;;;EAOV,iBAAa;;;;EAOb,gBAAY;;;;EAOZ,YAAY,UAAU,QAAQ,mBAAgB;;;;EAO9C,gBAAY;;;;EAOZ,mBAAe;;;;EAOf,kBAAc;;;;EAOd,cAAc,UAAU,QAAQ,qBAAkB;;;;EAOlD,UAAU,iBAAc;;;;EAOxB,WAAW,iBAAc;;;;EAOzB,kBAAkB,iBAAc;;;;EAOhC,aAAa,iBAAc;;;;EAO3B,YAAY,iBAAc;;;;EAO1B,aAAa,iBAAc;;;;EAO3B,WAAW,iBAAc;;;;EAOzB,WAAW,iBAAc"}
|