Skip to content

Instantly share code, notes, and snippets.

Created Jun 20, 2019
What would you like to do?
// Check if there are extra content in the files
// If so, cut it all out for the parser
if(fileContents[0] != ':' && fileContents[1] != ':') {
let firstPassagePos = fileContents.indexOf('::');
fileContents = fileContents.slice(firstPassagePos, fileContents.length);
// Split the file based on the passage sigil (::) preceeded by a newline
let parsingPassages = fileContents.split('\n::');
// Check if any passages exist
if(parsingPassages == 0) {
throw new Error("No passages were found!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment