Return empty object instead of false if no metadata (#182)

Closes #139
This commit is contained in:
Joel Marcey 2017-10-26 07:02:52 -07:00 committed by Héctor Ramos
parent d2d3ace924
commit f72df94dd3

View file

@ -73,7 +73,7 @@ function readSidebar() {
function splitHeader(content) {
const lines = content.split("\n");
if (lines[0] !== "---") {
return false;
return {};
}
let i = 1;
for (; i < lines.length - 1; ++i) {
@ -91,7 +91,7 @@ function splitHeader(content) {
function extractMetadata(content) {
const metadata = {};
const both = splitHeader(content);
if (both === false) {
if (Object.keys(both).length === 0) {
return { metadata, rawContent: content };
}
const lines = both.header.split("\n");