Socket
Socket
Sign inDemoInstall

named-placeholders

Package Overview
Dependencies
1
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.1.1

5

index.js

@@ -16,2 +16,3 @@ // based on code from Brian White @mscdex mariasql library - https://github.com/mscdex/node-mariasql/blob/master/lib/Client.js#L272-L332

i, chr, inQuote = false, escape = false, qchr, tokens = [], qcnt = 0, fn;
var lastTokenEndPos = 0;

@@ -46,2 +47,3 @@ if (ppos) {

start = end + ppos[0].length;
lastTokenEndPos = start;
}

@@ -53,4 +55,3 @@ curpos = end + ppos[0].length;

if (curpos < query.length)
parts.push(query.substring(curpos));
parts.push(query.substring(lastTokenEndPos));
return [parts, tokens];

@@ -57,0 +58,0 @@ }

2

package.json
{
"name": "named-placeholders",
"version": "1.1.0",
"version": "1.1.1",
"description": "sql named placeholders to unnamed compiler",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -13,2 +13,13 @@ # given input query with named parameters

[ 123, 123, 'Yes!', 'No!' ] ]);
// from https://github.com/sidorares/named-placeholders/issues/2
query = 'SELECT * FROM items WHERE id = :id AND deleted = "0000-00-00 00:00:00"';
compile(query, { id: Number(123) })
.should.eql([ 'SELECT * FROM items WHERE id = ? AND deleted = "0000-00-00 00:00:00"',
[ 123 ] ]);
query = 'SELECT * FROM items WHERE deleted = "0000-00-00 00:00:00" AND id = :id';
compile(query, { id: Number(123) })
.should.eql([ 'SELECT * FROM items WHERE deleted = "0000-00-00 00:00:00" AND id = ?',
[ 123 ] ]);
```

@@ -15,0 +26,0 @@

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