We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81e54ed commit 6906172Copy full SHA for 6906172
1 file changed
src/base/api/constants.js
@@ -1,7 +1,18 @@
1
import * as api from 'src/utils/4.api.js';
2
import Item from 'src/structures/constants/item.js';
3
+import Priority from 'src/structures/constants/priority';
4
5
const constants = api.mod.constants;
-Object.keys(Item).forEach((key) => {
6
- constants[key] = Item[key];
7
-});
+Object.entries(Item).forEach((([key, value]) => {
+ Object.defineProperty(constants, key, {
8
+ get() {
9
+ console.warn(`'underscript.constants.${key}' is deprecated, use 'underscript.items.${key}' instead.`);
10
+ return value;
11
+ },
12
+ });
13
+}));
14
+
15
+constants.getItem = (value) => Item.find(value);
16
+constants.isItem = (other) => Item.find(other) !== undefined;
17
+constants.getPriority = (value) => Priority.find(value);
18
+constants.isPriority = (other) => Priority.find(other) !== undefined;
0 commit comments