queryfilters
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -18,1 +18,2 @@ # Version 1.0 | ||
- auto prepend _embedded if not spcified | ||
- allow also `filtering_or` operator |
function Combinators () { | ||
const COMBINATORS_AND = 'and'; | ||
const COMBINATORS_DEFAULT = 'filtering'; | ||
const COMBINATORS_FILTERING_OR = 'filtering_or'; | ||
const COMBINATORS_OR = 'or'; | ||
@@ -10,2 +11,3 @@ | ||
COMBINATORS_DEFAULT, | ||
COMBINATORS_FILTERING_OR, | ||
COMBINATORS_OR | ||
@@ -192,2 +194,11 @@ ]; | ||
this.keepDefaultCombinator = function () { | ||
return this; | ||
} | ||
this.keepOrFilteringCombinator = function () { | ||
this.setCombinator('filtering_or'); | ||
return this; | ||
} | ||
this.json = function (jsonQuery) { | ||
@@ -194,0 +205,0 @@ var fields = jsonQuery; |
{ | ||
"name": "queryfilters", | ||
"version": "v0.2.6", | ||
"version": "v0.2.7", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "test": "jest" |
const QueryQl = require('./../lib/queryql'); | ||
test('apply filters with default operator', () => { | ||
var queryQl = new QueryQl() | ||
queryQl.applyFilter({ field: '_embedded.relation.nick', value: '@sensorario' }); | ||
queryQl.applyFilter({ field: '_embedded.foo.bar.name', value: 'Simone' }); | ||
expect(queryQl.keepDefaultCombinator().getQueryString()).toEqual( | ||
'rel=relation,foo,bar' | ||
+ '&filtering[_embedded.relation.nick]=@sensorario' | ||
+ '&filtering[_embedded.foo.bar.name]=Simone' | ||
); | ||
}); | ||
test('apply filters with or filtering operator', () => { | ||
var queryQl = new QueryQl() | ||
queryQl.applyFilter({ field: '_embedded.relation.nick', value: '@sensorario' }); | ||
queryQl.applyFilter({ field: '_embedded.foo.bar.name', value: 'Simone' }); | ||
expect(queryQl.keepOrFilteringCombinator().getQueryString()).toEqual( | ||
'rel=relation,foo,bar' | ||
+ '&filtering_or[_embedded.relation.nick]=@sensorario' | ||
+ '&filtering_or[_embedded.foo.bar.name]=Simone' | ||
); | ||
}); | ||
test('apply filters with or operator', () => { | ||
@@ -4,0 +26,0 @@ var queryQl = new QueryQl() |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
24226
487