Fixed eslint errors
This commit is contained in:
parent
bb4eb3832f
commit
3072632d8d
7 changed files with 73 additions and 74 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue