Skip to content

Commit

Permalink
fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Aug 5, 2024
1 parent 0009558 commit 0d3475e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions javascript/src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,18 @@ exports.get_data_file = function(name, encoding = 'utf8') {
* @return {number | string}
*/
exports.get_answer = function(n) {
for (line of exports.get_data_file("answers.csv").split(new RegExp("\\r?\\n"))) {
let [id_, type, size, value] = line.split("\t");
for (line of exports.get_data_file('answers.csv').split(new RegExp('\\r?\\n'))) {
const [id_, type, size, value] = line.split('\t');
if (id_ !== n.toString()) {
continue;
}
if (type === "str") {
if (type === 'str') {
if (value.length !== parseInt(size)) {
throw new Error('string length does not match');
}
return value;
}
return parseInt(value);
}
throw new Error("Answer not found");
}
throw new Error('Answer not found');
};

0 comments on commit 0d3475e

Please sign in to comment.