@sapphire/stopwatch 1.4.2-next.dd7beea.0 β†’ 1.4.2-next.df4fdef.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/README.md CHANGED
@@ -84,7 +84,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
84
84
  <table>
85
85
  <tr>
86
86
  <td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Code">πŸ’»</a> <a href="#infra-favna" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a> <a href="#projectManagement-favna" title="Project Management">πŸ“†</a> <a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Documentation">πŸ“–</a> <a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Tests">⚠️</a></td>
87
- <td align="center"><a href="https://github.com/kyranet"><img src="https://avatars0.githubusercontent.com/u/24852502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antonio RomΓ‘n</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Code">πŸ’»</a> <a href="#projectManagement-kyranet" title="Project Management">πŸ“†</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Akyranet" title="Reviewed Pull Requests">πŸ‘€</a> <a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Tests">⚠️</a></td>
87
+ <td align="center"><a href="https://github.com/kyranet"><img src="https://avatars0.githubusercontent.com/u/24852502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aura RomΓ‘n</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Code">πŸ’»</a> <a href="#projectManagement-kyranet" title="Project Management">πŸ“†</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Akyranet" title="Reviewed Pull Requests">πŸ‘€</a> <a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Tests">⚠️</a></td>
88
88
  <td align="center"><a href="https://github.com/PyroTechniac"><img src="https://avatars2.githubusercontent.com/u/39341355?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gryffon Bellish</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=PyroTechniac" title="Code">πŸ’»</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3APyroTechniac" title="Reviewed Pull Requests">πŸ‘€</a> <a href="https://github.com/sapphiredev/utilities/commits?author=PyroTechniac" title="Tests">⚠️</a></td>
89
89
  <td align="center"><a href="https://github.com/vladfrangu"><img src="https://avatars3.githubusercontent.com/u/17960496?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Frangu</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=vladfrangu" title="Code">πŸ’»</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3Avladfrangu" title="Bug reports">πŸ›</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Avladfrangu" title="Reviewed Pull Requests">πŸ‘€</a> <a href="#userTesting-vladfrangu" title="User Testing">πŸ““</a> <a href="https://github.com/sapphiredev/utilities/commits?author=vladfrangu" title="Tests">⚠️</a></td>
90
90
  <td align="center"><a href="https://github.com/Stitch07"><img src="https://avatars0.githubusercontent.com/u/29275227?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stitch07</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Stitch07" title="Code">πŸ’»</a> <a href="#projectManagement-Stitch07" title="Project Management">πŸ“†</a> <a href="https://github.com/sapphiredev/utilities/commits?author=Stitch07" title="Tests">⚠️</a></td>
@@ -94,7 +94,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
94
94
  <tr>
95
95
  <td align="center"><a href="https://github.com/Nytelife26"><img src="https://avatars1.githubusercontent.com/u/22531310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler J Russell</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Nytelife26" title="Documentation">πŸ“–</a></td>
96
96
  <td align="center"><a href="https://github.com/Alcremie"><img src="https://avatars0.githubusercontent.com/u/54785334?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Lieder</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Alcremie" title="Code">πŸ’»</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3AAlcremie" title="Bug reports">πŸ›</a></td>
97
- <td align="center"><a href="https://github.com/RealShadowNova"><img src="https://avatars3.githubusercontent.com/u/46537907?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hezekiah Hendry</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=RealShadowNova" title="Code">πŸ’»</a></td>
97
+ <td align="center"><a href="https://github.com/RealShadowNova"><img src="https://avatars3.githubusercontent.com/u/46537907?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hezekiah Hendry</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=RealShadowNova" title="Code">πŸ’»</a> <a href="#tool-RealShadowNova" title="Tools">πŸ”§</a></td>
98
98
  <td align="center"><a href="https://github.com/Vetlix"><img src="https://avatars.githubusercontent.com/u/31412314?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vetlix</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Vetlix" title="Code">πŸ’»</a></td>
99
99
  <td align="center"><a href="https://github.com/ethamitc"><img src="https://avatars.githubusercontent.com/u/27776796?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ethan Mitchell</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=ethamitc" title="Documentation">πŸ“–</a></td>
100
100
  <td align="center"><a href="https://github.com/noftaly"><img src="https://avatars.githubusercontent.com/u/34779161?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Elliot</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=noftaly" title="Code">πŸ’»</a></td>
