ibrahim-makashi 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/README.md +26 -0
- package/index.cjs +26 -0
- package/index.mjs +24 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Ibrahim Makashi Utility Library
|
|
2
|
+
|
|
3
|
+
A lightweight JavaScript utility library for daily development tasks.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install ibrahim-makashi
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
1. Greeting Function
|
|
12
|
+
greet
|
|
13
|
+
|
|
14
|
+
2. Mock JSON Generator
|
|
15
|
+
generateUsers
|
|
16
|
+
|
|
17
|
+
3. Slug Creator
|
|
18
|
+
slugify
|
|
19
|
+
|
|
20
|
+
Features
|
|
21
|
+
Greeting: Personalize user welcomes.
|
|
22
|
+
|
|
23
|
+
Mock Data: Generate random user arrays for testing.
|
|
24
|
+
|
|
25
|
+
Slugify: Convert titles into URL-friendly strings.
|
|
26
|
+
|
package/index.cjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// 1. Greeting Function
|
|
2
|
+
const greet = (name) =>
|
|
3
|
+
`Hello, ${name}! Welcome to the Ibrahim's utility library.`;
|
|
4
|
+
|
|
5
|
+
// 2. Mock JSON Generator
|
|
6
|
+
const generateUsers = (length = 5) => {
|
|
7
|
+
const names = ["Alice", "Bob", "Charlie", "David", "Eve"];
|
|
8
|
+
return Array.from({ length }, (_, i) => ({
|
|
9
|
+
id: i + 1,
|
|
10
|
+
name: names[Math.floor(Math.random() * names.length)],
|
|
11
|
+
date: new Date().toISOString(),
|
|
12
|
+
status: "active",
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// 3. Slug Creator
|
|
17
|
+
const slugify = (str) => {
|
|
18
|
+
return str
|
|
19
|
+
.toLowerCase()
|
|
20
|
+
.trim()
|
|
21
|
+
.replace(/[^\w\s-]/g, "") // Remove special characters
|
|
22
|
+
.replace(/[\s_-]+/g, "-") // Replace spaces/underscores with hyphens
|
|
23
|
+
.replace(/^-+|-+$/g, ""); // Trim hyphens from ends
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
module.exports = { greet, generateUsers, slugify };
|
package/index.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// 1. Greeting Function
|
|
2
|
+
export const greet = (name) =>
|
|
3
|
+
`Hello, ${name}! Welcome to the Ibrahim's utility library.`;
|
|
4
|
+
|
|
5
|
+
// 2. Mock JSON Generator
|
|
6
|
+
export const generateUsers = (length = 5) => {
|
|
7
|
+
const names = ["Alice", "Bob", "Charlie", "David", "Eve"];
|
|
8
|
+
return Array.from({ length }, (_, i) => ({
|
|
9
|
+
id: i + 1,
|
|
10
|
+
name: names[Math.floor(Math.random() * names.length)],
|
|
11
|
+
date: new Date().toISOString(),
|
|
12
|
+
status: "active",
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// 3. Slug Creator
|
|
17
|
+
export const slugify = (str) => {
|
|
18
|
+
return str
|
|
19
|
+
.toLowerCase()
|
|
20
|
+
.trim()
|
|
21
|
+
.replace(/[^\w\s-]/g, "") // Remove special characters
|
|
22
|
+
.replace(/[\s_-]+/g, "-") // Replace spaces/underscores with hyphens
|
|
23
|
+
.replace(/^-+|-+$/g, ""); // Trim hyphens from ends
|
|
24
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ibrahim-makashi",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A utility package for greetings, mock data, and slugification.",
|
|
5
|
+
"main": "./index.cjs",
|
|
6
|
+
"module": "./index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
"require": "./index.cjs",
|
|
9
|
+
"import": "./index.mjs"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "echo \"Error: no test spec\" && exit 1"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"greeting",
|
|
16
|
+
"mockdata",
|
|
17
|
+
"slugify",
|
|
18
|
+
"ibrahim",
|
|
19
|
+
"makashi",
|
|
20
|
+
"ibrahim-makashi",
|
|
21
|
+
"ibrahim makashi"
|
|
22
|
+
],
|
|
23
|
+
"author": "Ibrahim Makashi",
|
|
24
|
+
"license": "MIT"
|
|
25
|
+
}
|