summaryrefslogtreecommitdiff
path: root/resources/js/classes/utility/ItemCondition.js
blob: c8c1fe2cdb73fdbd54dc4faacb05088d17d74be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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];
    }
  }
}