New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

odata-v4-filter-parser

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

odata-v4-filter-parser

Parse OData $filter syntax into MongoDB syntax in JS

0.0.3
Source
npm
Version published
Weekly downloads
200
11.11%
Maintainers
1
Weekly downloads
 
Created
Source

odata-v4-filter-parser is a JS parser which parses OData V4 $filter syntax in URL into MongoDB syntax.

See

  • OData URL Conventions - System Query Option $filter
  • OData ABNF
  • mongoDB Query

Usage

const { parse } = require('odata-v4-filter-parser');

parse("(status eq Enum.Status'ACTIVE' or status eq Enum.Status'DELETED') and id eq 11 and contains(text, 'aa') and score/overall gt 123");

results in

{
  "$and": [
    {
      "$or": [
        {
          "status": {
            "$eq": "ACTIVE"
          }
        },
        {
          "status": {
            "$eq": "DELETED"
          }
        }
      ]
    },
    {
      "id": {
        "$eq": 11
      }
    },
    {
      "text": {
        "$regex": ".*aa.*"
      }
    },
    {
      "score": {
        "overall": {
          "$gt": 123
        }
      }
    }
  ]
}

Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section.

License

This project is licensed under the MIT license.

FAQs

Package last updated on 29 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts