0.2.2 • Published 7 years ago

fltrjson v0.2.2

Weekly downloads
18
License
-
Repository
github
Last release
7 years ago
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);
0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

8 years ago

0.1.0

8 years ago