Fixed eslint errors

This commit is contained in:
Tomas Bures 2017-04-23 15:24:31 -04:00
parent bb4eb3832f
commit 3072632d8d
7 changed files with 73 additions and 74 deletions

View file

@ -44,13 +44,13 @@ module.exports.get = (id, callback) => {
const template = tools.convertKeys(rows[0]);
const userFields = template.userFields.trim();
if (userFields != '') {
if (userFields !== '') {
try {
template.userFieldsObject = JSON.parse(userFields);
} catch (err) {
// This is to handle situation when for some reason we get corrupted JSON in the DB.
template.userFieldsObject = {};
template.userFields = "{}";
template.userFields = '{}';
}
} else {
template.userFieldsObject = {};
@ -91,7 +91,7 @@ module.exports.createOrUpdate = (createMode, data, callback) => {
if (key === 'user_fields') {
value = value.trim();
if (value != '') {
if (value !== '') {
try {
JSON.parse(value);
} catch (err) {
@ -129,7 +129,7 @@ module.exports.createOrUpdate = (createMode, data, callback) => {
if (createMode) {
return callback(null, result && result.insertId || false);
} else {
return callback(null, result && result.affectedRows || false)
return callback(null, result && result.affectedRows || false);
}
});
});