Add eslint rule: max line length (80)
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
@@ -8,7 +8,8 @@ const minify = require('../utils/minify.utils');
|
||||
async function isAuthed(uuid) { // Needs testing
|
||||
const q = {uuid: uuid};
|
||||
const res = await db.query('users', q);
|
||||
log.out(`authUtils.checkUser: DB Query answer: ${JSON.stringify(res[0])}`, 'dbug');
|
||||
log.out('authUtils.checkUser: DB Query answer: ' +
|
||||
JSON.stringify(res[0]), 'dbug');
|
||||
const authorized = res && res[0] && res[0].domain;
|
||||
if (authorized) db.userAtime(uuid);
|
||||
return authorized;
|
||||
@@ -19,7 +20,8 @@ async function checkRequest(key) {
|
||||
const collection = 'registrations';
|
||||
const query = {uuid: key};
|
||||
const res = await db.query(collection, query);
|
||||
log.out(`authUtils.checkRequest: DB Query result: ${JSON.stringify(res)}`, 'dbug');
|
||||
log.out('authUtils.checkRequest: DB Query result: ' +
|
||||
JSON.stringify(res), 'dbug');
|
||||
const result = res.length > 0 && res[0].time
|
||||
? { result: true, domain: res[0].domain }
|
||||
: { result: false };
|
||||
@@ -44,7 +46,8 @@ async function generateConfirmationEmail(eml, uuid) {
|
||||
html: htmlMin
|
||||
};
|
||||
} catch(err) {
|
||||
log.out('mailServices.generateConfirmationEmail: Error reading templates, $(err)', 'err');
|
||||
log.out('mailServices.generateConfirmationEmail: Error reading template, ' +
|
||||
err, 'err');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ const san = require('../utils/sanitizer.utils'); // Sanitiser
|
||||
|
||||
async function checkCrs(input){
|
||||
var INPUT = input.toUpperCase();
|
||||
log.out(`ldbUtils.checkCrs: Building database query to find: '${INPUT}'`, 'info');
|
||||
var query = {
|
||||
'$or':[
|
||||
{'3ALPHA':INPUT},
|
||||
@@ -13,11 +12,13 @@ async function checkCrs(input){
|
||||
]
|
||||
};
|
||||
var result = await db.query('stations', query);
|
||||
log.out(`ldbUtils.checkCrs: Query results: ${JSON.stringify(result)}`, 'dbug');
|
||||
log.out('ldbUtils.checkCrs: Query results: ' +
|
||||
JSON.stringify(result), 'dbug');
|
||||
return result;
|
||||
}
|
||||
|
||||
async function cleanMessages(input){ // Needs to be moved to the frontend `ensureArray() func`
|
||||
// Needs to be moved to the frontend `ensureArray() func`
|
||||
async function cleanMessages(input){
|
||||
var out = [];
|
||||
if (typeof input.message == 'string') {
|
||||
out.push(await san.cleanNrcc(input.message));
|
||||
@@ -30,7 +31,8 @@ async function cleanMessages(input){ // Needs to be moved to the frontend `ensur
|
||||
}
|
||||
|
||||
// Accepts an object but not an Array and returns it wrapped in an array.
|
||||
async function cleanServices(input){ // Need to triple check but I don't think this is used anymore.
|
||||
// Need to triple check but I don't think this is used anymore.
|
||||
async function cleanServices(input){
|
||||
var out = [];
|
||||
if (!Array.isArray(input)) {
|
||||
log.out(`ldbUtils.cleanServices: Transforming input: ${input}`, 'depr');
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* global process */
|
||||
const environment = process.env.NODE_ENV;
|
||||
|
||||
const hideInProduction = ['info', 'dbug'];
|
||||
|
||||
async function out(msg, level = 'othr') {
|
||||
if (environment === 'production' && hideInProduction.includes(level.toLowerCase())) {
|
||||
if (environment === 'production' &&
|
||||
hideInProduction.includes(level.toLowerCase())) {
|
||||
return;
|
||||
} else {
|
||||
const time = new Date().toISOString();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//const log = require('../utils/log.utils');
|
||||
|
||||
function removeNonAlphanumeric(inputString) { // Should be able to replace sanitizer module
|
||||
function removeNonAlphanumeric(inputString) {
|
||||
return inputString.replace(/[^a-zA-Z0-9]/g, '');
|
||||
}
|
||||
|
||||
function removeNonAlpha(inputString) { // Should be able to replace sanitizer module
|
||||
function removeNonAlpha(inputString) {
|
||||
return inputString.replace(/[^a-zA-Z]/g, '');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user