summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-11-11 17:18:44 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-11-11 17:18:44 +0100
commit1110e15450e3949782f2ae5344c080cbe701886b (patch)
treed2b821943b51d9064283c3819c96e7cb7ace4cf1
parentd4fd1779feaa283f85983e5c5f68bd40f38ed82e (diff)
downloadorm-1110e15450e3949782f2ae5344c080cbe701886b.tar.gz
orm-1110e15450e3949782f2ae5344c080cbe701886b.zip
add API mapping sanity check helper
-rw-r--r--mappings.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/mappings.js b/mappings.js
index e5a3f31..5d9315a 100644
--- a/mappings.js
+++ b/mappings.js
@@ -14,11 +14,16 @@ module.exports = {
// TODO wtf?
isItem: (str) => str.indexOf("Item") != -1,
isAbility: (str) => {
- if ( str.indexOf("Item") == -1 &&
+ if (str.indexOf("Item") == -1 &&
(str.indexOf("Ability") != -1 ||
str.indexOf("ABILITY") != -1) ) {
- if (!mappings.has(str)) console.error(str);
return true
} return false; },
+ crashIfBullshit: (str) => {
+ if(!mappings.has(str)) {
+ throw "unknown API string `" + str + "`";
+ }
+ return true;
+ },
isHero: (str) => str.indexOf("*") != -1 && str.indexOf("Item") == -1
};