File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,23 +102,26 @@ module.exports = function (RED) {
102102 }
103103 } ;
104104
105+ // Function to parse and determine tone setting
106+ // 'all' is the setting which needs be be blanked
107+ // if not the service will throw an error
108+ var parseToneOption = function ( msg , config ) {
109+ var tones = msg . tones || config . tones ;
110+
111+ return ( tones === 'all' ? '' : tones ) ;
112+ }
113+
105114 // function to parse through the options in preparation
106115 // for the sevice call.
107116 var parseOptions = function ( msg , config ) {
108- var tones = msg . tones || config . tones ;
109- // var sentences = msg.sentences || config.sentences;
110- // var contentType = msg.contentType || config.contentType;
111117
112118 var options = {
113119 'text' : msg . payload ,
114120 'sentences' : msg . sentences || config . sentences ,
115- 'isHTML' : msg . contentType || config . contentType ,
116- 'tones' : ( tones === 'all' ? '' : tones )
121+ 'isHTML' : msg . contentType || config . contentType
117122 } ;
118123
119- //if (tones !== 'all') {
120- // options.tones = tones;
121- //}
124+ options . tones = parseToneOption ( msg , config ) ;
122125
123126 return options ;
124127 }
You can’t perform that action at this time.
0 commit comments