utilora 0.0.0-stage → 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.
- package/LICENSE +0 -0
- package/README.md +70 -2
- package/package.json +31 -4
- package/src/index.js +37 -0
package/LICENSE
ADDED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,3 +1,71 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Utilora
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Powerful Utilities. Simpler Development.**
|
|
4
|
+
|
|
5
|
+
A lightweight, reusable JavaScript utility library designed to simplify everyday development tasks across frontend and backend projects.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install utilora
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
const {
|
|
17
|
+
capitalize,
|
|
18
|
+
reverseString,
|
|
19
|
+
uniqueArray,
|
|
20
|
+
randomNumber,
|
|
21
|
+
isValidEmail
|
|
22
|
+
} = require("utilora");
|
|
23
|
+
|
|
24
|
+
console.log(capitalize("hello"));
|
|
25
|
+
// Hello
|
|
26
|
+
|
|
27
|
+
console.log(reverseString("hello"));
|
|
28
|
+
// olleh
|
|
29
|
+
|
|
30
|
+
console.log(uniqueArray([1, 2, 2, 3]));
|
|
31
|
+
// [1, 2, 3]
|
|
32
|
+
|
|
33
|
+
console.log(randomNumber(1, 10));
|
|
34
|
+
|
|
35
|
+
console.log(isValidEmail("test@gmail.com"));
|
|
36
|
+
// true
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- String manipulation utilities
|
|
42
|
+
- Array manipulation utilities
|
|
43
|
+
- Random number generation
|
|
44
|
+
- Email validation
|
|
45
|
+
- Reusable helper functions
|
|
46
|
+
- Lightweight and easy to use
|
|
47
|
+
|
|
48
|
+
## Compatibility
|
|
49
|
+
|
|
50
|
+
Designed for JavaScript projects, including Node.js applications and frontend development.
|
|
51
|
+
|
|
52
|
+
## Contributing
|
|
53
|
+
|
|
54
|
+
Contributions, feature requests, and bug reports are welcome!
|
|
55
|
+
|
|
56
|
+
Feel free to open an issue or submit a pull request.
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT License
|
|
61
|
+
|
|
62
|
+
## Author
|
|
63
|
+
|
|
64
|
+
**Ranjith Kumar**
|
|
65
|
+
|
|
66
|
+
- GitHub: https://github.com/ranjithkumardeveloper
|
|
67
|
+
- Portfolio: https://ranjithkumardev.com
|
|
68
|
+
|
|
69
|
+
## NPM Package
|
|
70
|
+
|
|
71
|
+
https://www.npmjs.com/package/utilora
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "utilora",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "A lightweight, reusable JavaScript utility library for modern web and Node.js applications.",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"utilora",
|
|
8
|
+
"javascript",
|
|
9
|
+
"javascript-utilities",
|
|
10
|
+
"utility-library",
|
|
11
|
+
"js-utils",
|
|
12
|
+
"helper-functions",
|
|
13
|
+
"developer-tools",
|
|
14
|
+
"nodejs",
|
|
15
|
+
"frontend",
|
|
16
|
+
"backend",
|
|
17
|
+
"string-utilities",
|
|
18
|
+
"array-utilities",
|
|
19
|
+
"object-utilities",
|
|
20
|
+
"date-utilities",
|
|
21
|
+
"validation",
|
|
22
|
+
"formatting",
|
|
23
|
+
"reusable-functions"
|
|
24
|
+
],
|
|
25
|
+
"author": "Ranjith Kumar",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"files": [
|
|
28
|
+
"src"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "node --test"
|
|
32
|
+
}
|
|
33
|
+
}
|
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
|
+
};
|