-
-
Save videlais/3c4346360c59e2a59074320c06a1cbd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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