js-dev-tool 1.2.9 → 1.2.10
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/package.json +1 -1
- package/utils.d.ts +6 -7
- package/utils.js +5 -7
package/package.json
CHANGED
package/utils.d.ts
CHANGED
|
@@ -86,20 +86,19 @@ export function readText<C extends TBD<TFsCallback>, R extends undefined extends
|
|
|
86
86
|
export function readJson<T, C extends TBD<TReadJsonCallback<string>>, R extends undefined extends C ? TypedRecord<T> : void>(path: string, callback?: C): R;
|
|
87
87
|
/**
|
|
88
88
|
* @template T
|
|
89
|
-
* @
|
|
90
|
-
* @param {TypedRecord<T>} json file path.
|
|
89
|
+
* @param {T} json file path.
|
|
91
90
|
* @param {string} path file path.
|
|
92
|
-
* @param {
|
|
91
|
+
* @param {TWriteJsonCallback} [callback]
|
|
93
92
|
* @returns {void} description
|
|
94
93
|
*/
|
|
95
|
-
declare function writeJson<T
|
|
94
|
+
declare function writeJson<T>(json: T, path: string, callback?: TWriteJsonCallback): void;
|
|
96
95
|
/**
|
|
97
96
|
* @template T
|
|
98
|
-
* @param {
|
|
97
|
+
* @param {T} json
|
|
99
98
|
* @param {number} [indent=2]
|
|
100
|
-
* @returns
|
|
99
|
+
* @returns {string}
|
|
101
100
|
*/
|
|
102
|
-
declare function formatedStringify<T>(json:
|
|
101
|
+
declare function formatedStringify<T>(json: T, indent?: number): string;
|
|
103
102
|
/**
|
|
104
103
|
* @param path
|
|
105
104
|
* @param handler
|
package/utils.js
CHANGED
|
@@ -151,7 +151,6 @@ function readText(from, callback) {
|
|
|
151
151
|
* @typedef {TBD<(err: any, data: TypedRecord<T>) => void>} TReadJsonCallback
|
|
152
152
|
*/
|
|
153
153
|
/**
|
|
154
|
-
* @template T
|
|
155
154
|
* @typedef {TBD<() => void>} TWriteJsonCallback
|
|
156
155
|
*/
|
|
157
156
|
/**
|
|
@@ -177,10 +176,9 @@ function readJson(path, callback) {
|
|
|
177
176
|
}
|
|
178
177
|
/**
|
|
179
178
|
* @template T
|
|
180
|
-
* @
|
|
181
|
-
* @param {TypedRecord<T>} json file path.
|
|
179
|
+
* @param {T} json file path.
|
|
182
180
|
* @param {string} path file path.
|
|
183
|
-
* @param {
|
|
181
|
+
* @param {TWriteJsonCallback} [callback]
|
|
184
182
|
* @returns {void} description
|
|
185
183
|
*/
|
|
186
184
|
function writeJson(json, path, callback) {
|
|
@@ -188,9 +186,9 @@ function writeJson(json, path, callback) {
|
|
|
188
186
|
}
|
|
189
187
|
/**
|
|
190
188
|
* @template T
|
|
191
|
-
* @param {
|
|
192
|
-
* @param {number} [indent=2]
|
|
193
|
-
* @returns
|
|
189
|
+
* @param {T} json
|
|
190
|
+
* @param {number} [indent=2]
|
|
191
|
+
* @returns {string}
|
|
194
192
|
*/
|
|
195
193
|
const formatedStringify = (json, indent = 2) => JSON.stringify(json, null, indent);
|
|
196
194
|
/**
|