Skip to content

Commit 72b0568

Browse files
committed
Fix jshint errors
1 parent 1fb7e2c commit 72b0568

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

templates/swagger/node.js.mustache

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,29 @@ module.exports = function (RED) {
6666
var result;
6767
{{#methods}}
6868
if (!errorFlag && node.method === '{{&methodName}}') {
69-
var parameters = [], nodeParam, nodeParamType;
69+
var {{&methodName}}_parameters = [];
70+
var {{&methodName}}_nodeParam;
71+
var {{&methodName}}_nodeParamType;
7072
{{#parameters}}
7173
{{#isBodyParam}}
7274
if (typeof msg.payload === 'object') {
73-
parameters.{{&camelCaseName}} = msg.payload;
75+
{{&methodName}}_parameters.{{&camelCaseName}} = msg.payload;
7476
} else {
75-
node.error('Unsupported type: \'' + (typeof msg.payload) + '\', '
76-
+ 'msg.payload must be JSON object or buffer.', msg);
77+
node.error('Unsupported type: \'' + (typeof msg.payload) + '\', ' + 'msg.payload must be JSON object or buffer.', msg);
7778
errorFlag = true;
7879
}
7980
{{/isBodyParam}}
8081
{{#isNotBodyParam}}
81-
nodeParam = node.{{&methodName}}_{{&camelCaseName}};
82-
nodeParamType = node.{{&methodName}}_{{&camelCaseName}}Type;
83-
parameters.{{&camelCaseName}} = nodeParamType === 'str' ? nodeParam || '' : RED.util.getMessageProperty(msg, nodeParam);
82+
{{&methodName}}_nodeParam = node.{{&methodName}}_{{&camelCaseName}};
83+
{{&methodName}}_nodeParamType = node.{{&methodName}}_{{&camelCaseName}}Type;
84+
if ({{&methodName}}_nodeParamType === 'str') {
85+
{{&methodName}}_parameters.{{&camelCaseName}} = {{&methodName}}_nodeParam || '';
86+
} else {
87+
{{&methodName}}_parameters.{{&camelCaseName}} = RED.util.getMessageProperty(msg, {{&methodName}}_nodeParam);
88+
}
8489
{{/isNotBodyParam}}
8590
{{/parameters}}
86-
87-
result = client.{{&methodName}}(parameters);
91+
result = client.{{&methodName}}({{&methodName}}_parameters);
8892
}
8993
{{/methods}}
9094
if (!errorFlag && result === undefined) {

0 commit comments

Comments
 (0)