# odata-parser

> OData query string parser

Latest version **1.4.1** (published 2016-04-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install odata-parser
pnpm add odata-parser
yarn add odata-parser
bun add odata-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.1 |
| Published | 2016-04-12 |
| First published | 2012-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 106 |
| Author | auth0 |
| Maintainers | jfromaniello |
| Keywords | odata, parser |

## Links

- npm: https://www.npmjs.com/package/odata-parser
- Repository: https://github.com/auth0/node-odata-parser
- Homepage: https://github.com/auth0/node-odata-parser#readme
- Issues: https://github.com/auth0/node-odata-parser/issues
- npm.io page: https://npm.io/package/odata-parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.4.1 (latest) — 2016-04-12
- 1.4.0 — 2016-04-08
- 1.3.0 — 2016-04-08
- 1.2.1 — 2015-06-15
- 1.2.0 — 2015-01-05
- 1.1.0 — 2015-01-05
- 1.0.0 — 2013-02-25
- 0.0.4 — 2012-12-05
- 0.0.3 — 2012-10-26
- 0.0.2 — 2012-10-25
- 0.0.1 — 2012-10-25

## 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.

---
_Source: https://npm.io/package/odata-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
