0.16.0 • Published 9 years ago

queryifyjs v0.16.0

Weekly downloads
1
License
GNU GPL v3
Repository
github
Last release
9 years ago

Query library for JS

Build Status NPM version NPM downloads Dependency Status Dev Dependency Status Gratipay donate button

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

Library API

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:

Sponsors

No sponsors yet! Will you be the first?

Gratipay donate button

Contributors

These amazing people have contributed code to this project:

Become a contributor!

License

Licensed under GNU GPL v3

Copyright © 2014+ pflannery (https://github.com/pflannery)

Analytics