What Does it Do?
The query engine is still under active development Performance will continue to improve and language features will continue to be implemented.
Getting started is so easy!
Pre-built version of the parsers are already included, but if you'd like to build them yourself then you can do so by issuing the following command from the package's top-level directory:
npm install; npm run-script build
This will also install any development dependencies and run the nodeunit test suite.
Inclusion in Node.js
Assuming you have installed the junqi package into your project with npm, you can include it in a Node.js module with the following:
var junqi = ;
For access to a specific grammar:
var objeq = objeq;
Performing a First Query
Fire up the Node.js REPL and type the following into the console (minus comments):
// Import the objeq Grammarvar objeq = objeq;// Create a data Array to be queried latervar data =name: 'Barbara' age: 25 gender: 'female'name: 'Ronald' age: 62 gender: 'male'name: 'Robert' age: 54 gender: 'male'name: 'Jessica' age: 48 gender: 'female';// This will compile a junqi query that filters only those// Objects having a name property starting with 'Ro' and then// returns a string that combines name and age propertiesvar query = ;// This performs the query against the 'data' Array and// returns the result in 'res'var res = ;// --> res now contains:// [ 'Ronald is 62 years old',// 'Robert is 54 years old' ]
For more information about how to interact with the junqi library and its API, see the API Reference
For more information about the objeq grammar itself, see the objeq Grammar Reference
Credits and Acknowledgements
This module defines both a Lexer and Grammar that use the Jison Parser Generator
License (MIT License)
Copyright (c) 2013-2014 Thomas S. Bradford
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.