@@ -129,6 +129,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
129
129
  </tr>
130
130
  <tr>
131
131
  <td align="center"><a href="https://github.com/MajesticString"><img src="https://avatars.githubusercontent.com/u/66224939?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Harry Allen</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=MajesticString" title="Documentation">πŸ“–</a></td>
132
+ <td align="center"><a href="https://github.com/EvolutionX-10"><img src="https://avatars.githubusercontent.com/u/85353424?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Evo</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=EvolutionX-10" title="Code">πŸ’»</a></td>
133
+ <td align="center"><a href="https://enes.ovh/"><img src="https://avatars.githubusercontent.com/u/61084101?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Enes GenΓ§</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=enxg" title="Code">πŸ’»</a></td>
134
+ <td align="center"><a href="https://github.com/muchnameless"><img src="https://avatars.githubusercontent.com/u/12682826?v=4?s=100" width="100px;" alt=""/><br /><sub><b>muchnameless</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=muchnameless" title="Code">πŸ’»</a></td>
132
135
  </tr>
133
136
  </table>
134
137
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Stopwatch class, uses native node to replicate/extend performance-now dependency.
3
3
  */
4
- export declare class Stopwatch {
4
+ declare class Stopwatch {
5
5
  #private;
6
6
  /**
7
7
  * The number of digits to appear after the decimal point when returning the friendly duration.
@@ -40,4 +40,5 @@ export declare class Stopwatch {
40
40
  */
41
41
  toString(): string;
42
42
  }
43
- //# sourceMappingURL=index.d.ts.map
43
+
44
+ export { Stopwatch };
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use strict";
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { performance } from 'node:perf_hooks';\n\n/**\n * Stopwatch class, uses native node to replicate/extend performance-now dependency.\n */\nexport class Stopwatch {\n\t/**\n\t * The number of digits to appear after the decimal point when returning the friendly duration.\n\t */\n\tpublic digits: number;\n\n\t/**\n\t * The start time of this stopwatch\n\t */\n\t#start: number;\n\n\t/**\n\t * The end time of this stopwatch\n\t */\n\t#end: number | null;\n\n\t/**\n\t * Starts a new stopwatch\n\t */\n\tpublic constructor(digits = 2) {\n\t\tthis.digits = digits;\n\t\tthis.#start = performance.now();\n\t\tthis.#end = null;\n\t}\n\n\t/**\n\t * The duration of this stopwatch since start or start to end if this stopwatch has stopped.\n\t */\n\tpublic get duration(): number {\n\t\treturn this.#end ? this.#end - this.#start : performance.now() - this.#start;\n\t}\n\n\t/**\n\t * If the stopwatch is running or not.\n\t */\n\tpublic get running(): boolean {\n\t\treturn Boolean(!this.#end);\n\t}\n\n\t/**\n\t * Restarts the stopwatch (Returns a running state)\n\t */\n\tpublic restart(): this {\n\t\tthis.#start = performance.now();\n\t\tthis.#end = null;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Resets the Stopwatch to 0 duration (Returns a stopped state)\n\t */\n\tpublic reset(): this {\n\t\tthis.#start = performance.now();\n\t\tthis.#end = this.#start;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Starts the Stopwatch\n\t */\n\tpublic start(): this {\n\t\tif (!this.running) {\n\t\t\tthis.#start = performance.now() - this.duration;\n\t\t\tthis.#end = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Stops the Stopwatch, freezing the duration\n\t */\n\tpublic stop(): this {\n\t\tif (this.running) this.#end = performance.now();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Defines toString behavior\n\t */\n\tpublic toString(): string {\n\t\tconst time = this.duration;\n\t\tif (time >= 1000) return `${(time / 1000).toFixed(this.digits)}s`;\n\t\tif (time >= 1) return `${time.toFixed(this.digits)}ms`;\n\t\treturn `${(time * 1000).toFixed(this.digits)}ΞΌs`;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA4B;AAA5B;AAKO,IAAM,YAAN,MAAgB;AAAA,EAmBtB,AAAO,YAAY,SAAS,GAAG;AAf/B,wBAAO;AAKP;AAKA;AAMC,SAAK,SAAS;AACd,uBAAK,QAAS,mCAAY,IAAI;AAC9B,uBAAK,MAAO;AAAA,EACb;AAAA,EAKA,IAAW,WAAmB;AAC7B,WAAO,mBAAK,QAAO,mBAAK,QAAO,mBAAK,UAAS,mCAAY,IAAI,IAAI,mBAAK;AAAA,EACvE;AAAA,EAKA,IAAW,UAAmB;AAC7B,WAAO,QAAQ,CAAC,mBAAK,KAAI;AAAA,EAC1B;AAAA,EAKA,AAAO,UAAgB;AACtB,uBAAK,QAAS,mCAAY,IAAI;AAC9B,uBAAK,MAAO;AACZ,WAAO;AAAA,EACR;AAAA,EAKA,AAAO,QAAc;AACpB,uBAAK,QAAS,mCAAY,IAAI;AAC9B,uBAAK,MAAO,mBAAK;AACjB,WAAO;AAAA,EACR;AAAA,EAKA,AAAO,QAAc;AACpB,QAAI,CAAC,KAAK,SAAS;AAClB,yBAAK,QAAS,mCAAY,IAAI,IAAI,KAAK;AACvC,yBAAK,MAAO;AAAA,IACb;AAEA,WAAO;AAAA,EACR;AAAA,EAKA,AAAO,OAAa;AACnB,QAAI,KAAK;AAAS,yBAAK,MAAO,mCAAY,IAAI;AAC9C,WAAO;AAAA,EACR;AAAA,EAKA,AAAO,WAAmB;AACzB,UAAM,OAAO,KAAK;AAClB,QAAI,QAAQ;AAAM,aAAO,GAAI,QAAO,KAAM,QAAQ,KAAK,MAAM;AAC7D,QAAI,QAAQ;AAAG,aAAO,GAAG,KAAK,QAAQ,KAAK,MAAM;AACjD,WAAO,GAAI,QAAO,KAAM,QAAQ,KAAK,MAAM;AAAA,EAC5C;AACD;AAtFa;AASZ;AAKA;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { performance } from 'node:perf_hooks';\n\n/**\n * Stopwatch class, uses native node to replicate/extend performance-now dependency.\n */\nexport class Stopwatch {\n\t/**\n\t * The number of digits to appear after the decimal point when returning the friendly duration.\n\t */\n\tpublic digits: number;\n\n\t/**\n\t * The start time of this stopwatch\n\t */\n\t#start: number;\n\n\t/**\n\t * The end time of this stopwatch\n\t */\n\t#end: number | null;\n\n\t/**\n\t * Starts a new stopwatch\n\t */\n\tpublic constructor(digits = 2) {\n\t\tthis.digits = digits;\n\t\tthis.#start = performance.now();\n\t\tthis.#end = null;\n\t}\n\n\t/**\n\t * The duration of this stopwatch since start or start to end if this stopwatch has stopped.\n\t */\n\tpublic get duration(): number {\n\t\treturn this.#end ? this.#end - this.#start : performance.now() - this.#start;\n\t}\n\n\t/**\n\t * If the stopwatch is running or not.\n\t */\n\tpublic get running(): boolean {\n\t\treturn Boolean(!this.#end);\n\t}\n\n\t/**\n\t * Restarts the stopwatch (Returns a running state)\n\t */\n\tpublic restart(): this {\n\t\tthis.#start = performance.now();\n\t\tthis.#end = null;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Resets the Stopwatch to 0 duration (Returns a stopped state)\n\t */\n\tpublic reset(): this {\n\t\tthis.#start = performance.now();\n\t\tthis.#end = this.#start;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Starts the Stopwatch\n\t */\n\tpublic start(): this {\n\t\tif (!this.running) {\n\t\t\tthis.#start = performance.now() - this.duration;\n\t\t\tthis.#end = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Stops the Stopwatch, freezing the duration\n\t */\n\tpublic stop(): this {\n\t\tif (this.running) this.#end = performance.now();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Defines toString behavior\n\t */\n\tpublic toString(): string {\n\t\tconst time = this.duration;\n\t\tif (time >= 1000) return `${(time / 1000).toFixed(this.digits)}s`;\n\t\tif (time >= 1) return `${time.toFixed(this.digits)}ms`;\n\t\treturn `${(time * 1000).toFixed(this.digits)}ΞΌs`;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA4B;AAA5B;AAKO,IAAM,YAAN,MAAgB;AAAA,EAmBf,YAAY,SAAS,GAAG;AAf/B,wBAAO;AAKP;AAKA;AAMC,SAAK,SAAS;AACd,uBAAK,QAAS,mCAAY,IAAI;AAC9B,uBAAK,MAAO;AAAA,EACb;AAAA,EAKA,IAAW,WAAmB;AAC7B,WAAO,mBAAK,QAAO,mBAAK,QAAO,mBAAK,UAAS,mCAAY,IAAI,IAAI,mBAAK;AAAA,EACvE;AAAA,EAKA,IAAW,UAAmB;AAC7B,WAAO,QAAQ,CAAC,mBAAK,KAAI;AAAA,EAC1B;AAAA,EAKO,UAAgB;AACtB,uBAAK,QAAS,mCAAY,IAAI;AAC9B,uBAAK,MAAO;AACZ,WAAO;AAAA,EACR;AAAA,EAKO,QAAc;AACpB,uBAAK,QAAS,mCAAY,IAAI;AAC9B,uBAAK,MAAO,mBAAK;AACjB,WAAO;AAAA,EACR;AAAA,EAKO,QAAc;AACpB,QAAI,CAAC,KAAK,SAAS;AAClB,yBAAK,QAAS,mCAAY,IAAI,IAAI,KAAK;AACvC,yBAAK,MAAO;AAAA,IACb;AAEA,WAAO;AAAA,EACR;AAAA,EAKO,OAAa;AACnB,QAAI,KAAK;AAAS,yBAAK,MAAO,mCAAY,IAAI;AAC9C,WAAO;AAAA,EACR;AAAA,EAKO,WAAmB;AACzB,UAAM,OAAO,KAAK;AAClB,QAAI,QAAQ;AAAM,aAAO,IAAI,OAAO,KAAM,QAAQ,KAAK,MAAM;AAC7D,QAAI,QAAQ;AAAG,aAAO,GAAG,KAAK,QAAQ,KAAK,MAAM;AACjD,WAAO,IAAI,OAAO,KAAM,QAAQ,KAAK,MAAM;AAAA,EAC5C;AACD;AAtFa;AASZ;AAKA;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { performance } from 'node:perf_hooks';\n\n/**\n * Stopwatch class, uses native node to replicate/extend performance-now dependency.\n */\nexport class Stopwatch {\n\t/**\n\t * The number of digits to appear after the decimal point when returning the friendly duration.\n\t */\n\tpublic digits: number;\n\n\t/**\n\t * The start time of this stopwatch\n\t */\n\t#start: number;\n\n\t/**\n\t * The end time of this stopwatch\n\t */\n\t#end: number | null;\n\n\t/**\n\t * Starts a new stopwatch\n\t */\n\tpublic constructor(digits = 2) {\n\t\tthis.digits = digits;\n\t\tthis.#start = performance.now();\n\t\tthis.#end = null;\n\t}\n\n\t/**\n\t * The duration of this stopwatch since start or start to end if this stopwatch has stopped.\n\t */\n\tpublic get duration(): number {\n\t\treturn this.#end ? this.#end - this.#start : performance.now() - this.#start;\n\t}\n\n\t/**\n\t * If the stopwatch is running or not.\n\t */\n\tpublic get running(): boolean {\n\t\treturn Boolean(!this.#end);\n\t}\n\n\t/**\n\t * Restarts the stopwatch (Returns a running state)\n\t */\n\tpublic restart(): this {\n\t\tthis.#start = performance.now();\n\t\tthis.#end = null;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Resets the Stopwatch to 0 duration (Returns a stopped state)\n\t */\n\tpublic reset(): this {\n\t\tthis.#start = performance.now();\n\t\tthis.#end = this.#start;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Starts the Stopwatch\n\t */\n\tpublic start(): this {\n\t\tif (!this.running) {\n\t\t\tthis.#start = performance.now() - this.duration;\n\t\t\tthis.#end = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Stops the Stopwatch, freezing the duration\n\t */\n\tpublic stop(): this {\n\t\tif (this.running) this.#end = performance.now();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Defines toString behavior\n\t */\n\tpublic toString(): string {\n\t\tconst time = this.duration;\n\t\tif (time >= 1000) return `${(time / 1000).toFixed(this.digits)}s`;\n\t\tif (time >= 1) return `${time.toFixed(this.digits)}ms`;\n\t\treturn `${(time * 1000).toFixed(this.digits)}ΞΌs`;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAKO,IAAM,YAAN,MAAgB;AAAA,EAmBtB,AAAO,YAAY,SAAS,GAAG;AAf/B,wBAAO;AAKP;AAKA;AAMC,SAAK,SAAS;AACd,uBAAK,QAAS,YAAY,IAAI;AAC9B,uBAAK,MAAO;AAAA,EACb;AAAA,EAKA,IAAW,WAAmB;AAC7B,WAAO,mBAAK,QAAO,mBAAK,QAAO,mBAAK,UAAS,YAAY,IAAI,IAAI,mBAAK;AAAA,EACvE;AAAA,EAKA,IAAW,UAAmB;AAC7B,WAAO,QAAQ,CAAC,mBAAK,KAAI;AAAA,EAC1B;AAAA,EAKA,AAAO,UAAgB;AACtB,uBAAK,QAAS,YAAY,IAAI;AAC9B,uBAAK,MAAO;AACZ,WAAO;AAAA,EACR;AAAA,EAKA,AAAO,QAAc;AACpB,uBAAK,QAAS,YAAY,IAAI;AAC9B,uBAAK,MAAO,mBAAK;AACjB,WAAO;AAAA,EACR;AAAA,EAKA,AAAO,QAAc;AACpB,QAAI,CAAC,KAAK,SAAS;AAClB,yBAAK,QAAS,YAAY,IAAI,IAAI,KAAK;AACvC,yBAAK,MAAO;AAAA,IACb;AAEA,WAAO;AAAA,EACR;AAAA,EAKA,AAAO,OAAa;AACnB,QAAI,KAAK;AAAS,yBAAK,MAAO,YAAY,IAAI;AAC9C,WAAO;AAAA,EACR;AAAA,EAKA,AAAO,WAAmB;AACzB,UAAM,OAAO,KAAK;AAClB,QAAI,QAAQ;AAAM,aAAO,GAAI,QAAO,KAAM,QAAQ,KAAK,MAAM;AAC7D,QAAI,QAAQ;AAAG,aAAO,GAAG,KAAK,QAAQ,KAAK,MAAM;AACjD,WAAO,GAAI,QAAO,KAAM,QAAQ,KAAK,MAAM;AAAA,EAC5C;AACD;AAtFa;AASZ;AAKA;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { performance } from 'node:perf_hooks';\n\n/**\n * Stopwatch class, uses native node to replicate/extend performance-now dependency.\n */\nexport class Stopwatch {\n\t/**\n\t * The number of digits to appear after the decimal point when returning the friendly duration.\n\t */\n\tpublic digits: number;\n\n\t/**\n\t * The start time of this stopwatch\n\t */\n\t#start: number;\n\n\t/**\n\t * The end time of this stopwatch\n\t */\n\t#end: number | null;\n\n\t/**\n\t * Starts a new stopwatch\n\t */\n\tpublic constructor(digits = 2) {\n\t\tthis.digits = digits;\n\t\tthis.#start = performance.now();\n\t\tthis.#end = null;\n\t}\n\n\t/**\n\t * The duration of this stopwatch since start or start to end if this stopwatch has stopped.\n\t */\n\tpublic get duration(): number {\n\t\treturn this.#end ? this.#end - this.#start : performance.now() - this.#start;\n\t}\n\n\t/**\n\t * If the stopwatch is running or not.\n\t */\n\tpublic get running(): boolean {\n\t\treturn Boolean(!this.#end);\n\t}\n\n\t/**\n\t * Restarts the stopwatch (Returns a running state)\n\t */\n\tpublic restart(): this {\n\t\tthis.#start = performance.now();\n\t\tthis.#end = null;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Resets the Stopwatch to 0 duration (Returns a stopped state)\n\t */\n\tpublic reset(): this {\n\t\tthis.#start = performance.now();\n\t\tthis.#end = this.#start;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Starts the Stopwatch\n\t */\n\tpublic start(): this {\n\t\tif (!this.running) {\n\t\t\tthis.#start = performance.now() - this.duration;\n\t\t\tthis.#end = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Stops the Stopwatch, freezing the duration\n\t */\n\tpublic stop(): this {\n\t\tif (this.running) this.#end = performance.now();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Defines toString behavior\n\t */\n\tpublic toString(): string {\n\t\tconst time = this.duration;\n\t\tif (time >= 1000) return `${(time / 1000).toFixed(this.digits)}s`;\n\t\tif (time >= 1) return `${time.toFixed(this.digits)}ms`;\n\t\treturn `${(time * 1000).toFixed(this.digits)}ΞΌs`;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,mBAAmB;AAA5B;AAKO,IAAM,YAAN,MAAgB;AAAA,EAmBf,YAAY,SAAS,GAAG;AAf/B,wBAAO;AAKP;AAKA;AAMC,SAAK,SAAS;AACd,uBAAK,QAAS,YAAY,IAAI;AAC9B,uBAAK,MAAO;AAAA,EACb;AAAA,EAKA,IAAW,WAAmB;AAC7B,WAAO,mBAAK,QAAO,mBAAK,QAAO,mBAAK,UAAS,YAAY,IAAI,IAAI,mBAAK;AAAA,EACvE;AAAA,EAKA,IAAW,UAAmB;AAC7B,WAAO,QAAQ,CAAC,mBAAK,KAAI;AAAA,EAC1B;AAAA,EAKO,UAAgB;AACtB,uBAAK,QAAS,YAAY,IAAI;AAC9B,uBAAK,MAAO;AACZ,WAAO;AAAA,EACR;AAAA,EAKO,QAAc;AACpB,uBAAK,QAAS,YAAY,IAAI;AAC9B,uBAAK,MAAO,mBAAK;AACjB,WAAO;AAAA,EACR;AAAA,EAKO,QAAc;AACpB,QAAI,CAAC,KAAK,SAAS;AAClB,yBAAK,QAAS,YAAY,IAAI,IAAI,KAAK;AACvC,yBAAK,MAAO;AAAA,IACb;AAEA,WAAO;AAAA,EACR;AAAA,EAKO,OAAa;AACnB,QAAI,KAAK;AAAS,yBAAK,MAAO,YAAY,IAAI;AAC9C,WAAO;AAAA,EACR;AAAA,EAKO,WAAmB;AACzB,UAAM,OAAO,KAAK;AAClB,QAAI,QAAQ;AAAM,aAAO,IAAI,OAAO,KAAM,QAAQ,KAAK,MAAM;AAC7D,QAAI,QAAQ;AAAG,aAAO,GAAG,KAAK,QAAQ,KAAK,MAAM;AACjD,WAAO,IAAI,OAAO,KAAM,QAAQ,KAAK,MAAM;AAAA,EAC5C;AACD;AAtFa;AASZ;AAKA;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/stopwatch",
3
- "version": "1.4.2-next.dd7beea.0",
3
+ "version": "1.4.2-next.df4fdef.0",
4
4
  "description": "Accurately measure passing time.",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
@@ -15,9 +15,10 @@
15
15
  "sideEffects": false,
16
16
  "homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/stopwatch",
17
17
  "scripts": {
18
- "test": "jest",
18
+ "test": "vitest run",
19
19
  "lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
20
- "build": "tsup && tsc -b src",
20
+ "build": "tsup",
21
+ "docs": "typedoc-json-parser",
21
22
  "prepack": "yarn build",
22
23
  "bump": "cliff-jumper",
23
24
  "check-update": "cliff-jumper --dry-run"
@@ -56,7 +57,12 @@
56
57
  "access": "public"
57
58
  },
58
59
  "devDependencies": {
59
- "tsup": "^6.1.2",
60
- "typescript": "^4.7.4"
60
+ "@favware/cliff-jumper": "^1.8.7",
61
+ "@vitest/coverage-c8": "^0.22.1",
62
+ "tsup": "^6.2.3",
63
+ "typedoc": "^0.23.14",
64
+ "typedoc-json-parser": "^3.1.0",
65
+ "typescript": "^4.8.2",
66
+ "vitest": "^0.22.1"
61
67
  }
62
68
  }