Skip to content

Commit

Permalink
Added example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
trycatchjames committed Jan 3, 2016
1 parent e0340e5 commit d4154f1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,39 @@
## Install

```sh
npm i -D quri-js
npm i -D quri
```

## QURI Spec

More information about the QURI specification and parser is available [here](https://github.com/theHarvester/QURI).

## Usage

Basic example

```js
import quriJs from "quri-js"
import Criteria from "../src/index.js";

let criteria = new Criteria();

criteria.toString(); // "field_1".eq("my value")
```

Nested example

```js
let criteria = new Criteria();
criteria.appendExpression('field_1', '==', 'outer');

let nestedCriteria = new Criteria('or');
nestedCriteria.appendExpression('field_2', 'like', 'nested%');
nestedCriteria.appendExpression('field_3', 'in', [1,2,3,4]);

criteria.appendCriteria(nestedCriteria);

quriJs() // true
criteria.toString();
// "field_1".eq("outer"),("field_2".eq("nested%")|"field_3".in(1,2,3,4))
```

## License
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"QURI",
"query string"
],
"author": "theHarvester <james.harvey994@gmail.com>",
"author": "James Harvey <james.harvey994@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/theHarvester/quri-js/issues"
Expand Down

0 comments on commit d4154f1

Please sign in to comment.