Skip to content

Commit a498f21

Browse files
committed
moved parseToneOptions into utilities module
1 parent 77c9485 commit a498f21

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

services/tone_analyzer/v3.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ module.exports = function (RED) {
3838
sPassword = service.password;
3939
}
4040

41-
//toneutils.ping();
4241

4342
// Node RED Admin - fetch and set vcap services
4443
RED.httpAdmin.get('/watson-tone-analyzer/vcap', function (req, res) {
@@ -85,14 +84,6 @@ module.exports = function (RED) {
8584
}
8685
};
8786

88-
// Function to parse and determine tone setting
89-
// 'all' is the setting which needs be be blanked
90-
// if not the service will throw an error
91-
var parseToneOption = function (msg, config) {
92-
var tones = msg.tones || config.tones;
93-
94-
return (tones === 'all' ? '' : tones);
95-
}
9687

9788
// function to parse through the options in preparation
9889
// for the sevice call.
@@ -103,7 +94,7 @@ module.exports = function (RED) {
10394
'isHTML': msg.contentType || config.contentType
10495
};
10596

106-
options.tones = parseToneOption(msg, config);
97+
options.tones = toneutils.parseToneOption(msg, config);
10798
return options;
10899
}
109100

utilities/tone-utils.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ ToneUtils.prototype = {
4242
}
4343

4444
return message;
45+
},
46+
47+
// Function to parse and determine tone setting
48+
// 'all' is the setting which needs be be blanked
49+
// if not the service will throw an error
50+
parseToneOption: function(msg, config) {
51+
var tones = msg.tones || config.tones;
52+
53+
return (tones === 'all' ? '' : tones);
4554
}
4655

4756

0 commit comments

Comments
 (0)