Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
feathers-query-filters
Advanced tools
Adds support for special query string params used for filtering data
Adds support for special query string params used for filtering data in FeatherJS
npm install feathers-query-filters --save
This is used internally in service adapters like Feathers MongoDB and Feathers NeDB.
Usage is like so:
var Proto = require('uberproto');
var filter = require('feathers-query-filters');
var CustomService = Proto.extend({
init: function(name, options){
// your custom initialization code
},
find: function(params, callback) {
// Start with finding all, and limit when necessary.
var query = this.db.find({});
// Prepare the special query params.
if (params.query) {
var filters = filter(params.query);
// $select uses a specific find syntax, so it has to come first.
if (filters.$select) {
query = this.db.find(params.query, filters.$select);
} else {
query = this.db.find(params.query);
}
// Handle $sort
if (filters.$sort){
query.sort(filters.$sort);
}
// Handle $limit
if (filters.$limit){
query.limit(filters.$limit);
}
// Handle $skip
if (filters.$skip){
query.skip(filters.$skip);
}
}
// Execute the query
query.exec(function(err, docs) {
if (err) {
return callback(err);
}
return callback(err, docs);
});
},
setup: function(app) {
// Called by feathers.configure()
this.app = app;
this.service = app.service.bind(app);
}
});
module.exports = CustomService;
The following keywords are supported. They are pulled from the query object's conditions and returned so they can be mapped by each adapter in their own way.
v1.5.1 (2016-01-22)
Merged pull requests:
FAQs
Adds support for special query string params used for filtering data
The npm package feathers-query-filters receives a total of 2,003 weekly downloads. As such, feathers-query-filters popularity was classified as popular.
We found that feathers-query-filters demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.