underscript.constants
Helpers for working with items, priorities and rarities when you are not sure what you were given. They accept an item, priority or rarity, or the text for one, like 'gold', 'high' or 'DT'.
Syntax
underscript.constants.getItem(value);
underscript.constants.isItem(value);
underscript.constants.getPriority(value);
underscript.constants.isPriority(value);
underscript.constants.getRarity(value);
underscript.constants.isRarity(value);
- getItem
- Returns the matching
underscript.item, orundefinedif there isn’t one. - isItem
trueif the value is an item, or the text for one.- getPriority
- Returns the matching
underscript.priority, orundefinedif there isn’t one. - isPriority
trueif the value is a priority, or the text for one.- getRarity
- Returns the matching
underscript.rarity, orundefinedif there isn’t one. - isRarity
trueif the value is a rarity, or the text for one.
Examples
const { constants, item } = underscript;
constants.getItem('gold') === item.GOLD; // true
constants.isItem('not an item'); // false
constants.getPriority('high') === underscript.priority.HIGH; // true
constants.getRarity('DT') === underscript.rarity.DETERMINATION; // true