This Gist was automatically created by Carbide, a free online programming environment.
Last active
October 17, 2018 03:15
-
-
Save carbide-public/daa0da511b1736dffc1fda101079ebb4 to your computer and use it in GitHub Desktop.
untitled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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