JSVerbalExpressions icon indicating copy to clipboard operation
JSVerbalExpressions copied to clipboard

Remove deprecated .compile() call in .add()

Open crawfordcomeaux opened this issue 11 years ago • 2 comments

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.

crawfordcomeaux avatar Jul 22 '13 00:07 crawfordcomeaux

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.

jehna avatar Jul 22 '13 15:07 jehna

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.

crawfordcomeaux avatar Jul 22 '13 21:07 crawfordcomeaux