0.16.0 • Published 9 years ago
queryifyjs v0.16.0
Query library for JS
A No-SQL object query library made for javascript
Install
NPM
- Use:
require('queryifyjs')
- Install:
npm install --save queryifyjs
Bower
- Use:
require('queryifyjs')
- Install:
bower install queryifyjs
Documentation
Usage
var models = [
{name: 'apple'},
{name: 'banana'},
{name: 'pineapple'},
{name: 'strawberry'},
{name: 'orange'},
{name: 'grapefruit'}
];
var criteria = {
name: /apple/, // regexp to match any names with 'apple' in them
$or: { // or
name: 'banana' // match name against 'banana'
}
};
var results = querify.sync.filter(models, criteria);
// produces [{"name":"apple"},{"name":"banana"},{"name":"pineapple"}]
var criteria = {
name: {
$right: 'e' // match the last char in name that contains 'e'
}
};
var results = querify.sync.filter(models, criteria);
// produces [{"name":"apple"},{"name":"pineapple"},{"name":"orange"}]
// direct value queries
var result = querify.sync.filter(["myvalue", 1, 2, 3, etc], {$equals: 'myvalue'});
// promise based example
var criteria = {
name: /an/ // regexp to match any names with 'an'
};
querify.promise.filter(models, criteria)
.then(function(results) {
// produces [{"name":"banana"},{"name":"orange"}]
});
Backers
Maintainers
These amazing people are maintaining this project:
- pflannery (https://github.com/pflannery)
Sponsors
No sponsors yet! Will you be the first?
Contributors
These amazing people have contributed code to this project:
License
Licensed under GNU GPL v3
Copyright © 2014+ pflannery (https://github.com/pflannery)