horae-configure 0.0.1

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.
Files changed (2) hide show
  1. package/README.md +83 -0
  2. package/package.json +48 -0
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # Introduction
2
+
3
+ "horae" is a lightweight JavaScript library that provides methods to easily read JSON files and
4
+ manipulate data using the `set`, `get`, `has`, and `save` functions.
5
+
6
+ ## Features
7
+
8
+ - Read JSON files effortlessly.
9
+ - Modify JSON data using `set` and `get` methods.
10
+ - Check if a specific property exists using `has`.
11
+ - Save the updated JSON data back to the file.
12
+
13
+ ## Installation
14
+
15
+ You can install "horae" via npm:
16
+
17
+ ```bash
18
+ npm install horae
19
+ ```
20
+
21
+ # How to use?
22
+
23
+ You need to first prepare a JSON file in the outermost layer of the project
24
+
25
+ ```json
26
+ {
27
+ "position": {
28
+ "x": 1,
29
+ "y": 2
30
+ }
31
+ }
32
+ ```
33
+
34
+ and then initialize `horae` variable
35
+
36
+ ```typescript
37
+ const horae = new Horae<{
38
+ position: {
39
+ x: number;
40
+ y: number;
41
+ };
42
+ }>('config');
43
+ ```
44
+
45
+ ### `get` method
46
+
47
+ ```typescript
48
+ horae.get('position.x'); // 1
49
+ horae.get('position.y'); // 2
50
+ ```
51
+
52
+ ### `has` method
53
+
54
+ ```typescript
55
+ horae.has('position.x'); // true
56
+ horae.has('position.y'); // true
57
+ horae.has('position.z'); // false
58
+ ```
59
+
60
+ ### `set` method
61
+
62
+ ```typescript
63
+ horae.set('position.x', 100);
64
+ horae.get('position.x'); // 100
65
+ ```
66
+
67
+ ### `save` method
68
+
69
+ ```typescript
70
+ horae.set('position.', 100);
71
+ horae.save();
72
+ ```
73
+
74
+ Go back and view the JSON file
75
+
76
+ ```json
77
+ {
78
+ "position": {
79
+ "x": 1000,
80
+ "y": 2
81
+ }
82
+ }
83
+ ```
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "horae-configure",
3
+ "private": false,
4
+ "version": "0.0.1",
5
+ "type": "commonjs",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/horae.umd.cjs",
10
+ "bin": {
11
+ "horae": "./bin/index.js"
12
+ },
13
+ "module": "./dist/horae.js",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/horae.js",
17
+ "require": "./dist/horae.umd.cjs"
18
+ }
19
+ },
20
+ "scripts": {
21
+ "dev": "webpack --mode=development",
22
+ "watch": "webpack --mode=development --watch",
23
+ "build": "webpack --mode=production",
24
+ "test": "jest"
25
+ },
26
+ "devDependencies": {
27
+ "@babel/core": "^7.22.9",
28
+ "@babel/preset-env": "^7.22.9",
29
+ "@types/jest": "^29.5.3",
30
+ "@typescript-eslint/eslint-plugin": "^5.50.0",
31
+ "babel-loader": "^9.1.3",
32
+ "eslint": "^8.0.1",
33
+ "eslint-config-airbnb": "^19.0.4",
34
+ "eslint-config-prettier": "^8.8.0",
35
+ "eslint-plugin-import": "^2.25.2",
36
+ "eslint-plugin-n": "^15.0.0",
37
+ "eslint-plugin-prettier": "^4.2.1",
38
+ "eslint-plugin-promise": "^6.0.0",
39
+ "eslint-plugin-simple-import-sort": "^10.0.0",
40
+ "jest": "^29.6.2",
41
+ "prettier": "^2.8.8",
42
+ "ts-jest": "^29.1.1",
43
+ "ts-loader": "^9.4.4",
44
+ "typescript": "^5.1.6",
45
+ "webpack": "^5.88.2",
46
+ "webpack-cli": "^5.1.4"
47
+ }
48
+ }