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

monologue

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monologue - npm Package Compare versions

Comparing version 0.6.7 to 0.6.8

69

monologue.js

@@ -67,3 +67,3 @@ (function(exports) {

if( Array.isArray( col ) ) {
if( col instanceof Array ) {
col = col.join( ", " );

@@ -116,11 +116,11 @@ }

Monologue.prototype.rjoin = function ljoin( tbl, stmt ) {
Monologue.prototype.rjoin = function rjoin( tbl, stmt ) {
return this.join( 'RIGHT', tbl, stmt );
};
Monologue.prototype.lojoin = function ljoin( tbl, stmt ) {
Monologue.prototype.lojoin = function lojoin( tbl, stmt ) {
return this.join( 'LEFT OUTER', tbl, stmt );
};
Monologue.prototype.rojoin = function ljoin( tbl, stmt ) {
Monologue.prototype.rojoin = function rojoin( tbl, stmt ) {
return this.join( 'RIGHT OUTER', tbl, stmt );

@@ -144,3 +144,3 @@ };

// if it's not a nested array, cheat and make it one
if( ! Array.isArray( p ) ) {
if( ! ( p instanceof Array ) ) {
p = [p];

@@ -210,4 +210,3 @@ }

// check if a previous where statement has been set and glue it
// all together
// check if a previous where statement has been set and glue it all together
this.parts.where = ( this.parts.where.length > 0

@@ -275,3 +274,3 @@ ? this.parts.where + sep + wh

if( Array.isArray( grp ) )
if( grp instanceof Array )
grp = grp.join( ', ' );

@@ -306,3 +305,3 @@

Monologue.prototype.condition = function condition(cond, sep) {
if( Array.isArray( cond ) && Object(cond[0]) === cond[0] ) {
if( cond instanceof Array && Object(cond[0]) === cond[0] ) {
cond.forEach(function(v, k, arr) {

@@ -316,3 +315,3 @@ arr[k] = this.stringify( v ).join(' AND ');

else if( Array.isArray(cond) ) {
else if( cond instanceof Array ) {
cond = cond.join(' OR ');

@@ -340,3 +339,3 @@ }

if( Array.isArray( ord ) )
if( ord instanceof Array )
ord = ord.join( ', ' );

@@ -369,3 +368,3 @@

if( Array.isArray( c ) )
if( c instanceof Array )
c = c.join( ", " );

@@ -387,3 +386,3 @@

if( Array.isArray(p) && Object(p[0]) === p[0] ) {
if( p instanceof Array && Object(p[0]) === p[0] ) {
this.where( p.map(function(v, k) {

@@ -394,3 +393,3 @@ return this.stringify(v, '!=')

else if( Array.isArray(p) ) {
else if( p instanceof Array ) {
this.where( ' NOT' + this.format(p, ''), '' );

@@ -432,3 +431,3 @@ }

if( Array.isArray(p) && Object(p[0]) === p[0] ) {
if( p instanceof Array && Object(p[0]) === p[0] ) {
sep = sep.trim();

@@ -499,3 +498,3 @@

/**
* Takes an object or and array of objects and builds a SQL string
* Takes an object or an array of objects and builds a SQL string
* p: params, s: separator

@@ -509,3 +508,3 @@ */

if( Array.isArray( p ) ) {
if( p instanceof Array ) {
for( var ii = 0, l = p.length; ii < l; ++ii ) {

@@ -568,6 +567,6 @@ // if parent is an array and child is an object,

Monologue.prototype.format = function format( v, k, s ) {
if( Array.isArray(v) ) {
if( v instanceof Array ) {
k = k || '';
var vs = v.map(function(v, k) {
var vs = v.map(function(v) {
return this.escape(v);

@@ -628,3 +627,7 @@ }.bind(this)).join(',');

Monologue.prototype.escape = function escape( val ) {
if( Array.isArray(val) ) {
if( val === undefined || val === null ) {
return 'NULL';
}
if( val instanceof Array ) {
return val.map(function(v) {

@@ -646,6 +649,2 @@ return this.escape(v);

if( val === undefined || val === null ) {
return 'NULL';
}
switch( typeof val ) {

@@ -672,6 +671,6 @@ case 'boolean': return (val ? 'true' : 'false');

Monologue.prototype.backquote = function backquote( col ) {
if( Array.isArray(col) ) {
Monologue.prototype.backquote = function backquote( col, pre ) {
if( col instanceof Array ) {
return col.map(function(v) {
return this.backquote(v);
return this.backquote(v, pre);
// maintaining execution scope to avoid setting a var

@@ -685,3 +684,3 @@ // (can't wait to upgrade node 4+)

for( var i in col ) {
obj[this.backquote(i)] = col[i];
obj[this.backquote(i, pre)] = col[i];
}

@@ -693,8 +692,16 @@

else {
return '`' + col + '`';
if( typeof pre !== 'undefined' ) {
pre += '`.`';
}
else {
pre = '';
}
// return '`' + col.replace(/(\.|\s+)/g, '`$1`') + '`';
return '`' + pre + col + '`';
}
};
Monologue.prototype.prepare = function prepare( p ) {
return this.backquote(this.escape(p));
Monologue.prototype.prepare = function prepare( p, pre ) {
return this.backquote(this.escape(p), pre);
};

@@ -701,0 +708,0 @@

{
"name": "monologue",
"version": "0.6.7",
"version": "0.6.8",
"description": "Streamlined MySQL query building",

@@ -5,0 +5,0 @@ "main": "./monologue.js",

@@ -14,2 +14,4 @@ Monologue - Streamlined query building

[Support Development](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9KXDJTKMBPXTE)
**New features**

@@ -19,6 +21,6 @@

mono().ljoin( table, statment ); // LEFT JOIN
mono().rjoin( table, statment ); // RIGHT JOIN
mono().lojoin( table, statment ); // LEFT OUTER JOIN
mono().rojoin( table, statment ); // RIGHT OUTER JOIN
mono().ljoin( table, statement ); // LEFT JOIN
mono().rjoin( table, statement ); // RIGHT JOIN
mono().lojoin( table, statement ); // LEFT OUTER JOIN
mono().rojoin( table, statement ); // RIGHT OUTER JOIN

@@ -88,4 +90,2 @@

[Support Development](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9KXDJTKMBPXTE)
# API

@@ -92,0 +92,0 @@

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