clear-af.js 1.0.0 → 1.0.2
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 +90 -62
- package/README_FR.md +125 -0
- package/dist/index.d.ts +108 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +126 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +78 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/functions/camelify.html +7 -0
- package/docs/functions/capitalize.html +7 -0
- package/docs/functions/deepClone.html +7 -0
- package/docs/functions/isEmail.html +7 -0
- package/docs/functions/isEmpty.html +7 -0
- package/docs/functions/isType.html +8 -0
- package/docs/functions/isURL.html +7 -0
- package/docs/functions/kebabify.html +7 -0
- package/docs/functions/logHeader.html +6 -0
- package/docs/functions/logSeparator.html +5 -0
- package/docs/functions/noTwins.html +7 -0
- package/docs/functions/prettyDebug.html +7 -0
- package/docs/functions/prettyError.html +7 -0
- package/docs/functions/prettyInfo.html +7 -0
- package/docs/functions/prettySuccess.html +7 -0
- package/docs/functions/prettyWarn.html +7 -0
- package/docs/functions/snakify.html +7 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +87 -0
- package/docs/media/README_FR.md +125 -0
- package/docs/modules.html +69 -0
- package/package.json +4 -2
- package/src/index.ts +4 -251
- package/src/logging.ts +129 -0
- package/src/object_manipulation.ts +42 -0
- package/src/transformation.ts +89 -0
- package/src/validation.ts +79 -0
package/README.md
CHANGED
|
@@ -1,97 +1,125 @@
|
|
|
1
1
|
# clear-af.js
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A JavaScript package packed with utilities to make your code **readable af**. Because clarity is the key to survival in programming.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
📖 **Languages** : [🇬🇧 English](#) | [🇫🇷 Français](README_FR.md)
|
|
6
|
+
|
|
7
|
+
📚 **[Full Documentation](https://froostdev.github.io/clear-af.js/)**
|
|
6
8
|
|
|
7
9
|
---
|
|
8
|
-
|
|
10
|
+
|
|
9
11
|
## 📦 Installation
|
|
10
|
-
|
|
11
12
|
```bash
|
|
12
13
|
npm install clear-af
|
|
13
14
|
```
|
|
14
15
|
|
|
15
16
|
---
|
|
16
|
-
|
|
17
|
-
## 🚀
|
|
18
|
-
|
|
17
|
+
|
|
18
|
+
## 🚀 Quick Start
|
|
19
19
|
```javascript
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const clear = require('clear-af');
|
|
21
|
+
|
|
22
|
+
clear.prettyError("An error!");
|
|
23
|
+
clear.camelify("hello world"); // "helloWorld"
|
|
24
|
+
clear.isEmpty(data);
|
|
23
25
|
```
|
|
24
26
|
|
|
25
27
|
---
|
|
26
|
-
|
|
27
|
-
## ✨
|
|
28
|
-
|
|
29
|
-
### 🔍
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
|
|
29
|
+
## ✨ Features
|
|
30
|
+
|
|
31
|
+
### 🔍 Improved Logging
|
|
32
|
+
Colored and formatted messages for better debugging.
|
|
32
33
|
```javascript
|
|
33
|
-
clear.prettyLog(data);
|
|
34
34
|
clear.prettyError(error);
|
|
35
|
+
clear.prettySuccess(message);
|
|
35
36
|
clear.prettyWarn(warning);
|
|
36
37
|
```
|
|
37
|
-
|
|
38
|
-
###
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
|
|
39
|
+
### ✅ Easy Validation
|
|
40
|
+
Verify your data quickly.
|
|
41
|
+
```javascript
|
|
42
|
+
clear.isEmpty(value);
|
|
43
|
+
clear.isEmail("test@example.com");
|
|
44
|
+
clear.isURL("https://example.com");
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 🔄 Object Manipulation
|
|
48
|
+
Deep clone and manipulate your data.
|
|
41
49
|
```javascript
|
|
42
|
-
clear.
|
|
43
|
-
clear.
|
|
44
|
-
clear.prettyPrint(anything);
|
|
50
|
+
clear.deepClone(obj);
|
|
51
|
+
clear.noTwins([1, 2, 2, 3]); // [1, 2, 3]
|
|
45
52
|
```
|
|
46
|
-
|
|
47
|
-
###
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
|
|
54
|
+
### 📝 String Transformation
|
|
55
|
+
Convert your strings to different formats.
|
|
50
56
|
```javascript
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
clear.camelify("hello world"); // "helloWorld"
|
|
58
|
+
clear.kebabify("hello world"); // "hello-world"
|
|
59
|
+
clear.snakify("hello world"); // "hello_world"
|
|
60
|
+
clear.capitalize("hello"); // "Hello"
|
|
54
61
|
```
|
|
55
62
|
|
|
56
63
|
---
|
|
57
|
-
|
|
64
|
+
|
|
65
|
+
## 📚 Complete API
|
|
66
|
+
|
|
67
|
+
### Logging
|
|
68
|
+
- `prettyError(message, showTime?)`
|
|
69
|
+
- `prettyWarn(message, showTime?)`
|
|
70
|
+
- `prettySuccess(message, showTime?)`
|
|
71
|
+
- `prettyInfo(message, showTime?)`
|
|
72
|
+
- `prettyDebug(message, showTime?)`
|
|
73
|
+
- `logSeparator()`
|
|
74
|
+
- `logHeader(title)`
|
|
75
|
+
|
|
76
|
+
### Validation
|
|
77
|
+
- `isEmpty(value)`
|
|
78
|
+
- `isType(value, type)`
|
|
79
|
+
- `isEmail(email)`
|
|
80
|
+
- `isURL(url)`
|
|
81
|
+
|
|
82
|
+
### Objects & Arrays
|
|
83
|
+
- `deepClone(obj)`
|
|
84
|
+
- `noTwins(array)`
|
|
85
|
+
|
|
86
|
+
### String Transformation
|
|
87
|
+
- `camelify(string)`
|
|
88
|
+
- `kebabify(string)`
|
|
89
|
+
- `snakify(string)`
|
|
90
|
+
- `capitalize(string)`
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
58
94
|
## 🤔 FAQ
|
|
59
|
-
|
|
60
|
-
**Q:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
**Q:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
**Q:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
**Q: Ça ralentit mon app ?**
|
|
70
|
-
R: Non, c'est juste des helpers utilitaires. Zéro overhead en production si vous l'utilisez à bon escient.
|
|
71
|
-
|
|
95
|
+
|
|
96
|
+
**Q: Why "-af" in the name?**
|
|
97
|
+
A: Because your code should be readable *af*, mate.
|
|
98
|
+
|
|
99
|
+
**Q: Is it compatible with TypeScript?**
|
|
100
|
+
A: Yes! TypeScript types are included.
|
|
101
|
+
|
|
102
|
+
**Q: Will it slow down my app?**
|
|
103
|
+
A: No, zero overhead. These are just helpers.
|
|
104
|
+
|
|
72
105
|
---
|
|
73
|
-
|
|
106
|
+
|
|
74
107
|
## 📝 License
|
|
75
|
-
|
|
76
|
-
MIT -
|
|
77
|
-
|
|
108
|
+
|
|
109
|
+
MIT - Free to use as you see fit.
|
|
110
|
+
|
|
78
111
|
---
|
|
79
|
-
|
|
80
|
-
## 🤝
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
112
|
+
|
|
113
|
+
## 🤝 Contributing
|
|
114
|
+
|
|
115
|
+
Contributions are welcome!
|
|
84
116
|
```bash
|
|
85
117
|
git clone https://github.com/FroostDev/clear-af.js
|
|
86
118
|
cd clear-af.js
|
|
87
119
|
npm install
|
|
88
|
-
npm run
|
|
120
|
+
npm run build
|
|
89
121
|
```
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
> *Créé par un développeur qui en avait marre de lire du code illisible.*
|
|
94
|
-
|
|
122
|
+
|
|
95
123
|
---
|
|
96
|
-
|
|
97
|
-
**clear-af.js** - *
|
|
124
|
+
|
|
125
|
+
**clear-af.js** - *Because clarity is the developer's mental health.* 🖤
|
package/README_FR.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# clear-af.js
|
|
2
|
+
|
|
3
|
+
Un package JavaScript rempli d'utilitaires pour rendre votre code **lisible af**. Parce que la clarté, c'est la clé de la survie en programmation.
|
|
4
|
+
|
|
5
|
+
📖 **Languages** : [🇬🇧 English](README.md) | [🇫🇷 Français](#)
|
|
6
|
+
|
|
7
|
+
📚 **[Documentation Complète](https://froostdev.github.io/clear-af.js/)**
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 📦 Installation
|
|
12
|
+
```bash
|
|
13
|
+
npm install clear-af
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 🚀 Utilisation rapide
|
|
19
|
+
```javascript
|
|
20
|
+
const clear = require('clear-af');
|
|
21
|
+
|
|
22
|
+
clear.prettyError("Une erreur !");
|
|
23
|
+
clear.camelify("hello world"); // "helloWorld"
|
|
24
|
+
clear.isEmpty(data);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## ✨ Fonctionnalités
|
|
30
|
+
|
|
31
|
+
### 🔍 Logging amélioré
|
|
32
|
+
Messages colorés et formatés pour un meilleur debugging.
|
|
33
|
+
```javascript
|
|
34
|
+
clear.prettyError(error);
|
|
35
|
+
clear.prettySuccess(message);
|
|
36
|
+
clear.prettyWarn(warning);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### ✅ Validation facile
|
|
40
|
+
Vérifiez vos données rapidement.
|
|
41
|
+
```javascript
|
|
42
|
+
clear.isEmpty(value);
|
|
43
|
+
clear.isEmail("test@example.com");
|
|
44
|
+
clear.isURL("https://example.com");
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 🔄 Manipulation d'objets
|
|
48
|
+
Clonez profondément et manipulez vos données.
|
|
49
|
+
```javascript
|
|
50
|
+
clear.deepClone(obj);
|
|
51
|
+
clear.noTwins([1, 2, 2, 3]); // [1, 2, 3]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 📝 Transformation de strings
|
|
55
|
+
Convertissez vos strings en différents formats.
|
|
56
|
+
```javascript
|
|
57
|
+
clear.camelify("hello world"); // "helloWorld"
|
|
58
|
+
clear.kebabify("hello world"); // "hello-world"
|
|
59
|
+
clear.snakify("hello world"); // "hello_world"
|
|
60
|
+
clear.capitalize("hello"); // "Hello"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 📚 API Complète
|
|
66
|
+
|
|
67
|
+
### Logging
|
|
68
|
+
- `prettyError(message, showTime?)`
|
|
69
|
+
- `prettyWarn(message, showTime?)`
|
|
70
|
+
- `prettySuccess(message, showTime?)`
|
|
71
|
+
- `prettyInfo(message, showTime?)`
|
|
72
|
+
- `prettyDebug(message, showTime?)`
|
|
73
|
+
- `logSeparator()`
|
|
74
|
+
- `logHeader(title)`
|
|
75
|
+
|
|
76
|
+
### Validation
|
|
77
|
+
- `isEmpty(value)`
|
|
78
|
+
- `isType(value, type)`
|
|
79
|
+
- `isEmail(email)`
|
|
80
|
+
- `isURL(url)`
|
|
81
|
+
|
|
82
|
+
### Objets & Arrays
|
|
83
|
+
- `deepClone(obj)`
|
|
84
|
+
- `noTwins(array)`
|
|
85
|
+
|
|
86
|
+
### Transformation de strings
|
|
87
|
+
- `camelify(string)`
|
|
88
|
+
- `kebabify(string)`
|
|
89
|
+
- `snakify(string)`
|
|
90
|
+
- `capitalize(string)`
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 🤔 FAQ
|
|
95
|
+
|
|
96
|
+
**Q: Pourquoi "-af" dans le nom ?**
|
|
97
|
+
R: Parce que ton code doit être lisible *af*, mec.
|
|
98
|
+
|
|
99
|
+
**Q: Compatible avec TypeScript ?**
|
|
100
|
+
R: Oui ! Les types TypeScript sont inclus.
|
|
101
|
+
|
|
102
|
+
**Q: Ça ralentit mon app ?**
|
|
103
|
+
R: Non, zéro overhead. Ce ne sont que des helpers.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 📝 Licence
|
|
108
|
+
|
|
109
|
+
MIT - Libre de l'utiliser comme bon vous semble.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 🤝 Contribution
|
|
114
|
+
|
|
115
|
+
Les contributions sont bienvenues !
|
|
116
|
+
```bash
|
|
117
|
+
git clone https://github.com/FroostDev/clear-af.js
|
|
118
|
+
cd clear-af.js
|
|
119
|
+
npm install
|
|
120
|
+
npm run build
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
**clear-af.js** - *Parce que la clarté, c'est la santé mentale du dev.* 🖤
|
package/dist/index.d.ts
CHANGED
|
@@ -6,48 +6,94 @@
|
|
|
6
6
|
declare function getDate(time?: boolean): string;
|
|
7
7
|
/**
|
|
8
8
|
* Show a pretty error log message with optional date information
|
|
9
|
+
* @category Logging
|
|
9
10
|
* @function prettyError
|
|
10
11
|
* @param err - Error message to display
|
|
11
12
|
* @param time - Include or not a timestamp
|
|
13
|
+
* @example
|
|
14
|
+
* prettyError("Database connection failed");
|
|
15
|
+
* // Output: ✕ - Database connection failed (in red)
|
|
16
|
+
*
|
|
17
|
+
* prettyError("Critical error", true);
|
|
18
|
+
* // Output: ✕ [30/03/2026 10:30:45] - Critical error (in red with timestamp)
|
|
12
19
|
*/
|
|
13
20
|
declare function prettyError(err: string, time?: boolean): void;
|
|
14
21
|
/**
|
|
15
22
|
* Show a pretty warn log message with optional date information
|
|
23
|
+
* @category Logging
|
|
16
24
|
* @function prettyWarn
|
|
17
25
|
* @param warn - Warning message to display
|
|
18
26
|
* @param time - Include or not a timestamp
|
|
27
|
+
* @example
|
|
28
|
+
* prettyWarn("Deprecated function used");
|
|
29
|
+
* // Output: ⚠ - Deprecated function used (in orange)
|
|
30
|
+
*
|
|
31
|
+
* prettyWarn("Low memory", true);
|
|
32
|
+
* // Output: ⚠ [30/03/2026 10:30:45] - Low memory (in orange with timestamp)
|
|
19
33
|
*/
|
|
20
34
|
declare function prettyWarn(warn: string, time?: boolean): void;
|
|
21
35
|
/**
|
|
22
36
|
* Show a pretty success log message with optional date information
|
|
37
|
+
* @category Logging
|
|
23
38
|
* @function prettySuccess
|
|
24
39
|
* @param success - Success message to display
|
|
25
40
|
* @param time - Include or not a timestamp
|
|
41
|
+
* @example
|
|
42
|
+
* prettySuccess("User created successfully");
|
|
43
|
+
* // Output: ✔ - User created successfully (in green)
|
|
44
|
+
*
|
|
45
|
+
* prettySuccess("Data saved", true);
|
|
46
|
+
* // Output: ✔ [30/03/2026 10:30:45] - Data saved (in green with timestamp)
|
|
26
47
|
*/
|
|
27
48
|
declare function prettySuccess(success: string, time?: boolean): void;
|
|
28
49
|
/**
|
|
29
50
|
* Show a pretty information log message with optional date information
|
|
51
|
+
* @category Logging
|
|
30
52
|
* @function prettyInfo
|
|
31
53
|
* @param info - Information message to display
|
|
32
54
|
* @param time - Include or not a timestamp
|
|
55
|
+
* @example
|
|
56
|
+
* prettyInfo("Server is running on port 3000");
|
|
57
|
+
* // Output: ℹ - Server is running on port 3000 (in blue)
|
|
58
|
+
*
|
|
59
|
+
* prettyInfo("Cache cleared", true);
|
|
60
|
+
* // Output: ℹ [30/03/2026 10:30:45] - Cache cleared (in blue with timestamp)
|
|
33
61
|
*/
|
|
34
62
|
declare function prettyInfo(info: string, time?: boolean): void;
|
|
35
63
|
/**
|
|
36
64
|
* Show a pretty debug log message with optional date information
|
|
65
|
+
* @category Logging
|
|
37
66
|
* @function prettyDebug
|
|
38
67
|
* @param debug - Debug message to display
|
|
39
68
|
* @param time - Include or not a timestamp
|
|
69
|
+
* @example
|
|
70
|
+
* prettyDebug("Variable x = 42");
|
|
71
|
+
* // Output: ⚙ - Variable x = 42 (in white)
|
|
72
|
+
*
|
|
73
|
+
* prettyDebug("Function call trace", true);
|
|
74
|
+
* // Output: ⚙ [30/03/2026 10:30:45] - Function call trace (in white with timestamp)
|
|
40
75
|
*/
|
|
41
76
|
declare function prettyDebug(debug: string, time?: boolean): void;
|
|
42
77
|
/**
|
|
43
78
|
* Show a separator line in console
|
|
79
|
+
* @category Logging
|
|
44
80
|
* @function logSeparator
|
|
81
|
+
* @example
|
|
82
|
+
* logSeparator();
|
|
83
|
+
* // Output: ══════════════════════════════════════════════════
|
|
45
84
|
*/
|
|
46
85
|
declare function logSeparator(): void;
|
|
47
86
|
/**
|
|
48
87
|
* Display a header with a title in the center
|
|
88
|
+
* @category Logging
|
|
49
89
|
* @function logHeader
|
|
50
90
|
* @param title - The title of the header
|
|
91
|
+
* @example
|
|
92
|
+
* logHeader("Welcome");
|
|
93
|
+
* // Output:
|
|
94
|
+
* // ╔═════════╗
|
|
95
|
+
* // ║ Welcome ║
|
|
96
|
+
* // ╚═════════╝
|
|
51
97
|
*/
|
|
52
98
|
declare function logHeader(title: string): void;
|
|
53
99
|
/**
|
|
@@ -57,31 +103,58 @@ declare function logHeader(title: string): void;
|
|
|
57
103
|
*/
|
|
58
104
|
/**
|
|
59
105
|
* Check if any type of variable is empty
|
|
106
|
+
* @category Validation
|
|
60
107
|
* @function isEmpty
|
|
61
108
|
* @param value - The variable to check
|
|
62
109
|
* @returns {boolean} True if the value is empty, false otherwise
|
|
110
|
+
* @example
|
|
111
|
+
* isEmpty(""); // true
|
|
112
|
+
* isEmpty(" "); // true
|
|
113
|
+
* isEmpty(null); // true
|
|
114
|
+
* isEmpty([]); // true
|
|
115
|
+
* isEmpty({}); // true
|
|
116
|
+
* isEmpty("hello"); // false
|
|
117
|
+
* isEmpty([1, 2]); // false
|
|
63
118
|
*/
|
|
64
119
|
declare function isEmpty(value: unknown): boolean;
|
|
65
120
|
/**
|
|
66
121
|
* Check if the variable is of the chosen type
|
|
122
|
+
* @category Validation
|
|
67
123
|
* @function isType
|
|
68
124
|
* @param value - The variable to check
|
|
69
125
|
* @param type - The type you want
|
|
70
126
|
* @returns {boolean} True if the value is of the chosen type, false otherwise
|
|
127
|
+
* @example
|
|
128
|
+
* isType("hello", "string"); // true
|
|
129
|
+
* isType(42, "number"); // true
|
|
130
|
+
* isType([], "object"); // true
|
|
131
|
+
* isType("42", "number"); // false
|
|
71
132
|
*/
|
|
72
133
|
declare function isType(value: unknown, type: string): boolean;
|
|
73
134
|
/**
|
|
74
135
|
* Check if an email is valid
|
|
136
|
+
* @category Validation
|
|
75
137
|
* @function isEmail
|
|
76
138
|
* @param email - The email to check
|
|
77
139
|
* @returns {boolean} True if the email is valid, false otherwise
|
|
140
|
+
* @example
|
|
141
|
+
* isEmail("alice@example.com"); // true
|
|
142
|
+
* isEmail("bob.smith@company.co.uk"); // true
|
|
143
|
+
* isEmail("invalid@.com"); // false
|
|
144
|
+
* isEmail("no-at-sign.com"); // false
|
|
78
145
|
*/
|
|
79
146
|
declare function isEmail(email: string): boolean;
|
|
80
147
|
/**
|
|
81
148
|
* Check if a URL is valid
|
|
149
|
+
* @category Validation
|
|
82
150
|
* @function isURL
|
|
83
151
|
* @param url - The URL to check
|
|
84
152
|
* @returns {boolean} True if the URL is valid, false otherwise
|
|
153
|
+
* @example
|
|
154
|
+
* isURL("https://www.example.com"); // true
|
|
155
|
+
* isURL("http://example.com/path"); // true
|
|
156
|
+
* isURL("www.example.com"); // false (missing protocol)
|
|
157
|
+
* isURL("not a url"); // false
|
|
85
158
|
*/
|
|
86
159
|
declare function isURL(url: string): boolean;
|
|
87
160
|
/**
|
|
@@ -91,49 +164,83 @@ declare function isURL(url: string): boolean;
|
|
|
91
164
|
*/
|
|
92
165
|
/**
|
|
93
166
|
* Create a deep clone of any object or array
|
|
167
|
+
* @category Object Manipulation
|
|
94
168
|
* @function deepClone
|
|
95
169
|
* @param obj - The object or array to clone
|
|
96
170
|
* @returns A deep clone of the object
|
|
171
|
+
* @example
|
|
172
|
+
* const user = { name: "Alice", skills: ["JS", "TS"] };
|
|
173
|
+
* const clone = deepClone(user);
|
|
174
|
+
* clone.name = "Bob";
|
|
175
|
+
* clone.skills[0] = "Python";
|
|
176
|
+
* console.log(user.name); // "Alice" (unchanged)
|
|
177
|
+
* console.log(user.skills[0]); // "JS" (unchanged)
|
|
97
178
|
*/
|
|
98
179
|
declare function deepClone<T>(obj: T): T;
|
|
99
180
|
/**
|
|
100
181
|
* Remove duplicate values from an array
|
|
182
|
+
* @category Object Manipulation
|
|
101
183
|
* @function noTwins
|
|
102
184
|
* @param arr - The array to remove duplicates from
|
|
103
185
|
* @returns {unknown[]} A new array with unique values only
|
|
186
|
+
* @example
|
|
187
|
+
* noTwins([1, 2, 2, 3, 3, 3]); // [1, 2, 3]
|
|
188
|
+
* noTwins(["a", "b", "a", "c"]); // ["a", "b", "c"]
|
|
189
|
+
* noTwins([1, "1", 1, "1"]); // [1, "1"]
|
|
104
190
|
*/
|
|
105
191
|
declare function noTwins(arr: unknown[]): unknown[];
|
|
106
192
|
/**
|
|
107
193
|
*
|
|
108
|
-
*
|
|
194
|
+
* Transformation utilites
|
|
109
195
|
*
|
|
110
196
|
*/
|
|
111
197
|
/**
|
|
112
198
|
* Transform a string to camelCase format
|
|
199
|
+
* @category Transformation
|
|
113
200
|
* @function camelify
|
|
114
201
|
* @param str - The string to transform
|
|
115
202
|
* @returns {string} The string in camelCase format
|
|
203
|
+
* @example
|
|
204
|
+
* camelify("hello world"); // "helloWorld"
|
|
205
|
+
* camelify("C'est un test"); // "cestUnTest"
|
|
206
|
+
* camelify("foo bar baz"); // "fooBarBaz"
|
|
116
207
|
*/
|
|
117
208
|
declare function camelify(str: string): string;
|
|
118
209
|
/**
|
|
119
210
|
* Transform a string to kebab-case format
|
|
211
|
+
* @category Transformation
|
|
120
212
|
* @function kebabify
|
|
121
213
|
* @param str - The string to transform
|
|
122
214
|
* @returns {string} The string in kebab-case format
|
|
215
|
+
* @example
|
|
216
|
+
* kebabify("hello world"); // "hello-world"
|
|
217
|
+
* kebabify("C'est un test"); // "ceststun-test"
|
|
218
|
+
* kebabify("foo bar baz"); // "foo-bar-baz"
|
|
123
219
|
*/
|
|
124
220
|
declare function kebabify(str: string): string;
|
|
125
221
|
/**
|
|
126
222
|
* Transform a string to snake_case format
|
|
223
|
+
* @category Transformation
|
|
127
224
|
* @function snakify
|
|
128
225
|
* @param str - The string to transform
|
|
129
226
|
* @returns {string} The string in snake_case format
|
|
227
|
+
* @example
|
|
228
|
+
* snakify("hello world"); // "hello_world"
|
|
229
|
+
* snakify("C'est un test"); // "ceststun_test"
|
|
230
|
+
* snakify("foo bar baz"); // "foo_bar_baz"
|
|
130
231
|
*/
|
|
131
232
|
declare function snakify(str: string): string;
|
|
132
233
|
/**
|
|
133
234
|
* Capitalize the first character of a string
|
|
235
|
+
* @category Transformation
|
|
134
236
|
* @function capitalize
|
|
135
237
|
* @param str - The string to capitalize
|
|
136
238
|
* @returns {string} The string with the first character in uppercase
|
|
239
|
+
* @example
|
|
240
|
+
* capitalize("hello"); // "Hello"
|
|
241
|
+
* capitalize("hello world"); // "Hello world"
|
|
242
|
+
* capitalize(""); // ""
|
|
137
243
|
*/
|
|
138
244
|
declare function capitalize(str: string): string;
|
|
245
|
+
export { getDate, prettyError, prettyWarn, prettySuccess, prettyInfo, prettyDebug, logSeparator, logHeader, isEmpty, isType, isEmail, isURL, deepClone, noTwins, camelify, kebabify, snakify, capitalize };
|
|
139
246
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,iBAAS,OAAO,CAAC,IAAI,GAAE,OAAe,GAAG,MAAM,CAE9C;AAQD
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,iBAAS,OAAO,CAAC,IAAI,GAAE,OAAe,GAAG,MAAM,CAE9C;AAQD;;;;;;;;;;;;GAYG;AACH,iBAAS,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,UAAQ,GAAG,IAAI,CAGpD;AAED;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