@pawells/typescript-common 1.0.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/LICENSE +21 -0
- package/README.md +148 -0
- package/build/array/array-chunk.d.ts +10 -0
- package/build/array/array-chunk.d.ts.map +1 -0
- package/build/array/array-chunk.js +19 -0
- package/build/array/array-chunk.js.map +1 -0
- package/build/array/array-compact.d.ts +18 -0
- package/build/array/array-compact.d.ts.map +1 -0
- package/build/array/array-compact.js +22 -0
- package/build/array/array-compact.js.map +1 -0
- package/build/array/array-contains.d.ts +9 -0
- package/build/array/array-contains.d.ts.map +1 -0
- package/build/array/array-contains.js +13 -0
- package/build/array/array-contains.js.map +1 -0
- package/build/array/array-count-by.d.ts +21 -0
- package/build/array/array-count-by.d.ts.map +1 -0
- package/build/array/array-count-by.js +29 -0
- package/build/array/array-count-by.js.map +1 -0
- package/build/array/array-difference.d.ts +25 -0
- package/build/array/array-difference.d.ts.map +1 -0
- package/build/array/array-difference.js +34 -0
- package/build/array/array-difference.js.map +1 -0
- package/build/array/array-element.d.ts +7 -0
- package/build/array/array-element.d.ts.map +1 -0
- package/build/array/array-element.js +2 -0
- package/build/array/array-element.js.map +1 -0
- package/build/array/array-filter.d.ts +37 -0
- package/build/array/array-filter.d.ts.map +1 -0
- package/build/array/array-filter.js +78 -0
- package/build/array/array-filter.js.map +1 -0
- package/build/array/array-flatten.d.ts +16 -0
- package/build/array/array-flatten.d.ts.map +1 -0
- package/build/array/array-flatten.js +20 -0
- package/build/array/array-flatten.js.map +1 -0
- package/build/array/array-group-by.d.ts +13 -0
- package/build/array/array-group-by.d.ts.map +1 -0
- package/build/array/array-group-by.js +24 -0
- package/build/array/array-group-by.js.map +1 -0
- package/build/array/array-intersection.d.ts +25 -0
- package/build/array/array-intersection.d.ts.map +1 -0
- package/build/array/array-intersection.js +39 -0
- package/build/array/array-intersection.js.map +1 -0
- package/build/array/array-partition.d.ts +19 -0
- package/build/array/array-partition.d.ts.map +1 -0
- package/build/array/array-partition.js +32 -0
- package/build/array/array-partition.js.map +1 -0
- package/build/array/array-range.d.ts +18 -0
- package/build/array/array-range.d.ts.map +1 -0
- package/build/array/array-range.js +30 -0
- package/build/array/array-range.js.map +1 -0
- package/build/array/array-sample.d.ts +29 -0
- package/build/array/array-sample.d.ts.map +1 -0
- package/build/array/array-sample.js +19 -0
- package/build/array/array-sample.js.map +1 -0
- package/build/array/array-shuffle.d.ts +8 -0
- package/build/array/array-shuffle.d.ts.map +1 -0
- package/build/array/array-shuffle.js +19 -0
- package/build/array/array-shuffle.js.map +1 -0
- package/build/array/array-sort-by.d.ts +20 -0
- package/build/array/array-sort-by.d.ts.map +1 -0
- package/build/array/array-sort-by.js +31 -0
- package/build/array/array-sort-by.js.map +1 -0
- package/build/array/array-zip.d.ts +22 -0
- package/build/array/array-zip.d.ts.map +1 -0
- package/build/array/array-zip.js +25 -0
- package/build/array/array-zip.js.map +1 -0
- package/build/array/array.test.d.ts +2 -0
- package/build/array/array.test.d.ts.map +1 -0
- package/build/array/array.test.js +347 -0
- package/build/array/array.test.js.map +1 -0
- package/build/array/index.d.ts +27 -0
- package/build/array/index.d.ts.map +1 -0
- package/build/array/index.js +25 -0
- package/build/array/index.js.map +1 -0
- package/build/array/types.d.ts +32 -0
- package/build/array/types.d.ts.map +1 -0
- package/build/array/types.js +2 -0
- package/build/array/types.js.map +1 -0
- package/build/array/unique.d.ts +8 -0
- package/build/array/unique.d.ts.map +1 -0
- package/build/array/unique.js +13 -0
- package/build/array/unique.js.map +1 -0
- package/build/enum/enum-entries.d.ts +11 -0
- package/build/enum/enum-entries.d.ts.map +1 -0
- package/build/enum/enum-entries.js +14 -0
- package/build/enum/enum-entries.js.map +1 -0
- package/build/enum/enum-key-by-value.d.ts +13 -0
- package/build/enum/enum-key-by-value.d.ts.map +1 -0
- package/build/enum/enum-key-by-value.js +21 -0
- package/build/enum/enum-key-by-value.js.map +1 -0
- package/build/enum/enum-keys.d.ts +10 -0
- package/build/enum/enum-keys.d.ts.map +1 -0
- package/build/enum/enum-keys.js +14 -0
- package/build/enum/enum-keys.js.map +1 -0
- package/build/enum/enum-safe-value.d.ts +14 -0
- package/build/enum/enum-safe-value.d.ts.map +1 -0
- package/build/enum/enum-safe-value.js +16 -0
- package/build/enum/enum-safe-value.js.map +1 -0
- package/build/enum/enum-values.d.ts +19 -0
- package/build/enum/enum-values.d.ts.map +1 -0
- package/build/enum/enum-values.js +25 -0
- package/build/enum/enum-values.js.map +1 -0
- package/build/enum/enum.test.d.ts +2 -0
- package/build/enum/enum.test.d.ts.map +1 -0
- package/build/enum/enum.test.js +122 -0
- package/build/enum/enum.test.js.map +1 -0
- package/build/enum/index.d.ts +17 -0
- package/build/enum/index.d.ts.map +1 -0
- package/build/enum/index.js +17 -0
- package/build/enum/index.js.map +1 -0
- package/build/enum/types.d.ts +9 -0
- package/build/enum/types.d.ts.map +1 -0
- package/build/enum/types.js +2 -0
- package/build/enum/types.js.map +1 -0
- package/build/enum/validate-enum-value.d.ts +13 -0
- package/build/enum/validate-enum-value.d.ts.map +1 -0
- package/build/enum/validate-enum-value.js +18 -0
- package/build/enum/validate-enum-value.js.map +1 -0
- package/build/function/compose.d.ts +37 -0
- package/build/function/compose.d.ts.map +1 -0
- package/build/function/compose.js +7 -0
- package/build/function/compose.js.map +1 -0
- package/build/function/debounce.d.ts +25 -0
- package/build/function/debounce.d.ts.map +1 -0
- package/build/function/debounce.js +37 -0
- package/build/function/debounce.js.map +1 -0
- package/build/function/function.test.d.ts +2 -0
- package/build/function/function.test.d.ts.map +1 -0
- package/build/function/function.test.js +158 -0
- package/build/function/function.test.js.map +1 -0
- package/build/function/index.d.ts +17 -0
- package/build/function/index.d.ts.map +1 -0
- package/build/function/index.js +16 -0
- package/build/function/index.js.map +1 -0
- package/build/function/memoize.d.ts +23 -0
- package/build/function/memoize.d.ts.map +1 -0
- package/build/function/memoize.js +34 -0
- package/build/function/memoize.js.map +1 -0
- package/build/function/once.d.ts +17 -0
- package/build/function/once.d.ts.map +1 -0
- package/build/function/once.js +27 -0
- package/build/function/once.js.map +1 -0
- package/build/function/sleep.d.ts +20 -0
- package/build/function/sleep.d.ts.map +1 -0
- package/build/function/sleep.js +22 -0
- package/build/function/sleep.js.map +1 -0
- package/build/function/throttle.d.ts +17 -0
- package/build/function/throttle.d.ts.map +1 -0
- package/build/function/throttle.js +37 -0
- package/build/function/throttle.js.map +1 -0
- package/build/function/types.d.ts +5 -0
- package/build/function/types.d.ts.map +1 -0
- package/build/function/types.js +2 -0
- package/build/function/types.js.map +1 -0
- package/build/index.d.ts +32 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +51 -0
- package/build/index.js.map +1 -0
- package/build/object/assert-object.d.ts +8 -0
- package/build/object/assert-object.d.ts.map +1 -0
- package/build/object/assert-object.js +10 -0
- package/build/object/assert-object.js.map +1 -0
- package/build/object/clone.d.ts +39 -0
- package/build/object/clone.d.ts.map +1 -0
- package/build/object/clone.js +85 -0
- package/build/object/clone.js.map +1 -0
- package/build/object/equals.d.ts +44 -0
- package/build/object/equals.d.ts.map +1 -0
- package/build/object/equals.js +104 -0
- package/build/object/equals.js.map +1 -0
- package/build/object/filter-cached.d.ts +9 -0
- package/build/object/filter-cached.d.ts.map +1 -0
- package/build/object/filter-cached.js +108 -0
- package/build/object/filter-cached.js.map +1 -0
- package/build/object/filter.d.ts +85 -0
- package/build/object/filter.d.ts.map +1 -0
- package/build/object/filter.js +248 -0
- package/build/object/filter.js.map +1 -0
- package/build/object/has-circular-reference.d.ts +8 -0
- package/build/object/has-circular-reference.d.ts.map +1 -0
- package/build/object/has-circular-reference.js +40 -0
- package/build/object/has-circular-reference.js.map +1 -0
- package/build/object/hash.d.ts +20 -0
- package/build/object/hash.d.ts.map +1 -0
- package/build/object/hash.js +39 -0
- package/build/object/hash.js.map +1 -0
- package/build/object/index.d.ts +32 -0
- package/build/object/index.d.ts.map +1 -0
- package/build/object/index.js +30 -0
- package/build/object/index.js.map +1 -0
- package/build/object/key-value-pairs.d.ts +21 -0
- package/build/object/key-value-pairs.d.ts.map +1 -0
- package/build/object/key-value-pairs.js +28 -0
- package/build/object/key-value-pairs.js.map +1 -0
- package/build/object/map-cached.d.ts +9 -0
- package/build/object/map-cached.d.ts.map +1 -0
- package/build/object/map-cached.js +97 -0
- package/build/object/map-cached.js.map +1 -0
- package/build/object/map.d.ts +29 -0
- package/build/object/map.d.ts.map +1 -0
- package/build/object/map.js +40 -0
- package/build/object/map.js.map +1 -0
- package/build/object/merge.d.ts +14 -0
- package/build/object/merge.d.ts.map +1 -0
- package/build/object/merge.js +41 -0
- package/build/object/merge.js.map +1 -0
- package/build/object/object-diff.d.ts +40 -0
- package/build/object/object-diff.d.ts.map +1 -0
- package/build/object/object-diff.js +45 -0
- package/build/object/object-diff.js.map +1 -0
- package/build/object/object-flatten.d.ts +22 -0
- package/build/object/object-flatten.d.ts.map +1 -0
- package/build/object/object-flatten.js +38 -0
- package/build/object/object-flatten.js.map +1 -0
- package/build/object/object-invert.d.ts +20 -0
- package/build/object/object-invert.d.ts.map +1 -0
- package/build/object/object-invert.js +26 -0
- package/build/object/object-invert.js.map +1 -0
- package/build/object/object.test.d.ts +2 -0
- package/build/object/object.test.d.ts.map +1 -0
- package/build/object/object.test.js +432 -0
- package/build/object/object.test.js.map +1 -0
- package/build/object/omit.d.ts +8 -0
- package/build/object/omit.d.ts.map +1 -0
- package/build/object/omit.js +17 -0
- package/build/object/omit.js.map +1 -0
- package/build/object/pick.d.ts +50 -0
- package/build/object/pick.d.ts.map +1 -0
- package/build/object/pick.js +60 -0
- package/build/object/pick.js.map +1 -0
- package/build/object/property-paths.d.ts +115 -0
- package/build/object/property-paths.d.ts.map +1 -0
- package/build/object/property-paths.js +170 -0
- package/build/object/property-paths.js.map +1 -0
- package/build/object/security-utils.d.ts +59 -0
- package/build/object/security-utils.d.ts.map +1 -0
- package/build/object/security-utils.js +165 -0
- package/build/object/security-utils.js.map +1 -0
- package/build/object/sort-keys.d.ts +26 -0
- package/build/object/sort-keys.d.ts.map +1 -0
- package/build/object/sort-keys.js +52 -0
- package/build/object/sort-keys.js.map +1 -0
- package/build/object/types.d.ts +152 -0
- package/build/object/types.d.ts.map +1 -0
- package/build/object/types.js +6 -0
- package/build/object/types.js.map +1 -0
- package/build/string/case-conversion.d.ts +50 -0
- package/build/string/case-conversion.d.ts.map +1 -0
- package/build/string/case-conversion.js +94 -0
- package/build/string/case-conversion.js.map +1 -0
- package/build/string/formatting.d.ts +108 -0
- package/build/string/formatting.d.ts.map +1 -0
- package/build/string/formatting.js +171 -0
- package/build/string/formatting.js.map +1 -0
- package/build/string/index.d.ts +15 -0
- package/build/string/index.d.ts.map +1 -0
- package/build/string/index.js +14 -0
- package/build/string/index.js.map +1 -0
- package/build/string/string.test.d.ts +2 -0
- package/build/string/string.test.d.ts.map +1 -0
- package/build/string/string.test.js +321 -0
- package/build/string/string.test.js.map +1 -0
- package/build/string/transformation.d.ts +18 -0
- package/build/string/transformation.d.ts.map +1 -0
- package/build/string/transformation.js +32 -0
- package/build/string/transformation.js.map +1 -0
- package/build/string/types.d.ts +44 -0
- package/build/string/types.d.ts.map +1 -0
- package/build/string/types.js +2 -0
- package/build/string/types.js.map +1 -0
- package/build/string/validation.d.ts +18 -0
- package/build/string/validation.d.ts.map +1 -0
- package/build/string/validation.js +26 -0
- package/build/string/validation.js.map +1 -0
- package/build/time/elapsed-time/constants.d.ts +10 -0
- package/build/time/elapsed-time/constants.d.ts.map +1 -0
- package/build/time/elapsed-time/constants.js +96 -0
- package/build/time/elapsed-time/constants.js.map +1 -0
- package/build/time/elapsed-time/elapsed-time.d.ts +412 -0
- package/build/time/elapsed-time/elapsed-time.d.ts.map +1 -0
- package/build/time/elapsed-time/elapsed-time.js +652 -0
- package/build/time/elapsed-time/elapsed-time.js.map +1 -0
- package/build/time/elapsed-time/types.d.ts +150 -0
- package/build/time/elapsed-time/types.d.ts.map +1 -0
- package/build/time/elapsed-time/types.js +2 -0
- package/build/time/elapsed-time/types.js.map +1 -0
- package/build/time/elapsed-time/utils.d.ts +18 -0
- package/build/time/elapsed-time/utils.d.ts.map +1 -0
- package/build/time/elapsed-time/utils.js +24 -0
- package/build/time/elapsed-time/utils.js.map +1 -0
- package/build/time/index.d.ts +18 -0
- package/build/time/index.d.ts.map +1 -0
- package/build/time/index.js +17 -0
- package/build/time/index.js.map +1 -0
- package/build/time/stopwatch/entry-types.d.ts +13 -0
- package/build/time/stopwatch/entry-types.d.ts.map +1 -0
- package/build/time/stopwatch/entry-types.js +2 -0
- package/build/time/stopwatch/entry-types.js.map +1 -0
- package/build/time/stopwatch/entry.d.ts +80 -0
- package/build/time/stopwatch/entry.d.ts.map +1 -0
- package/build/time/stopwatch/entry.js +105 -0
- package/build/time/stopwatch/entry.js.map +1 -0
- package/build/time/stopwatch/stopwatch.d.ts +232 -0
- package/build/time/stopwatch/stopwatch.d.ts.map +1 -0
- package/build/time/stopwatch/stopwatch.js +315 -0
- package/build/time/stopwatch/stopwatch.js.map +1 -0
- package/build/time/time.test.d.ts +2 -0
- package/build/time/time.test.d.ts.map +1 -0
- package/build/time/time.test.js +211 -0
- package/build/time/time.test.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { ElapsedTime } from '../elapsed-time/elapsed-time.js';
|
|
2
|
+
import { StopwatchEntry } from './entry.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a stopwatch for measuring time intervals.
|
|
5
|
+
*
|
|
6
|
+
* A `Stopwatch` records a chronological list of {@link StopwatchEntry} timestamps
|
|
7
|
+
* and can be started, stopped, paused, resumed, lapped, and reset. The elapsed
|
|
8
|
+
* time is computed from the recorded entries rather than an active timer, so it
|
|
9
|
+
* is always accurate even after the stopwatch has been stopped.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Basic start/stop usage
|
|
14
|
+
* const sw = new Stopwatch();
|
|
15
|
+
* sw.Start();
|
|
16
|
+
* // ... do work ...
|
|
17
|
+
* sw.Stop();
|
|
18
|
+
* console.log(sw.Elapsed.Format('CONCISE')); // e.g. "1s 250ms"
|
|
19
|
+
*
|
|
20
|
+
* // Start immediately via constructor
|
|
21
|
+
* const sw2 = new Stopwatch(true);
|
|
22
|
+
* // ... do work ...
|
|
23
|
+
* console.log(sw2.Elapsed.Format('MEDIUM')); // e.g. "2 sec 300 ms"
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare class Stopwatch {
|
|
27
|
+
private _times;
|
|
28
|
+
private _pausedAt;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new `Stopwatch` instance.
|
|
31
|
+
*
|
|
32
|
+
* @param startImmediately - When `true`, calls {@link Start} automatically
|
|
33
|
+
* so the stopwatch begins tracking time as soon as it is constructed.
|
|
34
|
+
* Defaults to `false`.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const sw = new Stopwatch(); // not yet running
|
|
39
|
+
* const sw2 = new Stopwatch(true); // running immediately
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
constructor(startImmediately?: boolean);
|
|
43
|
+
/**
|
|
44
|
+
* Whether the stopwatch is currently running (started and not paused/stopped).
|
|
45
|
+
*
|
|
46
|
+
* @returns `true` if the stopwatch has been started and is not currently paused or stopped.
|
|
47
|
+
*/
|
|
48
|
+
get Running(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The first entry recorded by this stopwatch (i.e. the start entry).
|
|
51
|
+
*
|
|
52
|
+
* @returns The first {@link StopwatchEntry}, or `undefined` if the stopwatch
|
|
53
|
+
* has never been started.
|
|
54
|
+
*/
|
|
55
|
+
get First(): StopwatchEntry | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* The most recently recorded entry.
|
|
58
|
+
*
|
|
59
|
+
* @returns The latest {@link StopwatchEntry}, or `undefined` if no entries
|
|
60
|
+
* have been recorded yet.
|
|
61
|
+
*/
|
|
62
|
+
get Latest(): StopwatchEntry | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* The total time elapsed since the stopwatch was first started.
|
|
65
|
+
*
|
|
66
|
+
* - While the stopwatch is **running**, this reflects the time between the
|
|
67
|
+
* first entry and `Date.now()`.
|
|
68
|
+
* - While the stopwatch is **paused or stopped**, this reflects the time
|
|
69
|
+
* between the first entry and the moment it was paused/stopped.
|
|
70
|
+
* - Returns an {@link ElapsedTime} of `0` if the stopwatch has never been started.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const sw = new Stopwatch(true);
|
|
75
|
+
* // ... 500ms later ...
|
|
76
|
+
* sw.Stop();
|
|
77
|
+
* console.log(sw.Elapsed.Format()); // "500ms"
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
get Elapsed(): ElapsedTime;
|
|
81
|
+
/**
|
|
82
|
+
* A shallow copy of all recorded {@link StopwatchEntry} objects in
|
|
83
|
+
* chronological order.
|
|
84
|
+
*
|
|
85
|
+
* Modifying the returned array does not affect the internal state.
|
|
86
|
+
*/
|
|
87
|
+
get Times(): StopwatchEntry[];
|
|
88
|
+
/**
|
|
89
|
+
* Alias for {@link Times}. Returns a shallow copy of all recorded entries.
|
|
90
|
+
*/
|
|
91
|
+
get Entries(): StopwatchEntry[];
|
|
92
|
+
/**
|
|
93
|
+
* The timestamp (milliseconds since epoch) at which the stopwatch was last
|
|
94
|
+
* paused or stopped, or `null` if it is currently running.
|
|
95
|
+
*/
|
|
96
|
+
get PausedAt(): number | null;
|
|
97
|
+
/**
|
|
98
|
+
* Starts the stopwatch by recording an initial timestamp entry.
|
|
99
|
+
*
|
|
100
|
+
* If the stopwatch has already been started, this is a no-op and the
|
|
101
|
+
* existing latest entry is returned without creating a new one.
|
|
102
|
+
*
|
|
103
|
+
* @returns The start {@link StopwatchEntry} that was recorded, or `undefined`
|
|
104
|
+
* if the stopwatch was already running (should not happen in practice).
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const sw = new Stopwatch();
|
|
109
|
+
* const entry = sw.Start();
|
|
110
|
+
* console.log(sw.Running); // true
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
Start(): StopwatchEntry | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Stops the stopwatch by recording a final timestamp entry.
|
|
116
|
+
*
|
|
117
|
+
* - If the stopwatch is currently running, the current time is recorded as
|
|
118
|
+
* the stop entry and `_pausedAt` is set to freeze the elapsed time.
|
|
119
|
+
* - If the stopwatch has already been stopped, the latest entry is returned
|
|
120
|
+
* unchanged (idempotent).
|
|
121
|
+
* - If the stopwatch was never started, returns `undefined`.
|
|
122
|
+
*
|
|
123
|
+
* @returns The stop {@link StopwatchEntry}, or `undefined` if the stopwatch
|
|
124
|
+
* had not been started.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const sw = new Stopwatch(true);
|
|
129
|
+
* // ... some work ...
|
|
130
|
+
* const stopEntry = sw.Stop();
|
|
131
|
+
* console.log(sw.Running); // false
|
|
132
|
+
* console.log(sw.Elapsed.Format()); // e.g. "500ms"
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
Stop(): StopwatchEntry | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Pauses the stopwatch, freezing the elapsed time at the current moment.
|
|
138
|
+
*
|
|
139
|
+
* If the stopwatch has not been started, returns `null`. Unlike {@link Stop},
|
|
140
|
+
* `Pause` does not record a new timestamp entry — it only sets the internal
|
|
141
|
+
* pause marker so that subsequent reads of {@link Elapsed} return a frozen value.
|
|
142
|
+
*
|
|
143
|
+
* @returns The latest {@link StopwatchEntry} at the time of pausing, or `null`
|
|
144
|
+
* if the stopwatch had not been started.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* const sw = new Stopwatch(true);
|
|
149
|
+
* // ... 200ms ...
|
|
150
|
+
* sw.Pause();
|
|
151
|
+
* // ... 500ms later ...
|
|
152
|
+
* console.log(sw.Elapsed.Format()); // still "200ms"
|
|
153
|
+
* sw.Resume();
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
Pause(): StopwatchEntry | null;
|
|
157
|
+
/**
|
|
158
|
+
* Resumes a paused stopwatch by recording a new timestamp entry.
|
|
159
|
+
*
|
|
160
|
+
* If the stopwatch is not currently paused, returns `null` and has no effect.
|
|
161
|
+
* After resuming, elapsed-time calculations continue to accumulate from where
|
|
162
|
+
* they left off.
|
|
163
|
+
*
|
|
164
|
+
* @returns A new {@link StopwatchEntry} recording the resume time, or `null`
|
|
165
|
+
* if the stopwatch was not paused.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* const sw = new Stopwatch(true);
|
|
170
|
+
* sw.Pause();
|
|
171
|
+
* const resumeEntry = sw.Resume();
|
|
172
|
+
* console.log(sw.Running); // true
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
Resume(): StopwatchEntry | null;
|
|
176
|
+
/**
|
|
177
|
+
* Records a click entry at the current moment without changing the
|
|
178
|
+
* running/paused state.
|
|
179
|
+
*
|
|
180
|
+
* If the stopwatch has no entries yet, the first click implicitly starts it.
|
|
181
|
+
* Use this for arbitrary timestamp recording or as the building block for
|
|
182
|
+
* {@link Lap}.
|
|
183
|
+
*
|
|
184
|
+
* @returns The newly recorded {@link StopwatchEntry}.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* const sw = new Stopwatch(true);
|
|
189
|
+
* const mark = sw.Click();
|
|
190
|
+
* console.log(mark.Elapsed.Format()); // time since last click / start
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
Click(): StopwatchEntry;
|
|
194
|
+
/**
|
|
195
|
+
* Records a lap by clicking the stopwatch and returning the elapsed time
|
|
196
|
+
* since the previous entry.
|
|
197
|
+
*
|
|
198
|
+
* Internally calls {@link Click} to record a new entry, then computes the
|
|
199
|
+
* difference between the new entry's timestamp and the previous one.
|
|
200
|
+
* Returns `ElapsedTime(0)` if this is the very first entry recorded.
|
|
201
|
+
*
|
|
202
|
+
* @returns An {@link ElapsedTime} representing the lap duration.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* const sw = new Stopwatch(true);
|
|
207
|
+
* // ... 300ms ...
|
|
208
|
+
* const lap1 = sw.Lap(); // ~300ms
|
|
209
|
+
* // ... 150ms ...
|
|
210
|
+
* const lap2 = sw.Lap(); // ~150ms
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
Lap(): ElapsedTime;
|
|
214
|
+
/**
|
|
215
|
+
* Resets the stopwatch to its initial state by clearing all recorded entries
|
|
216
|
+
* and removing any pause/stop marker.
|
|
217
|
+
*
|
|
218
|
+
* After calling `Reset()`, the stopwatch is in the same state as a freshly
|
|
219
|
+
* constructed instance. Call {@link Start} to begin timing again.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* const sw = new Stopwatch(true);
|
|
224
|
+
* sw.Stop();
|
|
225
|
+
* sw.Reset();
|
|
226
|
+
* console.log(sw.Running); // false
|
|
227
|
+
* console.log(sw.Times); // []
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
Reset(): void;
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=stopwatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopwatch.d.ts","sourceRoot":"","sources":["../../../src/time/stopwatch/stopwatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,SAAS;IACrB,OAAO,CAAC,MAAM,CAAwB;IAEtC,OAAO,CAAC,SAAS,CAAuB;IAExC;;;;;;;;;;;;OAYG;gBACS,gBAAgB,GAAE,OAAe;IAM7C;;;;OAIG;IACH,IAAW,OAAO,IAAI,OAAO,CAE5B;IAED;;;;;OAKG;IACH,IAAW,KAAK,IAAI,cAAc,GAAG,SAAS,CAE7C;IAED;;;;;OAKG;IACH,IAAW,MAAM,IAAI,cAAc,GAAG,SAAS,CAE9C;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,IAAW,OAAO,IAAI,WAAW,CAYhC;IAED;;;;;OAKG;IACH,IAAW,KAAK,IAAI,cAAc,EAAE,CAEnC;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,cAAc,EAAE,CAErC;IAED;;;OAGG;IACH,IAAW,QAAQ,IAAI,MAAM,GAAG,IAAI,CAEnC;IAED;;;;;;;;;;;;;;;OAeG;IACI,KAAK,IAAI,cAAc,GAAG,SAAS;IAU1C;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,IAAI,IAAI,cAAc,GAAG,SAAS;IAkBzC;;;;;;;;;;;;;;;;;;;OAmBG;IACI,KAAK,IAAI,cAAc,GAAG,IAAI;IAQrC;;;;;;;;;;;;;;;;;OAiBG;IACI,MAAM,IAAI,cAAc,GAAG,IAAI;IAWtC;;;;;;;;;;;;;;;;OAgBG;IACI,KAAK,IAAI,cAAc;IAW9B;;;;;;;;;;;;;;;;;;OAkBG;IACI,GAAG,IAAI,WAAW;IAUzB;;;;;;;;;;;;;;;OAeG;IACI,KAAK,IAAI,IAAI;CAIpB"}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { ElapsedTime } from '../elapsed-time/elapsed-time.js';
|
|
2
|
+
import { StopwatchEntry } from './entry.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a stopwatch for measuring time intervals.
|
|
5
|
+
*
|
|
6
|
+
* A `Stopwatch` records a chronological list of {@link StopwatchEntry} timestamps
|
|
7
|
+
* and can be started, stopped, paused, resumed, lapped, and reset. The elapsed
|
|
8
|
+
* time is computed from the recorded entries rather than an active timer, so it
|
|
9
|
+
* is always accurate even after the stopwatch has been stopped.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Basic start/stop usage
|
|
14
|
+
* const sw = new Stopwatch();
|
|
15
|
+
* sw.Start();
|
|
16
|
+
* // ... do work ...
|
|
17
|
+
* sw.Stop();
|
|
18
|
+
* console.log(sw.Elapsed.Format('CONCISE')); // e.g. "1s 250ms"
|
|
19
|
+
*
|
|
20
|
+
* // Start immediately via constructor
|
|
21
|
+
* const sw2 = new Stopwatch(true);
|
|
22
|
+
* // ... do work ...
|
|
23
|
+
* console.log(sw2.Elapsed.Format('MEDIUM')); // e.g. "2 sec 300 ms"
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export class Stopwatch {
|
|
27
|
+
_times = [];
|
|
28
|
+
_pausedAt = null;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new `Stopwatch` instance.
|
|
31
|
+
*
|
|
32
|
+
* @param startImmediately - When `true`, calls {@link Start} automatically
|
|
33
|
+
* so the stopwatch begins tracking time as soon as it is constructed.
|
|
34
|
+
* Defaults to `false`.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const sw = new Stopwatch(); // not yet running
|
|
39
|
+
* const sw2 = new Stopwatch(true); // running immediately
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
constructor(startImmediately = false) {
|
|
43
|
+
if (startImmediately) {
|
|
44
|
+
this.Start();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Whether the stopwatch is currently running (started and not paused/stopped).
|
|
49
|
+
*
|
|
50
|
+
* @returns `true` if the stopwatch has been started and is not currently paused or stopped.
|
|
51
|
+
*/
|
|
52
|
+
get Running() {
|
|
53
|
+
return this.First !== undefined && this._pausedAt === null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The first entry recorded by this stopwatch (i.e. the start entry).
|
|
57
|
+
*
|
|
58
|
+
* @returns The first {@link StopwatchEntry}, or `undefined` if the stopwatch
|
|
59
|
+
* has never been started.
|
|
60
|
+
*/
|
|
61
|
+
get First() {
|
|
62
|
+
return this._times.length === 0 ? undefined : this._times[0];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The most recently recorded entry.
|
|
66
|
+
*
|
|
67
|
+
* @returns The latest {@link StopwatchEntry}, or `undefined` if no entries
|
|
68
|
+
* have been recorded yet.
|
|
69
|
+
*/
|
|
70
|
+
get Latest() {
|
|
71
|
+
return this._times.length === 0 ? undefined : this._times[this._times.length - 1];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The total time elapsed since the stopwatch was first started.
|
|
75
|
+
*
|
|
76
|
+
* - While the stopwatch is **running**, this reflects the time between the
|
|
77
|
+
* first entry and `Date.now()`.
|
|
78
|
+
* - While the stopwatch is **paused or stopped**, this reflects the time
|
|
79
|
+
* between the first entry and the moment it was paused/stopped.
|
|
80
|
+
* - Returns an {@link ElapsedTime} of `0` if the stopwatch has never been started.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const sw = new Stopwatch(true);
|
|
85
|
+
* // ... 500ms later ...
|
|
86
|
+
* sw.Stop();
|
|
87
|
+
* console.log(sw.Elapsed.Format()); // "500ms"
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
get Elapsed() {
|
|
91
|
+
const current = Date.now();
|
|
92
|
+
if (!this.Latest)
|
|
93
|
+
return new ElapsedTime(0);
|
|
94
|
+
const first = this.First;
|
|
95
|
+
if (!first)
|
|
96
|
+
return new ElapsedTime(0);
|
|
97
|
+
if (this._pausedAt !== null) {
|
|
98
|
+
return new ElapsedTime(this._pausedAt - first.timestamp);
|
|
99
|
+
}
|
|
100
|
+
return new ElapsedTime(current - first.timestamp);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A shallow copy of all recorded {@link StopwatchEntry} objects in
|
|
104
|
+
* chronological order.
|
|
105
|
+
*
|
|
106
|
+
* Modifying the returned array does not affect the internal state.
|
|
107
|
+
*/
|
|
108
|
+
get Times() {
|
|
109
|
+
return [...this._times];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Alias for {@link Times}. Returns a shallow copy of all recorded entries.
|
|
113
|
+
*/
|
|
114
|
+
get Entries() {
|
|
115
|
+
return this.Times;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The timestamp (milliseconds since epoch) at which the stopwatch was last
|
|
119
|
+
* paused or stopped, or `null` if it is currently running.
|
|
120
|
+
*/
|
|
121
|
+
get PausedAt() {
|
|
122
|
+
return this._pausedAt;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Starts the stopwatch by recording an initial timestamp entry.
|
|
126
|
+
*
|
|
127
|
+
* If the stopwatch has already been started, this is a no-op and the
|
|
128
|
+
* existing latest entry is returned without creating a new one.
|
|
129
|
+
*
|
|
130
|
+
* @returns The start {@link StopwatchEntry} that was recorded, or `undefined`
|
|
131
|
+
* if the stopwatch was already running (should not happen in practice).
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const sw = new Stopwatch();
|
|
136
|
+
* const entry = sw.Start();
|
|
137
|
+
* console.log(sw.Running); // true
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
Start() {
|
|
141
|
+
if (this.Latest)
|
|
142
|
+
return this.Latest;
|
|
143
|
+
this._pausedAt = null;
|
|
144
|
+
const entry = new StopwatchEntry(Date.now(), this, this._times.length);
|
|
145
|
+
this._times.push(entry);
|
|
146
|
+
return entry;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Stops the stopwatch by recording a final timestamp entry.
|
|
150
|
+
*
|
|
151
|
+
* - If the stopwatch is currently running, the current time is recorded as
|
|
152
|
+
* the stop entry and `_pausedAt` is set to freeze the elapsed time.
|
|
153
|
+
* - If the stopwatch has already been stopped, the latest entry is returned
|
|
154
|
+
* unchanged (idempotent).
|
|
155
|
+
* - If the stopwatch was never started, returns `undefined`.
|
|
156
|
+
*
|
|
157
|
+
* @returns The stop {@link StopwatchEntry}, or `undefined` if the stopwatch
|
|
158
|
+
* had not been started.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const sw = new Stopwatch(true);
|
|
163
|
+
* // ... some work ...
|
|
164
|
+
* const stopEntry = sw.Stop();
|
|
165
|
+
* console.log(sw.Running); // false
|
|
166
|
+
* console.log(sw.Elapsed.Format()); // e.g. "500ms"
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
Stop() {
|
|
170
|
+
const latest = this.Latest;
|
|
171
|
+
if (!latest)
|
|
172
|
+
return undefined;
|
|
173
|
+
if (this._pausedAt === null) {
|
|
174
|
+
// Not stopped yet, so stop it
|
|
175
|
+
const current = Date.now();
|
|
176
|
+
this._pausedAt = current;
|
|
177
|
+
const entry = new StopwatchEntry(current, this, this._times.length);
|
|
178
|
+
this._times.push(entry);
|
|
179
|
+
return entry;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// Already stopped, just return latest
|
|
183
|
+
return latest;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Pauses the stopwatch, freezing the elapsed time at the current moment.
|
|
188
|
+
*
|
|
189
|
+
* If the stopwatch has not been started, returns `null`. Unlike {@link Stop},
|
|
190
|
+
* `Pause` does not record a new timestamp entry — it only sets the internal
|
|
191
|
+
* pause marker so that subsequent reads of {@link Elapsed} return a frozen value.
|
|
192
|
+
*
|
|
193
|
+
* @returns The latest {@link StopwatchEntry} at the time of pausing, or `null`
|
|
194
|
+
* if the stopwatch had not been started.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* const sw = new Stopwatch(true);
|
|
199
|
+
* // ... 200ms ...
|
|
200
|
+
* sw.Pause();
|
|
201
|
+
* // ... 500ms later ...
|
|
202
|
+
* console.log(sw.Elapsed.Format()); // still "200ms"
|
|
203
|
+
* sw.Resume();
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
Pause() {
|
|
207
|
+
const latest = this.Latest;
|
|
208
|
+
if (!latest)
|
|
209
|
+
return null;
|
|
210
|
+
this._pausedAt = Date.now();
|
|
211
|
+
return latest;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Resumes a paused stopwatch by recording a new timestamp entry.
|
|
215
|
+
*
|
|
216
|
+
* If the stopwatch is not currently paused, returns `null` and has no effect.
|
|
217
|
+
* After resuming, elapsed-time calculations continue to accumulate from where
|
|
218
|
+
* they left off.
|
|
219
|
+
*
|
|
220
|
+
* @returns A new {@link StopwatchEntry} recording the resume time, or `null`
|
|
221
|
+
* if the stopwatch was not paused.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```typescript
|
|
225
|
+
* const sw = new Stopwatch(true);
|
|
226
|
+
* sw.Pause();
|
|
227
|
+
* const resumeEntry = sw.Resume();
|
|
228
|
+
* console.log(sw.Running); // true
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
Resume() {
|
|
232
|
+
if (this._pausedAt === null)
|
|
233
|
+
return null;
|
|
234
|
+
const current = Date.now();
|
|
235
|
+
this._pausedAt = null;
|
|
236
|
+
const entry = new StopwatchEntry(current, this, this._times.length);
|
|
237
|
+
this._times.push(entry);
|
|
238
|
+
return entry;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Records a click entry at the current moment without changing the
|
|
242
|
+
* running/paused state.
|
|
243
|
+
*
|
|
244
|
+
* If the stopwatch has no entries yet, the first click implicitly starts it.
|
|
245
|
+
* Use this for arbitrary timestamp recording or as the building block for
|
|
246
|
+
* {@link Lap}.
|
|
247
|
+
*
|
|
248
|
+
* @returns The newly recorded {@link StopwatchEntry}.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* const sw = new Stopwatch(true);
|
|
253
|
+
* const mark = sw.Click();
|
|
254
|
+
* console.log(mark.Elapsed.Format()); // time since last click / start
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
Click() {
|
|
258
|
+
const current = Date.now();
|
|
259
|
+
if (this._times.length === 0) {
|
|
260
|
+
// First click starts the stopwatch
|
|
261
|
+
this._pausedAt = null;
|
|
262
|
+
}
|
|
263
|
+
const entry = new StopwatchEntry(current, this, this._times.length);
|
|
264
|
+
this._times.push(entry);
|
|
265
|
+
return entry;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Records a lap by clicking the stopwatch and returning the elapsed time
|
|
269
|
+
* since the previous entry.
|
|
270
|
+
*
|
|
271
|
+
* Internally calls {@link Click} to record a new entry, then computes the
|
|
272
|
+
* difference between the new entry's timestamp and the previous one.
|
|
273
|
+
* Returns `ElapsedTime(0)` if this is the very first entry recorded.
|
|
274
|
+
*
|
|
275
|
+
* @returns An {@link ElapsedTime} representing the lap duration.
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* const sw = new Stopwatch(true);
|
|
280
|
+
* // ... 300ms ...
|
|
281
|
+
* const lap1 = sw.Lap(); // ~300ms
|
|
282
|
+
* // ... 150ms ...
|
|
283
|
+
* const lap2 = sw.Lap(); // ~150ms
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
Lap() {
|
|
287
|
+
const previousLatest = this.Latest;
|
|
288
|
+
const newEntry = this.Click();
|
|
289
|
+
if (!previousLatest) {
|
|
290
|
+
return new ElapsedTime(0);
|
|
291
|
+
}
|
|
292
|
+
return new ElapsedTime(newEntry.timestamp - previousLatest.timestamp);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Resets the stopwatch to its initial state by clearing all recorded entries
|
|
296
|
+
* and removing any pause/stop marker.
|
|
297
|
+
*
|
|
298
|
+
* After calling `Reset()`, the stopwatch is in the same state as a freshly
|
|
299
|
+
* constructed instance. Call {@link Start} to begin timing again.
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```typescript
|
|
303
|
+
* const sw = new Stopwatch(true);
|
|
304
|
+
* sw.Stop();
|
|
305
|
+
* sw.Reset();
|
|
306
|
+
* console.log(sw.Running); // false
|
|
307
|
+
* console.log(sw.Times); // []
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
Reset() {
|
|
311
|
+
this._times = [];
|
|
312
|
+
this._pausedAt = null;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=stopwatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopwatch.js","sourceRoot":"","sources":["../../../src/time/stopwatch/stopwatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,SAAS;IACb,MAAM,GAAqB,EAAE,CAAC;IAE9B,SAAS,GAAkB,IAAI,CAAC;IAExC;;;;;;;;;;;;OAYG;IACH,YAAY,mBAA4B,KAAK;QAC5C,IAAI,gBAAgB,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;IACF,CAAC;IAED;;;;OAIG;IACH,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACH,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IA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