From a4349ab85606e71b65e6a4df70dc889d26223efd Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 7 Apr 2022 19:21:16 +0200 Subject: [PATCH] fix: avoid optional chaining for node 12.x compatibility --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 5de9ad2..d857f1a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,7 +29,7 @@ function withDefaults (options?: RCOptions | string): RCOptions { return { ...defaults, ...options } } -export function parse (contents: string, options?: RCOptions): RC { +export function parse (contents: string, options: RCOptions = {}): RC { const config: RC = {} const lines = contents.split(RE_LINES) @@ -56,7 +56,7 @@ export function parse (contents: string, options?: RCOptions): RC { config[key] = val } - return options?.flat ? config : flat.unflatten(config, { overwrite: true }) + return options.flat ? config : flat.unflatten(config, { overwrite: true }) } export function parseFile (path: string, options?: RCOptions): RC {