Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/auth0/node-odata-parser
OData query string parser for node.js.
https://github.com/auth0/node-odata-parser
Last synced: about 2 months ago
JSON representation
OData query string parser for node.js.
- Host: GitHub
- URL: https://github.com/auth0/node-odata-parser
- Owner: auth0
- License: mit
- Archived: true
- Created: 2012-10-25T13:09:29.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-08-15T00:40:54.000Z (about 7 years ago)
- Last Synced: 2024-05-16T23:42:32.212Z (4 months ago)
- Language: JavaScript
- Size: 91.8 KB
- Stars: 106
- Watchers: 118
- Forks: 73
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
OData query string parser for node.js based on [pegjs](http://pegjs.majda.cz/).
[![Build Status](https://travis-ci.org/auth0/node-odata-parser.svg)](https://travis-ci.org/auth0/node-odata-parser)
## Installation
```
npm install odata-parser
```## Usage
```javascript
var parser = require("odata-parser");var ast = parser.parse("$top=10&$skip=5&$select=foo")
util.inspect(ast)
```will result in:
```javascript
{
'$top': 10,
'$skip': 5,
'$select': [ 'foo' ]
}
```Filters like:
```javascript
parser.parse("$filter=Name eq 'John' and LastName lt 'Doe'")
```
results in:```javascript
{
$filter: {
type: 'and',
left: {
type: 'eq',
left: {
type: 'property',
name: 'Name'
},
right: {
type: 'literal',
value: 'John'
}
},
right: {
type: 'lt',
left: {
type: 'property',
name: 'LastName'
},
right: {
type: 'literal',
value: 'Doe'
}
}
}
}
```Using functions in filters
```javascript
parser.parse("$filter=substringof('nginx', Servers)")
```restuls in:
```javascript
{
$filter: {
type: 'functioncall',
func: 'substringof',
args: [{
type: 'literal',
value: 'nginx'
}, {
type: 'property',
name: 'Servers'
}]
}
}
```## Issue Reporting
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
## Author
[Auth0](auth0.com)
## License
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.