Socket
Socket
Sign inDemoInstall

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.4.0 to 0.4.1

29

monologue.js

@@ -449,11 +449,11 @@ (function(exports) {

/**
* Escape unsafe characters to avoid sql injection
* Escape unsafe characters to prevent sql injection
*/
escape: function(v) {
if (v === undefined || v === null) {
escape: function( v ) {
if( v === undefined || v === null ) {
return 'NULL';
}
switch (typeof v) {
switch( typeof v ) {
case 'boolean': return (v) ? 'true' : 'false';

@@ -463,4 +463,4 @@ case 'number': return v + '';

v = v.replace(/[\0\n\r\b\t\\\'\"\x1a]/g, function(s) {
switch(s) {
v = v.replace( /[\0\n\r\b\t\\\'\"\x1a]/g, function( s ) {
switch( s ) {
case "\0": return "\\0";

@@ -483,13 +483,18 @@ case "\n": return "\\n";

return col.map(function(v) {
return '`' + v + '`';
});
return ( typeof v === 'object'
? this.backquote(v)
: '`' + v + '`'
);
// maintaining execution scope to avoid setting a var
// (can't wait to upgrade node 4+)
}.bind(this));
}
else if( col === Object(col) ){
var ret = {};
var obj = {};
for( var i in col ) {
ret['`' + i + '`'] = col[i];
obj['`' + i + '`'] = col[i];
}
return ret;
return obj;
}

@@ -504,2 +509,4 @@

if( typeof module !== "undefined" && module.exports ) {

@@ -506,0 +513,0 @@ module.exports = monologue;

{
"name": "monologue",
"version": "0.4.0",
"version": "0.4.1",
"description": "Streamlined MySQL query building",

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

@@ -8,6 +8,8 @@ Monologue - Streamlined query building

The behavior of monologue.backquote() was change for objects. It now returns a copy of the object with the property names backquoted, rather than an array of the property names. See examples below.
The behavior of monologue.backquote() was changed for objects in v0.4.0. It now returns a copy of the object with the property names backquoted, rather than an array of the property names. See examples below.
No liability is assumed, test your SQL output THOROUGHLY! It is possible bugs may exist which could result in unsafe SQL statements. Please report bugs to the github repository
Test your SQL output! It is possible bugs may exist which could result in unsafe SQL statements. Please report bugs to the github repository
This library is not necessarily exhaustive in representing MySQL, so if there are language features you would like to see added, submit a request or pull request on github.
**Install**

@@ -14,0 +16,0 @@

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