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

@simplehealth/filterql

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@simplehealth/filterql - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# v0.2.3
- Fix: properly quote MySQL identifiers (table and/or column names)
- Fix: `OR()` signature is now consistent with `AND()`
# v0.2.2

@@ -2,0 +7,0 @@

2

package.json
{
"name": "@simplehealth/filterql",
"version": "0.2.2",
"version": "0.2.3",
"description": "The FilterQL mini-language.",

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

@@ -34,11 +34,2 @@ "use strict";

var holeRegex = /\?\??/g;
var fieldRegex = /^([a-z_]+)([.][a-z_]+)?$/i;
function ensureField(field) {
if (!fieldRegex.test(field)) {
throw new Error("Not a valid field name: ".concat(JSON.stringify(field)));
}
return field;
}
/**

@@ -52,3 +43,2 @@ * Core building block for all SQL conditions. Produces a raw SQL / params

function RAW(sqlExpr, params) {

@@ -75,4 +65,4 @@ var match = sqlExpr.match(holeRegex);

return {
sqlExpr: "".concat(ensureField(field), " IS NULL"),
params: []
sqlExpr: '?? IS NULL',
params: [field]
};

@@ -83,4 +73,4 @@ }

return {
sqlExpr: "".concat(ensureField(field), " IS NOT NULL"),
params: []
sqlExpr: '?? IS NOT NULL',
params: [field]
};

@@ -94,11 +84,11 @@ }

// NOT safely.
"".concat(ensureField(field), " <=> ?"), [value]);
'?? <=> ?', [field, value]);
}
function IN(field, values) {
return values.length > 0 ? RAW("".concat(ensureField(field), " IN (?)"), [values]) : FALSE;
return values.length > 0 ? RAW('?? IN (?)', [field, values]) : FALSE;
}
function GTE(field, value) {
return RAW("".concat(ensureField(field), " >= ?"), [value]);
return RAW('?? >= ?', [field, value]);
}

@@ -119,3 +109,3 @@

function INSTR(field, value) {
return RAW("INSTR(".concat(ensureField(field), ", ?)"), [value]);
return RAW('INSTR(??, ?)', [field, value]);
}

@@ -155,3 +145,7 @@

function OR(conditions) {
function OR() {
for (var _len2 = arguments.length, conditions = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
conditions[_key2] = arguments[_key2];
}
if (conditions.length === 0) {

@@ -158,0 +152,0 @@ return FALSE;

Sorry, the diff of this file is not supported yet

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