Socket
Socket
Sign inDemoInstall

json-sql

Package Overview
Dependencies
1
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.13 to 0.5.0

10

lib/dialects/postgresql/blocks.js

@@ -12,5 +12,9 @@ 'use strict';

if (_.isArray(value)) {
result = 'array[' + _(value).map(function(item) {
return dialect.builder._pushValue(item);
}).join(', ') + ']';
if (value.length) {
result = 'array[' + _(value).map(function(item) {
return dialect.builder._pushValue(item);
}).join(', ') + ']';
} else {
result = dialect.builder._pushValue('{}');
}
} else if (_.isObject(value)) {

@@ -17,0 +21,0 @@ result = dialect.builder._pushValue(JSON.stringify(value));

@@ -58,2 +58,23 @@ 'use strict';

});
dialect.operators.comparison.add('$arrayContains', {
defaultFetchingOperator: '$array',
fn: function(field, value) {
return buildComparisonCondition(field, '@>', value);
}
});
dialect.operators.comparison.add('$arrayIn', {
defaultFetchingOperator: '$array',
fn: function(field, value) {
return buildComparisonCondition(field, '<@', value);
}
});
dialect.operators.comparison.add('$arrayOverlap', {
defaultFetchingOperator: '$array',
fn: function(field, value) {
return buildComparisonCondition(field, '&&', value);
}
});
};
'use strict';
var _ = require('underscore');
module.exports = function(dialect) {

@@ -10,2 +12,11 @@ dialect.operators.fetching.add('$json', {

});
dialect.operators.fetching.add('$array', {
fn: function(value) {
if (!_.isArray(value)) {
value = [value];
}
return dialect.buildBlock('term', {term: value, type: 'value'});
}
});
};
{
"name": "json-sql",
"description": "node.js json to sql queries mapper",
"version": "0.4.13",
"version": "0.5.0",
"author": "Artem Zhukov <artzhuchka@gmail.com>",

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc