diff --git a/dist/index.d.ts b/dist/index.d.ts index 17d127f..c38b3eb 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -40,6 +40,7 @@ export default class Config { open(file: string): void; openDir(dir: string): void; openJson(file: string): void; + saveConfigJson(data: object): void; filter(name: string): Config; set(key: string, value: any): void; has(key: string): boolean; diff --git a/dist/index.js b/dist/index.js index 7c42a43..c9ec3cb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -134,6 +134,11 @@ class Config { } this.prefix = this.getPrefix(); } + saveConfigJson(data) { + (0, bsert_1.default)(typeof data === "object"); + (0, bsert_1.default)(!Array.isArray(data)); + fs_1.default.writeFileSync(this.str("configdir"), JSON.stringify(data)); + } filter(name) { (0, bsert_1.default)(typeof name === "string"); const child = new Config(this.module);