From 6e0608c9a98e59550f64147a6fff1327cd0296bf Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 21 Dec 2022 15:15:55 -0500 Subject: [PATCH] *Add savePath utility method --- src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index a28caf7..646f4fd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -94,7 +94,7 @@ export default class Config { } } - public save(file: string, data: object) { + public save(file: string, data: object): void { assert(typeof data === "object"); assert(!Array.isArray(data)); @@ -109,6 +109,10 @@ export default class Config { this.open(fullPath); } + public savePath(file: string, path: string): void { + this.save(file, this.get(path)); + } + public set(key: string, value: any) { assert(typeof key === "string", "Key must be a string.");