From 391effcfa89fec69ff27dfbed8a1beb32a698622 Mon Sep 17 00:00:00 2001 From: Jinksi Date: Sat, 25 Nov 2017 15:12:48 +1000 Subject: [PATCH] Fix error when parsing empty yml file --- functions/parse-content.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/functions/parse-content.js b/functions/parse-content.js index 9d1aad8..51744e0 100644 --- a/functions/parse-content.js +++ b/functions/parse-content.js @@ -42,12 +42,8 @@ const parseMarkdown = data => { } const parseYaml = data => { - try { - data = yaml.safeLoad(data, 'utf8') - return JSON.stringify(data) - } catch (e) { - return console.log(e) - } + data = yaml.safeLoad(data, 'utf8') || {} + return JSON.stringify(data) } const getFileContents = filePath => {