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

sqb

Package Overview
Dependencies
Maintainers
1
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqb - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

lib/helpers/helpers.js

22

lib/core/conditiongroup.js

@@ -12,5 +12,6 @@ /* SQB.js

const SqlObject = require('./abstract');
const Condition = require('./condition');
const isPlainObject = require('../helpers/helpers').isPlainObject;
/**

@@ -23,3 +24,3 @@ * @class

constructor(src) {
constructor(...src) {
super();

@@ -29,11 +30,16 @@ this._items = [];

if (arguments.length > 0)
this.add.apply(this, arguments);
this.add(...src);
}
add(arr) {
for (let i = 0; i < arguments.length; i++) {
let arg = arguments[i];
if (!(arg.isCondition || arg.isConditionGroup || arg.isRaw))
throw new Error('Only array of Condition instance allowed');
this._items.push(arg);
let self = this;
for (let arg of arguments) {
if (arg.isCondition || arg.isConditionGroup || arg.isRaw)
self._items.push(arg);
else if (isPlainObject(arg)) {
Object.getOwnPropertyNames(arg).forEach(function (key) {
self._items.push(new Condition(key, arg[key]))
});
}
else throw new Error('Only array of Condition instance allowed');
}

@@ -40,0 +46,0 @@ }

@@ -36,4 +36,4 @@ /* SQB.js

if (!columns) return this;
for (let i = 0; i < arguments.length; i++)
this._columns.push(new Column(arguments[i]));
for (let arg of arguments)
this._columns.push(new Column(arg));
return this;

@@ -40,0 +40,0 @@ }

@@ -108,4 +108,11 @@ /* SQB.js

if (!columns) return this;
for (let i = 0; i < arguments.length; i++)
this._columns.push(arguments[i] instanceof SqlObject ? arguments[i] : new Column(arguments[i]));
let self = this;
for (let arg of arguments) {
if (Array.isArray(arg)) {
arg.forEach(function (item) {
self.columns(item);
})
} else
this._columns.push(arg instanceof SqlObject ? arg : new Column(arg));
}
return this;

@@ -121,8 +128,4 @@ }

if (!table) return this;
for (let i = 0; i < arguments.length; i++)
this._tables.push(
arguments[i].isSelect ||
arguments[i].isRaw
? arguments[i] :
new Table(String(arguments[i])));
for (let arg of arguments)
this._tables.push(arg.isSelect || arg.isRaw ? arg : new Table(String(arg)));
return this;

@@ -138,6 +141,8 @@ }

if (!joins) return this;
for (let i = 0; i < arguments.length; i++) {
if (!(arguments[i] instanceof Join))
for (let arg of arguments) {
if (arg instanceof Join)
this._joins.push(arg);
else
throw new TypeError('Invalid argument in method "join"');
this._joins.push(arguments[i]);
}

@@ -167,5 +172,4 @@ return this;

if (!fields) return this;
for (let i = 0; i < arguments.length; i++)
this._groupby.push(arguments[i].isRaw ? arguments[i] :
new Column(String(arguments[i])));
for (let arg of arguments)
this._groupby.push(arg.isRaw ? arg : new Column(String(arg)));
return this;

@@ -182,4 +186,4 @@ }

if (!fields) return this;
for (let i = 0; i < arguments.length; i++)
this._orderby.push(arguments[i].isRaw ? arguments[i] : new Order(String(arguments[i])));
for (let arg of arguments)
this._orderby.push(arg.isRaw ? arg : new Order(String(arg)));
return this;

@@ -186,0 +190,0 @@ }

{
"name": "sqb",
"description": "Lightweight, multi-dialect SQL query builder for JavaScript",
"version": "0.0.18",
"version": "0.0.19",
"author": "Panates Ltd.",

@@ -6,0 +6,0 @@ "contributors": [

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