More style fixes

This commit is contained in:
Timothy Warren 2015-12-08 10:40:52 -05:00
parent dd4d7e2db0
commit c3bb687321
4 changed files with 9 additions and 19 deletions

View File

@ -95,9 +95,9 @@ module.exports = class QueryBuilder {
like = `${field} ${like} ?`;
if (pos == 'before') {
if (pos === 'before') {
val = `%${val}`;
} else if (pos == 'after') {
} else if (pos === 'after') {
val = `${val}%`;
} else {
val = `%${val}%`;
@ -261,12 +261,6 @@ module.exports = class QueryBuilder {
vals = this.state.values.concat(this.state.whereValues);
}
//console.log(this.state);
//console.log(sql);
//console.log(vals);
//console.log(callback);
//console.log('------------------------');
// Reset the state so another query can be built
this._resetState();

View File

@ -35,12 +35,10 @@ module.exports = (function() {
/**
* SQL to insert a group of rows
*
* @param {String} table - The table to insert to
* @param {Array} [data] - The array of object containing data to insert
* @return {void}
* @throws {Error}
*/
driver.insertBatch = function(table, data) {
driver.insertBatch = function() {
throw new Error('Not Implemented');
};

View File

@ -7,8 +7,7 @@
*/
module.exports = (function() {
delete require.cache[require.resolve('../Driver')];
let driver = require('../Driver'),
helpers = require('../helpers');
let driver = require('../Driver');
// Sqlite doesn't have a truncate command
driver.hasTruncate = false;
@ -29,10 +28,7 @@ module.exports = (function() {
vals = [],
cols = [],
fields = [],
first = data.shift(),
params = [],
paramString = '',
paramList = [];
first = data.shift();
data.forEach(obj => {
let row = [];
@ -47,7 +43,7 @@ module.exports = (function() {
// Get the field names from the keys of the first
// object to be inserted
fields = Object.keys(first);
Object.keys(first).forEach(key => {
fields.forEach(key => {
cols.push(`'${driver._quote(first[key])}' AS ${driver.quoteIdentifiers(key)}`);
});

View File

@ -53,7 +53,9 @@ let helpers = {
let output = [];
// Empty case
if (arr.length === 0) return output;
if (arr.length === 0) {
return output;
}
arr.forEach(obj => {
if (! helpers.isUndefined(obj[key])) {