summaryrefslogtreecommitdiff
path: root/resources/js/classes/utility/ItemCondition.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/js/classes/utility/ItemCondition.js')
-rw-r--r--resources/js/classes/utility/ItemCondition.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/resources/js/classes/utility/ItemCondition.js b/resources/js/classes/utility/ItemCondition.js
new file mode 100644
index 0000000..c8c1fe2
--- /dev/null
+++ b/resources/js/classes/utility/ItemCondition.js
@@ -0,0 +1,18 @@
+class ItemCondition {
+ /**
+ * @param {string} conditionCode
+ */
+ constructor (conditionCode) {
+ this.is = conditionCode.split(' ')[0];
+ this.what = conditionCode.split(' ')[1];
+
+ if (conditionCode.includes(',')) {
+ this.comparator = conditionCode.split(' ')[2].split(',')[0];
+ this.value = conditionCode.split(' ')[2].split(',')[1];
+ }
+
+ else {
+ this.value = conditionCode.split(' ')[2];
+ }
+ }
+}