jqljs
v0.3.2
Published
[![npm version](https://badge.fury.io/js/jqljs.svg)](https://badge.fury.io/js/jqljs) [![Travis Status](https://travis-ci.org/zapkub/JQLjs.svg?branch=master)](https://travis-ci.org/zapkub/JQLjs) [![Coverage Status](https://coveralls.io/repos/github/earthch
Downloads
511
Readme
jqljs
Query json structure in SQL-like manners
Usage
with npm/commonjs/webpack
$ npm install jqljs --save
const JQL = require('jqljs');
const collection = new JQL([/** your data */]);
// create query
const query = collection.select('*').where('name').match('^jo', 'i');
// result here
const result = query.fetch();
or with legacy script tag
<script src="dist/jql.min.js" type="text/javascript"></script>
<script type="text/javascript">
var data = [{
name: 'John',
room: 101
},{
name: 'Jane',
room: 201
},{
name: 'Joe',
room: 102
},{
name: 'June',
room: 202
}];
var data = new JQL(data); // accept either json string or object literal
console.log(data.select('*').where('name').match('^jo','i').orderBy('room desc').fetch());
console.log(data.select('*').where('room').lessThan(200).orderBy('name').fetch());
</script>
Limitation
or
conditions are not support yet
TODO
- [ ] refactor legacy code
- [ ] coverage 80%++
Development
NOTE: commitizen welcome please read Commitizen
$ npm install
$ npm test -- --watch // for TDD development
$ npm run build // bundle
$ npm run commit // commit change in commitizen
$ npm run release // bump version and changelog
Note: NPM support added by zapkub, Thanks!
License
WTFPL 2.0 http://www.wtfpl.net/