@ylsoo/core 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 +19 -0
- package/index.js +43 -0
- package/package.json +17 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @ylsoo/core
|
|
2
|
+
|
|
3
|
+
Core utility functions for Ylsoo projects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @ylsoo/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
const ylsoo = require('@ylsoo/core');
|
|
15
|
+
|
|
16
|
+
ylsoo.log('Hello World');
|
|
17
|
+
console.log(ylsoo.capitalize('hello'));
|
|
18
|
+
console.log(ylsoo.isEmpty(''));
|
|
19
|
+
```
|
package/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ylsoo Core - Basic utility functions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
class YlsooCore {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.version = '1.0.0';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Logs a message with prefix
|
|
12
|
+
* @param {string} message - The message to log
|
|
13
|
+
*/
|
|
14
|
+
log(message) {
|
|
15
|
+
console.log(`[Ylsoo Core] ${message}`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Simple utility to capitalize a string
|
|
20
|
+
* @param {string} str - The string to capitalize
|
|
21
|
+
* @returns {string} Capitalized string
|
|
22
|
+
*/
|
|
23
|
+
capitalize(str) {
|
|
24
|
+
if (typeof str !== 'string' || str.length === 0) {
|
|
25
|
+
return str;
|
|
26
|
+
}
|
|
27
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Simple utility to check if value is empty
|
|
32
|
+
* @param {*} value - The value to check
|
|
33
|
+
* @returns {boolean} True if empty
|
|
34
|
+
*/
|
|
35
|
+
isEmpty(value) {
|
|
36
|
+
if (value === null || value === undefined) return true;
|
|
37
|
+
if (typeof value === 'string' || Array.isArray(value)) return value.length === 0;
|
|
38
|
+
if (typeof value === 'object') return Object.keys(value).length === 0;
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = new YlsooCore();
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ylsoo/core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Core utility functions for Ylsoo projects",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"ylsoo",
|
|
11
|
+
"core",
|
|
12
|
+
"utilities"
|
|
13
|
+
],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"type": "commonjs"
|
|
17
|
+
}
|