JSVerbalExpressions
JSVerbalExpressions copied to clipboard
Remove deprecated .compile() call in .add()
regex.compile is deprecated and isn't supported in Opera.
I'm not sure how to do this without creating a new VerbalExpression object to return every time .add is called, though.
This raises another issue:
var shouldNotChange = VerEx().anyOf("abc");
var variable2 = shouldNotChange.then("def");
( variable == shouldNotChange ) // return true
When we always apply the modification to the current object, the outcome isn't quite logical. In the case above, the shouldNotChange
variable .. should not change in my opinion.
So rather than compiling the original object, we probably should always return a new VerbalExpression object.
I was thinking returning a new VerbEx (who's ready to bikeshed over VerEx vs VerbEx??) object each time would be extraneous, but you're right. Makes much more sense to always return a new VerbEx.