Socket
Socket
Sign inDemoInstall

minus-query

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    minus-query

decode/encode query string prepended with sequelize or mongo comparison operators


Version published
Weekly downloads
3
decreased by-90.32%
Maintainers
1
Install size
2.27 kB
Created
Weekly downloads
 

Readme

Source

decode/encode query string prepended with sequelize or mongo/mongoose comparison operators

Sample (in express environment):

const minusQuery = requrie('minus-query')

app.use('/items', (req, res, next) => {
  const decoded = minusQuery.decode(req.query);
  model.find(decoded, {raw: true})
    .then(items => res.json(items))
    .catch(next)
})

In the example above the URL like: /items?eq-name=John&gte-age=30 would return all Johns who have their age greater or equal 30, by decoding the query parameters into where-expression like:

{
  name: {$eq: 'John'},
  age: {$gte: '30'}}
}

Keywords

FAQs

Last updated on 22 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc