shadowly 0.0.0 → 1.0.3
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/LICENSE +6 -6
- package/README.md +163 -1
- package/package.json +6 -5
- package/tsconfig.json +9 -25
- package/bun.lock +0 -26
- package/src/index.ts +0 -3
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Copyright 2025 Pro203S
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
1
|
+
Copyright 2025 Pro203S
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
7
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,166 @@
|
|
|
1
1
|
# Shadowly
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript로 만든 체이닝 JSON 데이터베이스 모듈
|
|
4
4
|
|
|
5
|
+
## 시작하기
|
|
6
|
+
|
|
7
|
+
- 패키지 설치
|
|
8
|
+
> npm i shadowly
|
|
9
|
+
|
|
10
|
+
## 사용법
|
|
11
|
+
|
|
12
|
+
### 새 JSON 만들기
|
|
13
|
+
|
|
14
|
+
`generateNewJson` 함수로 JSON을 새로 만들 수 있습니다.
|
|
15
|
+
|파라메터|타입|설명|
|
|
16
|
+
|------|--------|-------|
|
|
17
|
+
|path|string|만들 파일 경로|
|
|
18
|
+
|isArray|boolean?|true면 배열 형식으로 생성|
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import Shadowly from 'shadowly';
|
|
22
|
+
|
|
23
|
+
// example.json을 Object 형식으로 새로 만듭니다. (파일 내용: {})
|
|
24
|
+
Shadowly.generateNewJson("./object.json");
|
|
25
|
+
|
|
26
|
+
// array.json을 Array 형식으로 새로 만듭니다. (파일 내용: [])
|
|
27
|
+
Shadowly.generateNewJson("./array.json", true);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Shadowly 인스턴스 만들기
|
|
31
|
+
|
|
32
|
+
`new Shadowly()`로 Shadowly의 인스턴스를 새로 만들 수 있습니다.
|
|
33
|
+
|파라메터|타입|설명|
|
|
34
|
+
|------|--------|-------|
|
|
35
|
+
|path|string|JSON 파일 경로|
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import Shadowly from 'shadowly';
|
|
39
|
+
|
|
40
|
+
// object.json을 읽어들여 Shadowly의 인스턴스를 새로 만듭니다.
|
|
41
|
+
new Shadowly("./object.json");
|
|
42
|
+
|
|
43
|
+
// JSON의 타입 정의를 할 수 있습니다.
|
|
44
|
+
new Shadowly<typeof import("./array.json")>("./array.json");
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### JSON의 값 가져오기
|
|
48
|
+
|
|
49
|
+
`get` 함수는 특정 키로 이동합니다.
|
|
50
|
+
|파라메터|타입|설명|
|
|
51
|
+
|------|--------|-------|
|
|
52
|
+
|key|string or number|키 이름입니다.|
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import Shadowly from 'shadowly';
|
|
56
|
+
|
|
57
|
+
// key -> key2로 이동합니다.
|
|
58
|
+
new Shadowly("./object.json")
|
|
59
|
+
.get("key")
|
|
60
|
+
.get("key2");
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`value` 함수는 이동한 키의 값을 가져옵니다.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import Shadowly from 'shadowly';
|
|
67
|
+
|
|
68
|
+
// key의 값을 가져옵니다.
|
|
69
|
+
new Shadowly("./object.json")
|
|
70
|
+
.get("key")
|
|
71
|
+
.value();
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### JSON에 값 쓰기
|
|
75
|
+
|
|
76
|
+
`set` 함수는 특정 키에 씁니다.
|
|
77
|
+
|파라메터|타입|설명|
|
|
78
|
+
|------|--------|-------|
|
|
79
|
+
|value|any|쓸 값입니다.|
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import Shadowly from 'shadowly';
|
|
83
|
+
|
|
84
|
+
// key 안에 있는 key2에 value2를 씁니다.
|
|
85
|
+
new Shadowly("./object.json")
|
|
86
|
+
.get("key")
|
|
87
|
+
.get("key2")
|
|
88
|
+
.set("value2");
|
|
89
|
+
|
|
90
|
+
/*
|
|
91
|
+
결과:
|
|
92
|
+
{
|
|
93
|
+
"key": {
|
|
94
|
+
"key2": "value2"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
*/
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`remove` 함수는 특정 키를 지웁니다.
|
|
101
|
+
|파라메터|타입|설명|
|
|
102
|
+
|------|--------|-------|
|
|
103
|
+
|key|string or number|키 이름입니다.|
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import Shadowly from 'shadowly';
|
|
107
|
+
|
|
108
|
+
// key 안에 있는 key2를 지웁니다.
|
|
109
|
+
new Shadowly("./object.json")
|
|
110
|
+
.get("key")
|
|
111
|
+
.remove("key2");
|
|
112
|
+
|
|
113
|
+
/*
|
|
114
|
+
결과:
|
|
115
|
+
{
|
|
116
|
+
"key": {}
|
|
117
|
+
}
|
|
118
|
+
*/
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 그 외
|
|
122
|
+
|
|
123
|
+
`back` 함수는 한 번 뒤로 갑니다.
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import Shadowly from 'shadowly';
|
|
127
|
+
|
|
128
|
+
// key 안에 있는 값을 가져옵니다.
|
|
129
|
+
// key에서 key2로 이동 후 뒤로가기 한 다음 값 가져오기
|
|
130
|
+
new Shadowly("./object.json")
|
|
131
|
+
.get("key")
|
|
132
|
+
.get("key2")
|
|
133
|
+
.back()
|
|
134
|
+
.value();
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`up` 함수는 여러 번 뒤로 갑니다.
|
|
138
|
+
|파라메터|타입|설명|
|
|
139
|
+
|------|--------|-------|
|
|
140
|
+
|steps|number?|뒤로 갈 횟수입니다.|
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import Shadowly from 'shadowly';
|
|
144
|
+
|
|
145
|
+
// JSON 데이터를 가져옵니다.
|
|
146
|
+
// key에서 key2로 이동 후 뒤로 2번 이동 한 다음 값 가져오기
|
|
147
|
+
new Shadowly("./object.json")
|
|
148
|
+
.get("key")
|
|
149
|
+
.get("key2")
|
|
150
|
+
.up(2)
|
|
151
|
+
.value();
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`root` 함수는 루트로 이동합니다.
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import Shadowly from 'shadowly';
|
|
158
|
+
|
|
159
|
+
// JSON 데이터를 가져옵니다.
|
|
160
|
+
// key에서 key2로 이동 후 루트로 이동 한 다음 값 가져오기
|
|
161
|
+
new Shadowly("./object.json")
|
|
162
|
+
.get("key")
|
|
163
|
+
.get("key2")
|
|
164
|
+
.root()
|
|
165
|
+
.value();
|
|
166
|
+
```
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shadowly",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "TypeScript JSON Database",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"database",
|
|
7
7
|
"json",
|
|
8
|
-
"typescript"
|
|
8
|
+
"typescript",
|
|
9
|
+
"cli"
|
|
9
10
|
],
|
|
10
11
|
"homepage": "https://github.com/Pro203S/Shadowly#readme",
|
|
11
12
|
"bugs": {
|
|
@@ -17,8 +18,8 @@
|
|
|
17
18
|
},
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"author": "Pro203S",
|
|
20
|
-
"type": "
|
|
21
|
-
"main": "
|
|
21
|
+
"type": "commonjs",
|
|
22
|
+
"main": "./dist/index.js",
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "tsc"
|
|
24
25
|
},
|
|
@@ -28,4 +29,4 @@
|
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"typescript": "^5"
|
|
30
31
|
}
|
|
31
|
-
}
|
|
32
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"jsx": "react-jsx",
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
|
|
11
|
-
// Bundler mode
|
|
12
|
-
"moduleResolution": "bundler",
|
|
13
|
-
"allowImportingTsExtensions": true,
|
|
14
|
-
"verbatimModuleSyntax": true,
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
|
|
17
|
-
// Best practices
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"rootDir": "src",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"declaration": true,
|
|
18
8
|
"strict": true,
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// Some stricter flags (disabled by default)
|
|
25
|
-
"noUnusedLocals": false,
|
|
26
|
-
"noUnusedParameters": false,
|
|
27
|
-
"noPropertyAccessFromIndexSignature": false
|
|
28
|
-
}
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"resolveJsonModule": true
|
|
11
|
+
},
|
|
12
|
+
"exclude": ["tests/", "dist/"]
|
|
29
13
|
}
|
package/bun.lock
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"lockfileVersion": 1,
|
|
3
|
-
"configVersion": 1,
|
|
4
|
-
"workspaces": {
|
|
5
|
-
"": {
|
|
6
|
-
"name": "shadowly",
|
|
7
|
-
"devDependencies": {
|
|
8
|
-
"@types/bun": "latest",
|
|
9
|
-
},
|
|
10
|
-
"peerDependencies": {
|
|
11
|
-
"typescript": "^5",
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
"packages": {
|
|
16
|
-
"@types/bun": ["@types/bun@1.3.6", "", { "dependencies": { "bun-types": "1.3.6" } }, "sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA=="],
|
|
17
|
-
|
|
18
|
-
"@types/node": ["@types/node@25.0.10", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg=="],
|
|
19
|
-
|
|
20
|
-
"bun-types": ["bun-types@1.3.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ=="],
|
|
21
|
-
|
|
22
|
-
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
23
|
-
|
|
24
|
-
"undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
|
25
|
-
}
|
|
26
|
-
}
|
package/src/index.ts
DELETED