hapiest-mysql
Advanced tools
Comparing version 0.0.19 to 0.0.20
@@ -94,3 +94,3 @@ 'use strict'; | ||
let cleanValue = null; | ||
if (_.includes(['current_timestamp','now()'],_.toLower(uncleanValue))) { | ||
if (_.includes(['current_timestamp','now()','is null', 'is not null'],_.toLower(uncleanValue))) { | ||
cleanValue = uncleanValue; | ||
@@ -97,0 +97,0 @@ } else { |
{ | ||
"name": "hapiest-mysql", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"description": "A wrapper around mysql that provides a very descriptive way of running queries.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -470,2 +470,14 @@ 'use strict'; | ||
nowClean.should.eql("'NOW()'"); | ||
const isNullUnclean = "IS NULL"; | ||
const isNullClean = userDao.clean(isNullUnclean); | ||
Should.exist(isNullClean); | ||
isNullClean.should.eql("'IS NULL'"); | ||
const isNotNullUnclean = "IS NOT NULL"; | ||
const isNotNullClean = userDao.clean(isNotNullUnclean); | ||
Should.exist(isNotNullClean); | ||
isNotNullClean.should.eql("'IS NOT NULL'"); | ||
}); | ||
@@ -495,2 +507,14 @@ }); | ||
nowClean.should.eql("NOW()"); | ||
const isNullUnclean = "IS NULL"; | ||
const isNullClean = userDao.cleanSpecial(isNullUnclean); | ||
Should.exist(isNullClean); | ||
isNullClean.should.eql("IS NULL"); | ||
const isNotNullUnclean = "IS NOT NULL"; | ||
const isNotNullClean = userDao.cleanSpecial(isNotNullUnclean); | ||
Should.exist(isNotNullClean); | ||
isNotNullClean.should.eql("IS NOT NULL"); | ||
}); | ||
@@ -497,0 +521,0 @@ }); |
@@ -176,2 +176,14 @@ 'use strict'; | ||
nowClean.should.eql("'NOW()'"); | ||
const isNullUnclean = "IS NULL"; | ||
const isNullClean = mysqlDaoQueryHelper.clean(isNullUnclean); | ||
Should.exist(isNullClean); | ||
isNullClean.should.eql("'IS NULL'"); | ||
const isNotNullUnclean = "IS NOT NULL"; | ||
const isNotNullClean = mysqlDaoQueryHelper.clean(isNotNullUnclean); | ||
Should.exist(isNotNullClean); | ||
isNotNullClean.should.eql("'IS NOT NULL'"); | ||
}); | ||
@@ -201,2 +213,14 @@ }); | ||
nowClean.should.eql("NOW()"); | ||
const isNullUnclean = "IS NULL"; | ||
const isNullClean = mysqlDaoQueryHelper.cleanSpecial(isNullUnclean); | ||
Should.exist(isNullClean); | ||
isNullClean.should.eql("IS NULL"); | ||
const isNotNullUnclean = "IS NOT NULL"; | ||
const isNotNullClean = mysqlDaoQueryHelper.cleanSpecial(isNotNullUnclean); | ||
Should.exist(isNotNullClean); | ||
isNotNullClean.should.eql("IS NOT NULL"); | ||
}); | ||
@@ -267,7 +291,9 @@ }); | ||
it('Allows special value CURRENT_TIMESTAMP and does not escape with quotes', function() { | ||
it('Allows special values (CURRENT_TIMESTAMP, NOW(), IS NULL, IS NOT NULL) and does not escape with quotes', function() { | ||
const output = mysqlDaoQueryHelper._cleanAndMapValues({ | ||
firstName: 'firstName', | ||
dateCreated: 'CURRENT_TIMESTAMP', | ||
dateAgain: 'NOW()' | ||
dateAgain: 'NOW()', | ||
someNullField: 'IS NULL', | ||
nonNullField: 'IS NOT NULL' | ||
}); | ||
@@ -279,9 +305,13 @@ Should.exist(output); | ||
output.date_again.should.eql("NOW()"); | ||
output.some_null_field.should.eql("IS NULL"); | ||
output.non_null_field.should.eql("IS NOT NULL"); | ||
}); | ||
it('Escapes special value CURRENT_TIMESTAMP when explicitly asked', function() { | ||
it('Escapes special values (CURRENT_TIMESTAMP, NOW(), IS NULL, IS NOT NULL) when explicitly asked', function() { | ||
const output = mysqlDaoQueryHelper._cleanAndMapValues({ | ||
firstName: 'firstName', | ||
dateCreated: 'CURRENT_TIMESTAMP', | ||
dateAgain: 'NOW()' | ||
dateAgain: 'NOW()', | ||
someNullField: 'IS NULL', | ||
nonNullField: 'IS NOT NULL' | ||
}, {dontCleanMysqlFunctions: false}); | ||
@@ -293,2 +323,4 @@ Should.exist(output); | ||
output.date_again.should.eql("'NOW()'"); | ||
output.some_null_field.should.eql("'IS NULL'"); | ||
output.non_null_field.should.eql("'IS NOT NULL'"); | ||
}); | ||
@@ -295,0 +327,0 @@ |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
136987
3081
0