diff options
author | JoelHMikael <joel.h.kronqvist@gmail.com> | 2021-12-18 14:15:53 +0200 |
---|---|---|
committer | JoelHMikael <joel.h.kronqvist@gmail.com> | 2021-12-18 14:15:53 +0200 |
commit | fc48ff89c2015757ba9936795b34201156e38b9e (patch) | |
tree | 977099545772551d020f781de5dd68948f0fd4b0 /parse.js | |
parent | b12ab0480ebeacbfb0d6841cb8aca218a5bf2f5a (diff) | |
download | LYLLRuoka-fc48ff89c2015757ba9936795b34201156e38b9e.tar.gz LYLLRuoka-fc48ff89c2015757ba9936795b34201156e38b9e.zip |
Food scraping
Added food scraping from the RSS & implemented showing the result on the server
Diffstat (limited to 'parse.js')
-rw-r--r-- | parse.js | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -94,6 +94,8 @@ function getToLineStartingWith(s, ss, start = 0) function findExpression(data, expr, start = 0) { + if (start == -1) + return -1; if (!(Number.isInteger(start) && (start >= 0))) throw new TypeError("Start must be a positive integer!"); while ((data.substring(start, start + expr.length) !== expr) && (start + expr.length < data.length)) @@ -105,7 +107,7 @@ function findExpression(data, expr, start = 0) function parseCluttered(s) { - return s.replaceAll(".", "").replaceAll(" ", "").toUpperCase(); + return s.replaceAll(".", "").replaceAll(" ", "").replaceAll("<", "(").replaceAll(">", ")").toUpperCase(); } function parseClasses(classData, DB) @@ -280,3 +282,4 @@ exports.indexType = getIndexType; exports.classes = parseClasses; exports.get = getShift; exports.cluttered = parseCluttered; +exports.find = findExpression; |