@parasrp/delay 1.0.1 → 1.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.
Files changed (2) hide show
  1. package/README.md +66 -7
  2. package/package.json +15 -15
package/README.md CHANGED
@@ -1,19 +1,78 @@
1
1
  # @parasrp/delay
2
2
 
3
- A small and simple JavaScript utility to pause execution for a specified number of milliseconds.
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ ![npm version](https://img.shields.io/npm/v/@parasrp/delay)
5
+ ![Size](https://img.shields.io/bundlephobia/min/@parasrp/delay)
6
+
7
+ A lightweight, promise-based JavaScript utility to pause execution for a specified duration. Perfect for adding timeouts, staggering API calls, or building simple animations.
8
+
9
+ ---
4
10
 
5
11
  ## ✨ Features
6
12
 
7
- - Lightweight and fast
8
- - Promise-based
9
- - No dependencies
10
- - Works in any modern JavaScript environment
13
+ - đŸĒļ **Lightweight & Fast**: Zero overhead, minimal footprint.
14
+ - 🤝 **Promise-based**: Works seamlessly with `async/await`.
15
+ - đŸ“Ļ **Zero Dependencies**: Keeps your node_modules clean.
16
+ - 🌍 **Universal**: Works in Node.js, browsers, and modern JS environments.
11
17
 
12
18
  ---
13
19
 
14
20
  ## đŸ“Ļ Installation
15
21
 
16
- Install using npm:
17
-
22
+ Install the package via npm:
18
23
  ```bash
19
24
  npm install @parasrp/delay
25
+ ```
26
+
27
+ Install the package via yarn:
28
+ ```bash
29
+ yarn add @parasrp/delay
30
+ ```
31
+ ---
32
+
33
+ ## ✨ Features
34
+ You can use @parasrp/delay with both CommonJS and ES Modules.
35
+
36
+ ES6 Modules:
37
+ ```js
38
+ import delay from "@parasrp/delay";
39
+ ```
40
+
41
+ CommonJS:
42
+ ```js
43
+ const delay = require("@parasrp/delay");
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Examples
49
+
50
+ Using async/await:
51
+ ```js
52
+ async function countdown() {
53
+ console.log("Starting countdown...");
54
+
55
+ for (let i = 5; i > 0; i--) {
56
+ console.log(i);
57
+ await delay(1000); // Waits for 1 second
58
+ }
59
+
60
+ console.log("Go!");
61
+ }
62
+
63
+ countdown();
64
+ ```
65
+
66
+ Using .then():
67
+ ```js
68
+ console.log("Start waiting...");
69
+
70
+ delay(1000).then(() => {
71
+ console.log("Finished waiting 1000 milliseconds");
72
+ });
73
+ ```
74
+
75
+ ## 👤 Author
76
+ **Paras R Poshiya**
77
+ * [GitHub](https://github.com/parasposhiya)
78
+ * [GitLab](https://gitlab.com/parasposhiya)
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
- {
2
- "name": "@parasrp/delay",
3
- "version": "1.0.1",
4
- "description": "sleep function",
5
- "author": "Paras R Poshiya",
6
- "keywords": [
7
- "sleep",
8
- "delay"
9
- ],
10
- "license": "MIT",
11
- "main": "index.js",
12
- "type": "module",
13
- "exports": {
14
- ".": "./index.js"
15
- }
1
+ {
2
+ "name": "@parasrp/delay",
3
+ "version": "1.1.0",
4
+ "description": "sleep function",
5
+ "author": "Paras R Poshiya",
6
+ "keywords": [
7
+ "sleep",
8
+ "delay"
9
+ ],
10
+ "license": "MIT",
11
+ "main": "index.js",
12
+ "type": "module",
13
+ "exports": {
14
+ ".": "./index.js"
15
+ }
16
16
  }