Commit 8492720a authored by derek-knox's avatar derek-knox

Apply review feedback

parent 2b60bc30
......@@ -2,6 +2,12 @@ import jsYaml from 'js-yaml';
const NEW_LINE = '\n';
const hasMatter = (firstThreeChars, fourthChar) => {
const isYamlDelimiter = firstThreeChars === '---';
const isFourthCharNewline = fourthChar === NEW_LINE;
return isYamlDelimiter && isFourthCharNewline;
};
export const frontMatterify = source => {
let index = 3;
let offset;
......@@ -16,7 +22,7 @@ export const frontMatterify = source => {
type: null,
};
if (!type || source.charAt(index) !== NEW_LINE) {
if (!hasMatter(delimiter, source.charAt(index))) {
return NO_FRONTMATTER;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment