@@ -138,8 +138,14 @@ module.exports = function (input) {
138
138
139
139
// if the parenthesis is value of a special operator then push it into 'outputString' buffer
140
140
if ( specialOperator ) {
141
- specialOperator = false ;
142
- outputString += character ;
141
+ if ( outputString [ outputString . length - 1 ] == "\\" ) {
142
+ outputString = outputString . substring ( 0 , outputString . length - 1 ) ;
143
+ outputString += character ;
144
+ }
145
+ else {
146
+ specialOperator = false ;
147
+ outputString += character ;
148
+ }
143
149
}
144
150
// Manage escape character
145
151
else if ( outputString [ outputString . length - 1 ] == "\\" ) {
@@ -293,8 +299,10 @@ module.exports = function (input) {
293
299
mongoOperatorQuery [ exp1 ] = { $lte : typedExp2 } ;
294
300
break ;
295
301
case "=in=" :
296
- typedExp2 = typedExp2 . replace ( "(" , "" ) ;
297
- typedExp2 = typedExp2 . replace ( ")" , "" ) ;
302
+ if ( typedExp2 [ 0 ] == "(" )
303
+ typedExp2 = typedExp2 . slice ( 1 ) ;
304
+ if ( typedExp2 [ typedExp2 . length - 1 ] == ")" )
305
+ typedExp2 = typedExp2 . slice ( 0 , typedExp2 . length - 1 ) ;
298
306
var typedValues = new Array ( ) ;
299
307
for ( var token of typedExp2 . split ( "," ) ) {
300
308
var value = setType ( token . trim ( ) ) ;
@@ -305,8 +313,10 @@ module.exports = function (input) {
305
313
mongoOperatorQuery [ exp1 ] = { $in : typedValues } ;
306
314
break ;
307
315
case "=out=" :
308
- typedExp2 = typedExp2 . replace ( "(" , "" ) ;
309
- typedExp2 = typedExp2 . replace ( ")" , "" ) ;
316
+ if ( typedExp2 [ 0 ] == "(" )
317
+ typedExp2 = typedExp2 . slice ( 1 ) ;
318
+ if ( typedExp2 [ typedExp2 . length - 1 ] == ")" )
319
+ typedExp2 = typedExp2 . slice ( 0 , typedExp2 . length - 1 ) ;
310
320
var typedValues = new Array ( ) ;
311
321
for ( var token of typedExp2 . split ( "," ) ) {
312
322
var value = setType ( token . trim ( ) ) ;
0 commit comments