danholibraryjs 2.0.2 → 2.0.3
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/Extensions/Object/extracts.extension.js +6 -2
- package/dist/Extensions/Object/properties.extension.js +1 -1
- package/dist/Extensions/String/case.extension.d.ts +1 -1
- package/dist/Extensions/String/case.extension.js +4 -1
- package/docs/Classes.md +467 -467
- package/docs/Extensions.md +197 -197
- package/docs/Interfaces.md +12 -12
- package/docs/Types.md +23 -23
- package/docs/Utils.md +75 -75
- package/package.json +1 -1
- package/src/Extensions/Object/extracts.extension.ts +6 -2
- package/src/Extensions/Object/properties.extension.ts +1 -1
- package/src/Extensions/String/case.extension.ts +13 -9
package/docs/Classes.md
CHANGED
|
@@ -9,68 +9,68 @@
|
|
|
9
9
|
* Enhanced console logger with prefixes, colors, and grouping
|
|
10
10
|
*/
|
|
11
11
|
class DanhoLogger {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @param options Logger configuration
|
|
14
|
+
* @param options.name Name to display in log prefix (default: 'DanhoLogger')
|
|
15
|
+
* @param options.color Color for the prefix (default: 'inherit')
|
|
16
|
+
* @param options.preferCollapsed Whether to use collapsed groups by default (default: false)
|
|
17
|
+
*/
|
|
18
|
+
constructor(options?: { name?: string; color?: string; preferCollapsed?: boolean });
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Name displayed in log prefix
|
|
22
|
+
*/
|
|
23
|
+
public name: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Color for the prefix
|
|
27
|
+
*/
|
|
28
|
+
public color?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Logs a message
|
|
32
|
+
*/
|
|
33
|
+
public log(...args: any[]): this;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Logs a warning message
|
|
37
|
+
*/
|
|
38
|
+
public warn(...args: any[]): this;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Logs an error message
|
|
42
|
+
*/
|
|
43
|
+
public error(...args: any[]): this;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Creates a log group
|
|
47
|
+
*/
|
|
48
|
+
public group(...args: any[]): this;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Creates a collapsed log group
|
|
52
|
+
*/
|
|
53
|
+
public groupCollapsed(...args: any[]): this;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Ends the current log group
|
|
57
|
+
*/
|
|
58
|
+
public groupEnd(...args: any[]): this;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Starts a timer with a label
|
|
62
|
+
*/
|
|
63
|
+
public time(label: string): this;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Ends a timer and logs the elapsed time
|
|
67
|
+
*/
|
|
68
|
+
public timeEnd(label: string): this;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Logs data in a table format
|
|
72
|
+
*/
|
|
73
|
+
public table(data: any, columns?: string[]): this;
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
@@ -95,18 +95,18 @@ class DanhoLogger {
|
|
|
95
95
|
* @borrows Arrayable
|
|
96
96
|
*/
|
|
97
97
|
class Store<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
State extends object,
|
|
99
|
+
ActionTypes extends Record<string, any[]>,
|
|
100
|
+
Actions extends
|
|
101
|
+
{ [Action in keyof ActionTypes]: Array<Reducer<State, ActionTypes, Action>> } =
|
|
102
|
+
{ [Action in keyof ActionTypes]: Array<Reducer<State, ActionTypes, Action>> }
|
|
103
103
|
> extends EventEmitter<Record<keyof Actions, ActionTypes[keyof ActionTypes]> & Record<'stateChange', [previous: State, current: State]>> {
|
|
104
|
-
|
|
104
|
+
constructor(state: State, actions?: { [Action in keyof ActionTypes]?: Arrayable<Reducer<State, ActionTypes, Action>> });
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
private _state: State;
|
|
107
|
+
public get state(): State;
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
public dispatch<Action extends keyof ActionTypes>(action: Action, ...args: ActionTypes[Action]): State;
|
|
110
110
|
}
|
|
111
111
|
```
|
|
112
112
|
|
|
@@ -119,64 +119,64 @@ class Store<
|
|
|
119
119
|
* @borrows BaseEvent
|
|
120
120
|
*/
|
|
121
121
|
class Event<
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
Event extends BaseEvent<string, Array<any>>,
|
|
123
|
+
Name extends keyof Events = keyof Events
|
|
124
124
|
> {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Base event for @see EventEmitter, @borrows EventHandler
|
|
127
|
+
* @param name Name of event
|
|
128
|
+
* @param listeners Listeners/Handlers to execute when emitted
|
|
129
|
+
*/
|
|
130
|
+
constructor(name: Name, ...listeners: Array<EventHandler<Events, Name>>);
|
|
131
|
+
|
|
132
|
+
/**Name of event*/
|
|
133
|
+
public name: Name;
|
|
134
|
+
/**Listener limit - default: 0 */
|
|
135
|
+
public limit = 0;
|
|
136
|
+
/**Number of times event was emitted - default: 0*/
|
|
137
|
+
public get runs: number;
|
|
138
|
+
/**Timestamp of last emit - default: null*/
|
|
139
|
+
public get lastEmitted: Date;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Emits event and returns array of responses
|
|
143
|
+
* @param args Arguments required for event listeners
|
|
144
|
+
* @returns Return values of listeners' returns
|
|
145
|
+
*/
|
|
146
|
+
public emit(...args: Events[Name]): any[];
|
|
147
|
+
/**
|
|
148
|
+
* Adds listener to listeners array and returns self with new listener added
|
|
149
|
+
* @param listener Listener to add
|
|
150
|
+
* @param prepend Add first (true) or last (false) - default: false
|
|
151
|
+
* @returns this with listener added
|
|
152
|
+
*
|
|
153
|
+
* @throws Limit error, if limit was reached
|
|
154
|
+
*/
|
|
155
|
+
public on(listener: EventHandler<Events, Name>, prepend = false): this
|
|
156
|
+
/**
|
|
157
|
+
* Like Event#on, adds listener to listeners array and returns self with new listener added, however removes listener once emitted
|
|
158
|
+
* @param listener Listener to add
|
|
159
|
+
* @param prepend Add first (true) or last (false) - default: false
|
|
160
|
+
* @returns this with listener added
|
|
161
|
+
*
|
|
162
|
+
* @throws Limit error, if limit was reached
|
|
163
|
+
*/
|
|
164
|
+
public once(listener: EventHandler<Events, Name>, prepend = false): this;
|
|
165
|
+
/**
|
|
166
|
+
* Returns true or false, depending if event includes listener
|
|
167
|
+
* @param listener Listener to test
|
|
168
|
+
* @returns True of false, depending if event includes listener
|
|
169
|
+
*/
|
|
170
|
+
public includes(listener: EventHandler<Events, Name>): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Removes listener from internal listeners array
|
|
173
|
+
* @param listener Listener to remove. If none specified, all will be removed
|
|
174
|
+
* @param throwNotFoundError Throw error if listener isn't in listeners array - default: false
|
|
175
|
+
* @returns this, without listener
|
|
176
|
+
*
|
|
177
|
+
* @throws NotFound, if throwNotFoundError is true, and internal listeners array doesn't include listener provided
|
|
178
|
+
*/
|
|
179
|
+
public off(listener?: EventHandler<Events, Name>, throwNotFoundError = false): this;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
/**
|
|
@@ -186,58 +186,58 @@ class Event<
|
|
|
186
186
|
* @borrows BaseEvent
|
|
187
187
|
*/
|
|
188
188
|
class EventCollection<Events extends BaseEvent<string, Array<any>>> {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
189
|
+
/**Events to add in construction - Map<eventName, eventHandlers>*/
|
|
190
|
+
constructor(events?: Map<keyof Events, EventHandler<Events>>);
|
|
191
|
+
|
|
192
|
+
/**Amount of events stored*/
|
|
193
|
+
public get size: number
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Returns true if event is in collection
|
|
197
|
+
* @param event Event name
|
|
198
|
+
* @returns true if event is in collection
|
|
199
|
+
*/
|
|
200
|
+
public has<EventName extends keyof Events>(event: EventName): boolean
|
|
201
|
+
/**
|
|
202
|
+
* Returns all event handlers for event name. T is return type for event
|
|
203
|
+
* @param event Event name
|
|
204
|
+
* @returns Event object stored
|
|
205
|
+
*/
|
|
206
|
+
public get<EventName extends keyof Events>(event: EventName): Event<Events, EventName>
|
|
207
|
+
/**
|
|
208
|
+
* Adds handler to event collection with name as key
|
|
209
|
+
* @param name Event name
|
|
210
|
+
* @param handler Handler for event
|
|
211
|
+
* @param once Whether or not handler only should run once or all times
|
|
212
|
+
* @returns this
|
|
213
|
+
*/
|
|
214
|
+
public add<EventName extends keyof Events>(name: EventName, handler: EventHandler<Events, keyof Events>, once = false): this
|
|
215
|
+
/**
|
|
216
|
+
* @summary clear(): Clears all events
|
|
217
|
+
* @summary clear("all", myEventHandler): Removes myEventHandler from all events that have it
|
|
218
|
+
* @summary clear("myEvent"): Clears all handlers tied to "myEvent"
|
|
219
|
+
* @summary clear("myEvent", myEventHandler): Removes myEventHandler from "myEvent"
|
|
220
|
+
*
|
|
221
|
+
* @param name Event name | "all"
|
|
222
|
+
* @param handler Specific handler to remove. If left blank, all handlers in name will be removed
|
|
223
|
+
* @returns this
|
|
224
|
+
*/
|
|
225
|
+
public clear<EventName extends keyof Events>(name: EventName | 'all' = 'all', handler?: EventHandler): this
|
|
226
|
+
/**
|
|
227
|
+
* Emits event matching name, and provides args param to saved handers. Returns result from all handlers
|
|
228
|
+
* @param name Event name
|
|
229
|
+
* @param args Arguments for event handlers
|
|
230
|
+
* @returns Result from all handlers
|
|
231
|
+
*/
|
|
232
|
+
public emit<Event extends keyof Events>(name: Event, ...args: Events[Event]): any[];
|
|
233
|
+
/**
|
|
234
|
+
* Limits how many events to accept using EventEmitter#on or EventEmitter#once
|
|
235
|
+
* @param limit Limit of events to keep
|
|
236
|
+
* @returns this with the new limit
|
|
237
|
+
*
|
|
238
|
+
* @throws Unknown event, if event name isn't recognized
|
|
239
|
+
*/
|
|
240
|
+
public limit<Event extends keyof Events>(eventName: 'all' | Event, limit: number): this
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
/**
|
|
@@ -247,45 +247,45 @@ class EventCollection<Events extends BaseEvent<string, Array<any>>> {
|
|
|
247
247
|
* @borrows EventHandler
|
|
248
248
|
*/
|
|
249
249
|
class EventEmitter<Events extends BaseEvent<string, Array<any>>> {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
250
|
+
/**@param events Map<name: string, handlers: EventHandler[]>*/
|
|
251
|
+
constructor(events?: Map<keyof Events, EventHandler<Events>>);
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Adds listener to event collection, and runs listener when event is emitted
|
|
255
|
+
* @param event Event to handle
|
|
256
|
+
* @param listener Callback function to run, when event occurs
|
|
257
|
+
* @returns this
|
|
258
|
+
*/
|
|
259
|
+
on<Return extends any, Event extends keyof Events>(event: Event, listener: EventHandler<Events, Event, Return>): this;
|
|
260
|
+
/**
|
|
261
|
+
* Adds listener to event collection, and runs listener once when event is emitted
|
|
262
|
+
* @param event Event to handle
|
|
263
|
+
* @param listener Callback function to run, when event occurs
|
|
264
|
+
* @returns this
|
|
265
|
+
*/
|
|
266
|
+
once<Return extends any, Event extends keyof Events>(event: Event, listener: EventHandler<Events, Event, Return>): this;
|
|
267
|
+
/**
|
|
268
|
+
* Removes listener(s) from event
|
|
269
|
+
* @param event Event to get collection of listeners | "all"
|
|
270
|
+
* @param listener If left null, removes all listeners tied to event, else only removes listener from event
|
|
271
|
+
* @returns this
|
|
272
|
+
*/
|
|
273
|
+
off<Return extends any, Event extends keyof Events>(event: Event | 'all' = 'all', listener?: EventHandler<Events, Event, Return>): this;
|
|
274
|
+
/**
|
|
275
|
+
* Emits event and runs all listeners tied to event
|
|
276
|
+
* @param event Event to emit
|
|
277
|
+
* @param args Arguments for the event
|
|
278
|
+
* @fires event
|
|
279
|
+
* @returns Array of listeners' reponses
|
|
280
|
+
*/
|
|
281
|
+
emit<Return extends any, Event extends keyof Events>(event: Event, ...args: Events[Event]): Array<Return>;
|
|
282
|
+
/**
|
|
283
|
+
* Limits how many events to accept using EventEmitter#on or EventEmitter#once
|
|
284
|
+
* @param event: Specific event to limit, or by default, 'all'
|
|
285
|
+
* @param limit Limit of events to keep. If you want to limit amount of events saved, use 'all'.
|
|
286
|
+
* @returns this with the new limit
|
|
287
|
+
*/
|
|
288
|
+
public limit<Event extends keyof Events>(event: 'all' | Event, limit: number): this;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
```
|
|
@@ -294,97 +294,97 @@ class EventEmitter<Events extends BaseEvent<string, Array<any>>> {
|
|
|
294
294
|
|
|
295
295
|
```ts
|
|
296
296
|
class DanhoDate {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
297
|
+
constructor(data: Constructor)
|
|
298
|
+
|
|
299
|
+
protected _date: Date;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Year of the date
|
|
303
|
+
*/
|
|
304
|
+
public year: number
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Month of the date
|
|
308
|
+
*/
|
|
309
|
+
public month: number
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Days in the month of the date
|
|
313
|
+
*/
|
|
314
|
+
public daysInMonth: number
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Week of the year the day is in
|
|
318
|
+
*/
|
|
319
|
+
public week: number
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Week of the month the day is in
|
|
323
|
+
*/
|
|
324
|
+
public weekOfMonth: number
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Day of the date
|
|
328
|
+
*/
|
|
329
|
+
public day: number
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Hours of the date
|
|
333
|
+
*/
|
|
334
|
+
public hours: number
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Minutes of the date
|
|
338
|
+
*/
|
|
339
|
+
public minutes: number
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Seconds of the date
|
|
343
|
+
*/
|
|
344
|
+
public seconds: number
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Milliseconds of the date
|
|
348
|
+
*/
|
|
349
|
+
public milliseconds: number
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Week day i.e. Monday
|
|
353
|
+
*/
|
|
354
|
+
public get weekDay: LongDay
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Short week day i.e. Mon
|
|
358
|
+
*/
|
|
359
|
+
public get weekDayShort: ShortDay
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Month name i.e. February
|
|
363
|
+
*/
|
|
364
|
+
public get monthName: LongMonth
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Short month name i.e. Feb
|
|
368
|
+
*/
|
|
369
|
+
public get monthNameShort: ShortMonth
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Sets internal date property
|
|
373
|
+
* @param data Time properties to set - replacement of i.e. Date.setHours(value: number): number
|
|
374
|
+
* @returns This, with updated properties
|
|
375
|
+
*/
|
|
376
|
+
public set(data: Partial<Data>): this
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Calculates the time between this date and provided date
|
|
380
|
+
* @returns TimeSpan between dates
|
|
381
|
+
*/
|
|
382
|
+
public between(date: DanhoDate | Constructor): TimeSpan
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* String representation of Date. Use internal comment for formatting
|
|
386
|
+
*/
|
|
387
|
+
public toString(format = "$dd/$MM/$year", relativeFormat?: TimeSpanFormat): string
|
|
388
388
|
}
|
|
389
389
|
|
|
390
390
|
/**
|
|
@@ -393,78 +393,78 @@ class DanhoDate {
|
|
|
393
393
|
* @borrows ms
|
|
394
394
|
*/
|
|
395
395
|
class Time {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
396
|
+
/**
|
|
397
|
+
* Array of amount of days in the months. 0 indexed
|
|
398
|
+
*/
|
|
399
|
+
public static get daysInMonth: Array<number>
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Amount of weeks per year
|
|
403
|
+
*/
|
|
404
|
+
public static get weeksInYear: number
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Amount of days per year
|
|
408
|
+
*/
|
|
409
|
+
public static get daysInYear: number
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Returns function that converts value into double digit string
|
|
413
|
+
* @returns (value: number): string
|
|
414
|
+
*/
|
|
415
|
+
public static get DoubleDigit(): string
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Array of names of the months. 0 idnexed
|
|
419
|
+
*/
|
|
420
|
+
public static get MonthNames: Array<LongMonth>
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Array of names of the days of the week. 0 indexed
|
|
424
|
+
*/
|
|
425
|
+
public static get DayNames: Array<LongDay>
|
|
426
|
+
|
|
427
|
+
/*
|
|
428
|
+
* Millisecond in milliseconds (I know that sounds silly but it makes sense later on?)
|
|
429
|
+
*/
|
|
430
|
+
public static get millisecond: number;
|
|
431
|
+
/*
|
|
432
|
+
* Second in milliseconds
|
|
433
|
+
*/
|
|
434
|
+
public static get second: number;
|
|
435
|
+
/*
|
|
436
|
+
* Minute in milliseconds
|
|
437
|
+
*/
|
|
438
|
+
public static get minute: number;
|
|
439
|
+
/*
|
|
440
|
+
* Hour in milliseconds
|
|
441
|
+
*/
|
|
442
|
+
public static get hour: number;
|
|
443
|
+
/*
|
|
444
|
+
* Day in milliseconds
|
|
445
|
+
*/
|
|
446
|
+
public static get day: number;
|
|
447
|
+
/*
|
|
448
|
+
* Week in milliseconds
|
|
449
|
+
*/
|
|
450
|
+
public static get week: number;
|
|
451
|
+
/*
|
|
452
|
+
* Month in milliseconds
|
|
453
|
+
*/
|
|
454
|
+
public static get month: number;
|
|
455
|
+
/*
|
|
456
|
+
* Year in milliseconds
|
|
457
|
+
*/
|
|
458
|
+
public static get year: number;
|
|
459
|
+
/*
|
|
460
|
+
* Average month in milliseconds
|
|
461
|
+
*/
|
|
462
|
+
public static get avgMonth: number;
|
|
463
|
+
|
|
464
|
+
/*
|
|
465
|
+
* Converts TimeDelay input into milliseconds
|
|
466
|
+
*/
|
|
467
|
+
public static ms(input: TimeDelay): number
|
|
468
468
|
}
|
|
469
469
|
|
|
470
470
|
/**
|
|
@@ -474,90 +474,90 @@ class Time {
|
|
|
474
474
|
* @borrows TimeProperties
|
|
475
475
|
*/
|
|
476
476
|
class TimeSpan implements TimeProperties<true> {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
477
|
+
constructor(from: TimeSpanValue, to: TimeSpanValue = Date.now());
|
|
478
|
+
|
|
479
|
+
/*
|
|
480
|
+
* Total x between dates
|
|
481
|
+
*/
|
|
482
|
+
public years: number;
|
|
483
|
+
/*
|
|
484
|
+
* Total x between dates
|
|
485
|
+
*/
|
|
486
|
+
public months: number;
|
|
487
|
+
/*
|
|
488
|
+
* Total x between dates
|
|
489
|
+
*/
|
|
490
|
+
public weeks: number;
|
|
491
|
+
/*
|
|
492
|
+
* Total x between dates
|
|
493
|
+
*/
|
|
494
|
+
public days: number;
|
|
495
|
+
/*
|
|
496
|
+
* Total x between dates
|
|
497
|
+
*/
|
|
498
|
+
public hours: number;
|
|
499
|
+
/*
|
|
500
|
+
* Total x between dates
|
|
501
|
+
*/
|
|
502
|
+
public minutes: number;
|
|
503
|
+
/*
|
|
504
|
+
* Total x between dates
|
|
505
|
+
*/
|
|
506
|
+
public seconds: number;
|
|
507
|
+
/*
|
|
508
|
+
* Total x between dates
|
|
509
|
+
*/
|
|
510
|
+
public milliseconds: number;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Get the maximum amount of months between the two dates
|
|
514
|
+
* @returns Number of max amount of months that are between the two dates
|
|
515
|
+
*/
|
|
516
|
+
public getTotalMonths(): number;
|
|
517
|
+
/**
|
|
518
|
+
* Get the maximum amount of weeks between the two dates
|
|
519
|
+
* @returns Number of max amount of weeks that are between the two dates
|
|
520
|
+
*/
|
|
521
|
+
public getTotalWeeks(): number;
|
|
522
|
+
/**
|
|
523
|
+
* Get the maximum amount of days between the two dates
|
|
524
|
+
* @returns Number of max amount of days that are between the two dates
|
|
525
|
+
*/
|
|
526
|
+
public getTotalDays(): number;
|
|
527
|
+
/**
|
|
528
|
+
* Get the maximum amount of hours between the two dates
|
|
529
|
+
* @returns Number of max amount of hours that are between the two dates
|
|
530
|
+
*/
|
|
531
|
+
public getTotalHours(): number;
|
|
532
|
+
/**
|
|
533
|
+
* Get the maximum amount of minutes between the two dates
|
|
534
|
+
* @returns Number of max amount of minutes that are between the two dates
|
|
535
|
+
*/
|
|
536
|
+
public getTotalMinutes(): number;
|
|
537
|
+
/**
|
|
538
|
+
* Get the maximum amount of seconds between the two dates
|
|
539
|
+
* @returns Number of max amount of seconds that are between the two dates
|
|
540
|
+
*/
|
|
541
|
+
public getTotalSeconds(): number;
|
|
542
|
+
/**
|
|
543
|
+
* Get the maximum amount of milliseconds between the two dates
|
|
544
|
+
* @returns Number of max amount of milliseconds that are between the two dates
|
|
545
|
+
*/
|
|
546
|
+
public getTotalMilliseconds(): number;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Start date of timespan
|
|
550
|
+
*/
|
|
551
|
+
public from: DanhoDate;
|
|
552
|
+
/**
|
|
553
|
+
* End date of timespan
|
|
554
|
+
*/
|
|
555
|
+
public to: DanhoDate;
|
|
556
|
+
/**
|
|
557
|
+
* Timespan is in the past
|
|
558
|
+
*/
|
|
559
|
+
public pastTense: boolean;
|
|
560
|
+
|
|
561
|
+
public toString(includeMs: boolean = false): string
|
|
562
562
|
}
|
|
563
563
|
```
|