express-query-params
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -47,2 +47,4 @@ 'use strict'; | ||
parsed[p][operator] = typeCast(query[p].split(equal ? '<=' : '<').join('')); | ||
} else if (query[p] === 'true' || query[p] === 'false') { | ||
parsed[p] = query[p] === 'true' ? true : false; | ||
} else { | ||
@@ -49,0 +51,0 @@ parsed[p] = query[p]; |
{ | ||
"name": "express-query-params", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Express.js middleware implementing the API Query Spec, converting the params to SQL or a Mongo query", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,4 +24,2 @@ # Mongo Express Query Params | ||
Inside any downstream middleware, this plugin will create a `parsedQuery` object on the `request`. See the [test](https://github.com/mtimofiiv/express-query-params/blob/master/test/test.js) to see how it works. | ||
## Advanced Usage | ||
@@ -28,0 +26,0 @@ |
@@ -19,3 +19,5 @@ 'use strict'; | ||
friends: '>=5', | ||
followers: '<=10' | ||
followers: '<=10', | ||
banned: 'false', | ||
activated: 'true' | ||
} | ||
@@ -121,2 +123,7 @@ }; | ||
it('parses booleans properly', function() { | ||
expect(request.parsedQuery.activated).to.equal(true); | ||
expect(request.parsedQuery.banned).to.equal(false); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9214
182
61