utilora 0.0.0-stage → 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 ADDED
File without changes
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # Ranjith JS Utils
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A lightweight JavaScript utility library.
4
+
5
+ ## Installation
6
+
7
+ npm install ranjith-js-utils
8
+
9
+ ## Usage
10
+
11
+ const {
12
+ capitalize,
13
+ reverseString,
14
+ uniqueArray,
15
+ randomNumber,
16
+ isValidEmail
17
+ } = require("ranjith-js-utils");
18
+
19
+ console.log(capitalize("hello"));
20
+ // Hello
21
+
22
+ console.log(reverseString("hello"));
23
+ // olleh
24
+
25
+ console.log(uniqueArray([1, 2, 2, 3]));
26
+ // [1, 2, 3]
27
+
28
+ console.log(randomNumber(1, 10));
29
+
30
+ console.log(isValidEmail("test@gmail.com"));
31
+ // true
32
+
33
+ ## License
34
+
35
+ MIT# ranjith-js-utils
package/package.json CHANGED
@@ -1,6 +1,34 @@
1
+
1
2
  {
2
3
  "name": "utilora",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
4
+ "version": "1.0.0",
5
+ "description": "A lightweight, reusable JavaScript utility library for modern web and Node.js applications.",
6
+ "main": "src/index.js",
7
+ "keywords": [
8
+ "utilora",
9
+ "javascript",
10
+ "javascript-utilities",
11
+ "utility-library",
12
+ "js-utils",
13
+ "helper-functions",
14
+ "developer-tools",
15
+ "nodejs",
16
+ "frontend",
17
+ "backend",
18
+ "string-utilities",
19
+ "array-utilities",
20
+ "object-utilities",
21
+ "date-utilities",
22
+ "validation",
23
+ "formatting",
24
+ "reusable-functions"
25
+ ],
26
+ "author": "Ranjith Kumar",
27
+ "license": "MIT",
28
+ "files": [
29
+ "src"
30
+ ],
31
+ "scripts": {
32
+ "test": "node --test"
33
+ }
34
+ }
package/src/index.js ADDED
@@ -0,0 +1,37 @@
1
+ // Capitalize first letter
2
+ const capitalize = (text) => {
3
+ if (typeof text !== "string") {
4
+ throw new TypeError("Input must be a string");
5
+ }
6
+
7
+ return text.charAt(0).toUpperCase() + text.slice(1);
8
+ };
9
+
10
+ // Reverse string
11
+ const reverseString = (text) => {
12
+ return [...text].reverse().join("");
13
+ };
14
+
15
+ // Remove duplicate array values
16
+ const uniqueArray = (array) => {
17
+ return [...new Set(array)];
18
+ };
19
+
20
+ // Generate random number
21
+ const randomNumber = (min = 1, max = 100) => {
22
+ return Math.floor(Math.random() * (max - min + 1)) + min;
23
+ };
24
+
25
+ // Validate email
26
+ const isValidEmail = (email) => {
27
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
28
+ };
29
+
30
+ // Export functions
31
+ module.exports = {
32
+ capitalize,
33
+ reverseString,
34
+ uniqueArray,
35
+ randomNumber,
36
+ isValidEmail,
37
+ };