I like your idea to add extra support for checking if the file contains front matter or not. However instead of executing re.test in jsYaml.hasFront you should just use the exec method and cache the results. Then go ahead and remove lines 13 - 15 and place the responsibility for checking for front yaml on the user end.