es-toolkit 1.20.0-dev.635 → 1.20.0-dev.637

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.
@@ -11,10 +11,16 @@
11
11
  * @returns {Promise<T>} A promise that resolves with the result of the `run` function or rejects if the timeout is reached.
12
12
  *
13
13
  * @example
14
+ * async function fetchData() {
15
+ * const response = await fetch('https://example.com/data');
16
+ * return response.json();
17
+ * }
18
+ *
14
19
  * try {
15
- * await withTimeout(() => {}, 1000); // Timeout exception after 1 second
20
+ * const data = await withTimeout(fetchData, 1000);
21
+ * console.log(data); // Logs the fetched data if `fetchData` is resolved within 1 second.
16
22
  * } catch (error) {
17
- * console.error(error); // Will log 'TimeoutError'
23
+ * console.error(error); // Will log 'TimeoutError' if `fetchData` is not resolved within 1 second.
18
24
  * }
19
25
  */
20
26
  declare function withTimeout<T>(run: () => Promise<T>, ms: number): Promise<T>;
@@ -11,10 +11,16 @@
11
11
  * @returns {Promise<T>} A promise that resolves with the result of the `run` function or rejects if the timeout is reached.
12
12
  *
13
13
  * @example
14
+ * async function fetchData() {
15
+ * const response = await fetch('https://example.com/data');
16
+ * return response.json();
17
+ * }
18
+ *
14
19
  * try {
15
- * await withTimeout(() => {}, 1000); // Timeout exception after 1 second
20
+ * const data = await withTimeout(fetchData, 1000);
21
+ * console.log(data); // Logs the fetched data if `fetchData` is resolved within 1 second.
16
22
  * } catch (error) {
17
- * console.error(error); // Will log 'TimeoutError'
23
+ * console.error(error); // Will log 'TimeoutError' if `fetchData` is not resolved within 1 second.
18
24
  * }
19
25
  */
20
26
  declare function withTimeout<T>(run: () => Promise<T>, ms: number): Promise<T>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.20.0-dev.635+1537ea9f",
4
+ "version": "1.20.0-dev.637+625b915d",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {