fltrjson
v0.2.2
Published
mongodb like json query language
Downloads
10
Readme
let fltr = require('fltrjson')
Installation
$ npm install fltrjson
Features
- Filter JSON with MongoDB like Queries
- Promised Matching
- Streamed Matching
- Numbers
- Strings
- Dates
- Arrays
- Objects
Examples
Simple Promised Matching
let fltr = require('fltrjson');
let query = {
count: {
$gt: 3,
$lt: 9
}
};
let json = { count: 6 };
new fltr(query).match(json)
.then(()=> {
console.log('Yay!');
})
.catch(()=> {
console.err('Oh noes!');
});
//=> Yay!
Simple Stream Matching
let fs = require('fs'),
fltr = require('fltrjson');
let query = {
count: {
$gt: 3,
$lt: 9
}
};
let logFileStream = fs.createReadStream('/var/log/myLogFile.log');
new fltr(query).on('match', (match)=> {
if (match) {
console.log('Yay!');
}
}).match(logFileStream);