Chain queries onto POJOs to return precise results.
Find a file
2017-08-17 18:17:06 -05:00
.gitignore v1.0.0 2017-05-26 06:19:13 -05:00
.travis.yml v1.0.0 2017-05-26 06:19:13 -05:00
index.js Search works with any length of term 2017-08-17 18:01:46 -05:00
index.test.js Test to prove sorting by integer works 2017-08-17 18:17:06 -05:00
package.json 1.1.1 2017-08-17 18:02:06 -05:00
README.md Test to prove sorting by integer works 2017-08-17 18:17:06 -05:00
testdata.json Test to prove sorting by integer works 2017-08-17 18:17:06 -05:00

json-query-chain

Build Status npm version

Chain queries onto POJOs to return precise results.

Usage

import Query from 'json-query-chain';

let myQ = new Query(someJsonData)
.search('isActiveUser', true)
.results;

Chainable Methods

Currently supports booleans and strings. (See #1 for Integer Support)

By Boolean
.search('isActiveUser', true)
By String
.search('name', 'steele')

Sort

By Boolean
.sort('isActiveUser', true)
By String
.sort('name')
By Number
.sort('netWorth')

Pagination

Page 1 with 5 results per page.

.paginate(1, 5)

Page 2 wtih default of 10 results per page.

.paginate(2)

Tests

npm test runs tests through Jest