diff --git a/src/index.ts b/src/index.ts index e40abdf..0c9e747 100644 --- a/src/index.ts +++ b/src/index.ts @@ -90,10 +90,7 @@ export function readUser(options?: RCOptions | string): T { export function serialize(config: T): string { return Object.entries(flat.flatten(config)) - .map( - ([key, value]) => - `${key}=${typeof value === "string" ? value : JSON.stringify(value)}` - ) + .map(([key, value]) => `${key}=${JSON.stringify(value)}`) .join("\n"); } diff --git a/test/index.test.ts b/test/index.test.ts index c7ef4d3..8c492e9 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -37,7 +37,7 @@ describe("rc", () => { test("Update user config", () => { updateUser({ "db.password": '"123"' }); - expect(readUser().db.password).toBe("123"); + expect(readUser().db.password).toBe(`"123"`); }); test("Parse ignore invalid lines", () => {