Skip to content

Instantly share code, notes, and snippets.

@carbide-public
Last active October 17, 2018 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carbide-public/daa0da511b1736dffc1fda101079ebb4 to your computer and use it in GitHub Desktop.
Save carbide-public/daa0da511b1736dffc1fda101079ebb4 to your computer and use it in GitHub Desktop.
untitled
let str = "date(localdatetime(flags.gears.navigation.start:scenario-scenario11)) = 8"
const operators = ['=', '>=', '>', '<=', '<', '!=']
class FilterExclusionCondition {
constructor() {
this.condition = ''
this._splitConditon = []
}
get splitOperator() {
return this._splitConditon
}
set splitOperator(condition) {
this.condition = condition
let res = []
operators.forEach(ope => {
const splitCond = condition.split(ope)
if (splitCond.length === 2) {
this._splitConditon = splitCond
}
})
console.log('--->>', this._splitConditon)
return this._splitConditon
}
}
let spr1 = new FilterExclusionCondition(str)
console.log('---', spr1)
spr1.splitOperator = "date(localdatetime(flags.gears.navigation.start:scenario-scenario11)) = 8"
console.log(spr1.splitOperator())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment