Socket
Socket
Sign inDemoInstall

like-sql

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.2.0

5

index.js

@@ -88,3 +88,4 @@ class LikeSQL {

insert (table, data) {
insert (table, data, opts) {
const ignore = (opts && opts.ignore) ? ' OR IGNORE' : ''
const cols = Object.keys(data).map(c => '`' + c + '`').join(', ')

@@ -94,3 +95,3 @@ const values = Object.values(data)

const sql = `INSERT INTO \`${table}\` (${cols}) VALUES (${placeholders})`
const sql = `INSERT${ignore} INTO \`${table}\` (${cols}) VALUES (${placeholders})`

@@ -97,0 +98,0 @@ return this._insert ? this._insert(sql, values) : [sql, values]

2

package.json
{
"name": "like-sql",
"version": "0.1.1",
"version": "0.2.0",
"description": "Simple SQL query builder",

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

@@ -62,2 +62,5 @@ const tape = require('tape')

t.deepEqual(output, ['INSERT INTO `users` (`username`, `password`) VALUES (?, ?)', ['joe', '123']])
const output2 = builder.insert('users', { username: 'joe', password: '123' }, { ignore: true })
t.deepEqual(output2, ['INSERT OR IGNORE INTO `users` (`username`, `password`) VALUES (?, ?)', ['joe', '123']])
})

@@ -64,0 +67,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