ts-dynamic-query
Advanced tools
Comparing version 1.0.35 to 1.0.36
@@ -52,3 +52,15 @@ /** | ||
*/ | ||
BETWEEN = 11 | ||
BETWEEN = 11, | ||
/** | ||
* field & value > 0 | ||
*/ | ||
BITWISE_ANY = 12, | ||
/** | ||
* field & value = 0 | ||
*/ | ||
BITWISE_ZERO = 13, | ||
/** | ||
* field & value = value | ||
*/ | ||
BITWISE_ALL = 14 | ||
} |
@@ -56,3 +56,15 @@ "use strict"; | ||
FilterOperator[FilterOperator["BETWEEN"] = 11] = "BETWEEN"; | ||
/** | ||
* field & value > 0 | ||
*/ | ||
FilterOperator[FilterOperator["BITWISE_ANY"] = 12] = "BITWISE_ANY"; | ||
/** | ||
* field & value = 0 | ||
*/ | ||
FilterOperator[FilterOperator["BITWISE_ZERO"] = 13] = "BITWISE_ZERO"; | ||
/** | ||
* field & value = value | ||
*/ | ||
FilterOperator[FilterOperator["BITWISE_ALL"] = 14] = "BITWISE_ALL"; | ||
})(FilterOperator = exports.FilterOperator || (exports.FilterOperator = {})); | ||
//# sourceMappingURL=filterOperator.js.map |
@@ -20,2 +20,5 @@ import { FilterDescriptor } from "../models/filterDescriptor"; | ||
static predicateNotIn<T>(obj: T, propertyPath: string, filterValue: any): boolean; | ||
static predicateBitwiseAny<T>(obj: T, propertyPath: string, filterValue: any): boolean; | ||
static predicateBitwiseZero<T>(obj: T, propertyPath: string, filterValue: any): boolean; | ||
static predicateBitwiseAll<T>(obj: T, propertyPath: string, filterValue: any): boolean; | ||
static getFilterValues(operator: FilterOperator, filterValue: any): any[]; | ||
@@ -22,0 +25,0 @@ static getRealFilters<T>(filters: FilterDescriptorBase[]): FilterDescriptorBase[]; |
@@ -91,4 +91,9 @@ "use strict"; | ||
var filterValues = this.getFilterValues(filterOperator_1.FilterOperator.BETWEEN, filterValue); | ||
return (this.predicateGreaterThanOrEqual(obj, propertyPath, filterValues[0]) && | ||
this.predicateLessThanOrEqual(obj, propertyPath, filterValues[1])); | ||
return (this.predicateGreaterThanOrEqual(obj, propertyPath, filterValues[0]) && this.predicateLessThanOrEqual(obj, propertyPath, filterValues[1])); | ||
case filterOperator_1.FilterOperator.BITWISE_ANY: | ||
return this.predicateBitwiseAny(obj, propertyPath, filterValue); | ||
case filterOperator_1.FilterOperator.BITWISE_ZERO: | ||
return this.predicateBitwiseZero(obj, propertyPath, filterValue); | ||
case filterOperator_1.FilterOperator.BITWISE_ALL: | ||
return this.predicateBitwiseAll(obj, propertyPath, filterValue); | ||
default: | ||
@@ -179,2 +184,14 @@ return false; | ||
}; | ||
FilterHelper.predicateBitwiseAny = function (obj, propertyPath, filterValue) { | ||
var propValue = obj[propertyPath]; | ||
return (propValue & filterValue) > 0; | ||
}; | ||
FilterHelper.predicateBitwiseZero = function (obj, propertyPath, filterValue) { | ||
var propValue = obj[propertyPath]; | ||
return (propValue & filterValue) === 0; | ||
}; | ||
FilterHelper.predicateBitwiseAll = function (obj, propertyPath, filterValue) { | ||
var propValue = obj[propertyPath]; | ||
return (propValue & filterValue) === filterValue; | ||
}; | ||
FilterHelper.getFilterValues = function (operator, filterValue) { | ||
@@ -181,0 +198,0 @@ var result = []; |
{ | ||
"name": "ts-dynamic-query", | ||
"version": "1.0.35", | ||
"version": "1.0.36", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
79260
1169