Skip to content

Commit ded6404

Browse files
committed
Codacy Fixes
1 parent f2f4e65 commit ded6404

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

services/assistant/v2.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ module.exports = function(RED) {
147147
// Setting the flags this way works as their default
148148
// values are false.
149149
['alternate_intents',
150-
'return_context',
151-
'restart',
152-
'debug'].forEach((f) => {
150+
'return_context',
151+
'restart',
152+
'debug'].forEach((f) => {
153153
checkAndSet(config, params.input.options, f);
154154
if (msg.params) {
155155
checkAndSet(msg.params, params.input.options, f);
@@ -160,7 +160,7 @@ module.exports = function(RED) {
160160
function setParamInputs(msg, params) {
161161
if (msg.params) {
162162
['intents',
163-
'entities'].forEach((f) => {
163+
'entities'].forEach((f) => {
164164
checkAndSet(msg.params, params, f);
165165
});
166166
}

services/language_translator/v3-doc.js

+15-16
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,18 @@ module.exports = function (RED) {
109109
return Promise.resolve();
110110
}
111111

112+
function docID(msg) {
113+
if (msg.payload && 'string' === typeof msg.payload) {
114+
return msg.payload;
115+
}
116+
if (msg.payload &&
117+
'object' === typeof msg.payload &&
118+
msg.payload.document_id) {
119+
return msg.payload.document_id;
120+
}
121+
return config['document-id'];
122+
}
123+
112124
function paramCheck(msg, mode) {
113125
var message = null;
114126
switch (mode) {
@@ -244,7 +256,6 @@ module.exports = function (RED) {
244256
}
245257
resolve();
246258
});
247-
248259
});
249260
}
250261

@@ -268,25 +279,12 @@ module.exports = function (RED) {
268279
function sourceLang(msg) {
269280
if (msg.payload &&
270281
'object' === typeof msg.payload &&
271-
msg.payload.source
272-
) {
282+
msg.payload.source) {
273283
return msg.payload.source;
274284
}
275285
return msg.srclang ? msg.srclang : config.srclang;
276286
}
277287

278-
function docID(msg) {
279-
if (msg.payload && 'string' === typeof msg.payload) {
280-
return msg.payload;
281-
}
282-
if (msg.payload &&
283-
'object' === typeof msg.payload &&
284-
msg.payload.document_id) {
285-
return msg.payload.document_id;
286-
}
287-
return config['document-id'];
288-
}
289-
290288
function executePostRequest(uriAddress, params, msg) {
291289
return new Promise(function resolver(resolve, reject){
292290
var authSettings = buildAuthSettings();
@@ -479,7 +477,8 @@ module.exports = function (RED) {
479477
node.status({ fill: 'blue', shape: 'dot', text: `Processing document ${pos} of ${len}` });
480478
msgClone.payload = e;
481479
doit(msgClone);
482-
})
480+
});
481+
483482
} else {
484483
doit(msg);
485484
}

0 commit comments

Comments
 (0)