Skip to content

Commit

Permalink
add exclusion syntax examples in README
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchen committed Sep 28, 2016
1 parent 2167fac commit b0f164f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ var searchQueryObj = searchQuery.parse(query, options);

You can configure what keywords and ranges the parser should accept with the options argument.
It accepts 2 values:
* `keywords`, that can be separated by commas (,)
* `ranges`, that can be separated by a hyphen (-)
* `keywords`, that can be separated by commas (,)
* `ranges`, that can be separated by a hyphen (-)

Both values take an array of strings, as in the example just above.

Expand All @@ -67,9 +67,20 @@ var parsedQueryWithOptions = searchQuery.parse(query, options);
// parsedQueryWithOptions is now 'a query with just text'
```

You can also use exclusion syntax, like `-from:[email protected] name:hello,world` . And it will return :

```javascript
{
name: ['hello', 'world'],
exclusion: {
from: ['[email protected]']
}
}
```

## Testing

The 17 tests are written using the BDD testing framework should.js, and run with mocha.
The 20 tests are written using the BDD testing framework should.js, and run with mocha.

Run `npm install should` and `npm install -g mocha` to install them both.

Expand Down

0 comments on commit b0f164f

Please sign in to comment.