Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-query-params

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-query-params - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

.travis.yml

4

lib/params.js

@@ -49,2 +49,4 @@ 'use strict';

parsed[p] = query[p] === 'true' ? true : false;
} else if (query[p][0] === '^') {
parsed[p] = new RegExp(query[p] + '$', 'i');
} else {

@@ -77,2 +79,4 @@ parsed[p] = query[p];

parsed += p + ' ' + operator + ' ' + typeCast(query[p].split(operator).join(''));
} else if (query[p][0] === '^') {
parsed += p + ' ILIKE `' + query[p].slice(1) + '`';
} else {

@@ -79,0 +83,0 @@ parsed += p + ' = `' + query[p] + '`';

5

package.json
{
"name": "express-query-params",
"version": "0.2.0",
"version": "0.3.0",
"description": "Express.js middleware implementing the API Query Spec, converting the params to SQL or a Mongo query",
"main": "index.js",
"scripts": {
"test": "mocha"
"test": "mocha",
"package:update": "npm outdated --depth=0 | grep -v Package | awk '{print $1}' | xargs -I% npm install %@latest --save"
},

@@ -9,0 +10,0 @@ "repository": {

@@ -24,2 +24,4 @@ # 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

@@ -26,0 +28,0 @@

@@ -21,3 +21,4 @@ 'use strict';

banned: 'false',
activated: 'true'
activated: 'true',
firstName: '^Steve'
}

@@ -73,2 +74,6 @@ };

});
it('parses a case-insensitive query properly', function() {
expect(request.parsedQuery).to.contain('firstName ILIKE `Steve`');
});
});

@@ -129,2 +134,7 @@

it('parses a case-insensitive query properly', function() {
expect(request.parsedQuery.firstName).to.be.instanceof(RegExp)
expect(request.parsedQuery.firstName.toString()).to.equal((/^Steve$/i).toString());
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc