odata-query
Advanced tools
Comparing version 5.5.0 to 5.6.0
@@ -178,5 +178,11 @@ 'use strict'; | ||
if (LOGICAL_OPERATORS.indexOf(op) !== -1) { | ||
result.push('(' + _builtFilters.join(' ' + op + ' ') + ')'); | ||
if (_builtFilters.length) { | ||
if (op === 'not') { | ||
result.push(parseNot(op, _builtFilters)); | ||
} else { | ||
result.push('(' + _builtFilters.join(' ' + op + ' ') + ')'); | ||
} | ||
} | ||
} else { | ||
result.push('' + _builtFilters.join(' ' + op + ' ')); | ||
result.push(_builtFilters.join(' ' + op + ' ')); | ||
} | ||
@@ -190,3 +196,7 @@ } | ||
if (_builtFilters2.length) { | ||
result.push(_builtFilters2.join(' ' + _op + ' ')); | ||
if (_op === 'not') { | ||
result.push(parseNot(_op, _builtFilters2)); | ||
} else { | ||
result.push('' + _builtFilters2.join(' ' + _op + ' ')); | ||
} | ||
} | ||
@@ -426,2 +436,16 @@ } else if (value instanceof Object) { | ||
} | ||
} | ||
function parseNot(op, builtFilters) { | ||
if (builtFilters.length > 1) { | ||
return 'not( ' + builtFilters.join(' and ') + ')'; | ||
} else { | ||
return builtFilters.map(function (filter) { | ||
if (filter.charAt(0) === '(') { | ||
return '(not '.concat(filter.substr(1)); | ||
} else { | ||
return 'not '.concat(filter); | ||
} | ||
}); | ||
} | ||
} |
{ | ||
"name": "odata-query", | ||
"version": "5.5.0", | ||
"version": "5.6.0", | ||
"author": "Sean Lynch <techniq35@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
29436
398