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

hapiest-mysql

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapiest-mysql - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

9

lib/mysqlDaoQueryHelper.js

@@ -151,4 +151,4 @@ 'use strict';

// Automatically drop Array, Objects, undefined which makes saves times mapping stuff when you have a complicated object structure group multiple tables
if (_.includes(['string', 'number', 'boolean'], typeof(uncleanValue)) || uncleanValue === null) {
// Automatically drop Array, Objects which makes saves times mapping stuff when you have a complicated object structure group multiple tables
if (_.includes(['string', 'number', 'boolean', 'undefined'], typeof(uncleanValue)) || uncleanValue === null) {
const snakeCaseProperty = _.snakeCase(property);

@@ -160,3 +160,4 @@

} else {
cleanValue = this._clean(uncleanValue);
const valueToClean = typeof(uncleanValue) === 'undefined' ? null : uncleanValue;
cleanValue = this._clean(valueToClean);
}

@@ -178,3 +179,3 @@

if (uncleanValue === null) {
if (uncleanValue === null || typeof(uncleanValue) === 'undefined') {
sqlObject = sqlObject.where(`${columnName} IS NULL`);

@@ -181,0 +182,0 @@ } else {

{
"name": "hapiest-mysql",
"version": "0.0.14",
"version": "0.0.15",
"description": "A wrapper around mysql that provides a very descriptive way of running queries.",

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

@@ -243,2 +243,16 @@ 'use strict';

it('Convert undefined value to null', function() {
const someObj = {firstName: 'John', lastName: 'Doe'};
const output = mysqlDaoQueryHelper._cleanAndMapValues({
firstName: someObj.firstName,
lastName: someObj.lastName,
password: someObj.password
});
Should.exist(output);
output.should.have.properties(['first_name','last_name','password']);
output.first_name.should.eql("'John'");
output.last_name.should.eql("'Doe'");
output.password.should.eql("NULL");
});
});

@@ -268,4 +282,15 @@

it('Should generate good WHERE clause when input contains undefined value (assumes it means NULL)', function() {
const sqlObj = Squel.select().from('users');
const someObj = {firstName: 'John'};
mysqlDaoQueryHelper._appendWhereClause(sqlObj, {firstName: someObj.firstName, lastName: someObj.lastName});
const sqlString = sqlObj.toString();
sqlString.should.eql("SELECT * FROM users WHERE (first_name = 'John') AND (last_name IS NULL)");
});
});
});
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