Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

odata-query

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

odata-query - npm Package Compare versions

Comparing version 5.4.0 to 5.4.1

66

dist/index.js

@@ -177,35 +177,39 @@ 'use strict';

} else if (value instanceof Object) {
var operators = Object.keys(value);
operators.forEach(function (op) {
if (COMPARISON_OPERATORS.indexOf(op) !== -1) {
result.push(propName + ' ' + op + ' ' + handleValue(value[op]));
} else if (LOGICAL_OPERATORS.indexOf(op) !== -1) {
if (Array.isArray(value[op])) {
result.push(value[op].map(function (v) {
return '(' + buildFilter(v, propName) + ')';
}).join(' ' + op + ' '));
if ('type' in value) {
result.push(propName + ' eq ' + handleValue(value));
} else {
var operators = Object.keys(value);
operators.forEach(function (op) {
if (COMPARISON_OPERATORS.indexOf(op) !== -1) {
result.push(propName + ' ' + op + ' ' + handleValue(value[op]));
} else if (LOGICAL_OPERATORS.indexOf(op) !== -1) {
if (Array.isArray(value[op])) {
result.push(value[op].map(function (v) {
return '(' + buildFilter(v, propName) + ')';
}).join(' ' + op + ' '));
} else {
result.push('(' + buildFilter(value[op], propName) + ')');
}
} else if (COLLECTION_OPERATORS.indexOf(op) !== -1) {
var lambaParameter = filterKey[0].toLowerCase();
var filter = buildFilter(value[op], lambaParameter);
if (filter !== undefined) {
// Do not apply collection filter if undefined (ex. ignore `Foo: { any: {} }`)
result.push(propName + '/' + op + '(' + lambaParameter + ':' + filter + ')');
}
} else if (op === 'in') {
// Convert `{ Prop: { in: [1,2,3] } }` to `(Prop eq 1 or Prop eq 2 or Prop eq 3)`
result.push('(' + value[op].map(function (v) {
return propName + ' eq ' + handleValue(v);
}).join(' or ') + ')');
} else if (BOOLEAN_FUNCTIONS.indexOf(op) !== -1) {
// Simple boolean functions (startswith, endswith, contains)
result.push(op + '(' + propName + ',' + handleValue(value[op]) + ')');
} else {
result.push('(' + buildFilter(value[op], propName) + ')');
// Nested property
result.push(buildFilter(value, propName));
}
} else if (COLLECTION_OPERATORS.indexOf(op) !== -1) {
var lambaParameter = filterKey[0].toLowerCase();
var filter = buildFilter(value[op], lambaParameter);
if (filter !== undefined) {
// Do not apply collection filter if undefined (ex. ignore `Foo: { any: {} }`)
result.push(propName + '/' + op + '(' + lambaParameter + ':' + filter + ')');
}
} else if (op === 'in') {
// Convert `{ Prop: { in: [1,2,3] } }` to `(Prop eq 1 or Prop eq 2 or Prop eq 3)`
result.push('(' + value[op].map(function (v) {
return propName + ' eq ' + handleValue(v);
}).join(' or ') + ')');
} else if (BOOLEAN_FUNCTIONS.indexOf(op) !== -1) {
// Simple boolean functions (startswith, endswith, contains)
result.push(op + '(' + propName + ',' + handleValue(value[op]) + ')');
} else {
// Nested property
result.push(buildFilter(value, propName));
}
});
});
}
} else if (value === undefined) {

@@ -212,0 +216,0 @@ // Ignore/omit filter if value is `undefined`

{
"name": "odata-query",
"version": "5.4.0",
"version": "5.4.1",
"author": "Sean Lynch <techniq35@gmail.com>",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc