mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
Throw error for unknown hiscores CSV format
This commit is contained in:
@@ -27,7 +27,8 @@ import {
|
||||
rsnFromElement,
|
||||
getActivityPageURL,
|
||||
httpGet,
|
||||
BOSSES
|
||||
BOSSES,
|
||||
INVALID_FORMAT_ERROR
|
||||
} from './utils';
|
||||
|
||||
/**
|
||||
@@ -74,6 +75,10 @@ export function parseStats(csv: string): Stats {
|
||||
.filter((entry) => !!entry)
|
||||
.map((stat) => stat.split(','));
|
||||
|
||||
if (splitCSV.length !== SKILLS.length + BH_MODES.length + CLUES.length + BOSSES.length + 3) {
|
||||
throw Error(INVALID_FORMAT_ERROR);
|
||||
}
|
||||
|
||||
const skillObjects: Skill[] = splitCSV
|
||||
.filter((stat) => stat.length === 3)
|
||||
.map((stat) => {
|
||||
|
Reference in New Issue
Block a user