services/tone_analyzer/v3.js
function(msg, node) {
    var message = null,
      taSettings = null;

    taSettings = checkCreds(node.credentials);

    if (!taSettings) {
      message = 'Missing Tone Analyzer service credentials';
    } else if (msg.payload) {
      message = toneutils.checkPayload(msg.payload);
    } else  {
      message = 'Missing property: msg.payload';
    }

    if (message) {
      return Promise.reject(message);
    } else {
      return Promise.resolve(taSettings);
    }
  }
function(msg, node) {
    var message = null,
      taSettings = null;

    taSettings = checkCreds(node.credentials);

    if (!taSettings) {
      message = 'Missing Tone Analyzer service credentials';
    } else if (msg.payload) {
      message = toneutils.checkPayload(msg.payload);
    } else  {
      message = 'Missing property: msg.payload';
    }

    if (message) {
      return Promise.reject(message);
    } else {
      return Promise.resolve(taSettings);
    }
  }
function ( msg , node ) { var message = null , taSettings = null ; taSettings = checkCreds ( node . credentials ) ; if ( ! taSettings ) { message = 'Missing Tone Analyzer service credentials' ; } else if ( msg . payload ) { message = toneutils . checkPayload ( msg . payload ) ; } else { message = 'Missing property: msg.payload' ; } if ( message ) { return Promise . reject ( message ) ; } else { return Promise . resolve ( taSettings ) ; } }
Function that checks the configuration to make sure that credentials, payload and options have been provied in the correct format.
Function that checks the configuration to make sure that credentials payload and options have been provied in the correct format .