lib/victorops_api_client.js
/**
   * Checks the provided options.
   *
   * @param {Object} options Provided options.
   * @memberof VictorOpsApiClient
   */
Checks the provided options.
@param {Object} options Provided options.
Checks the provided options . @param { Object } options Provided options .
_checkOptions(options) {
    if ((!has(options, 'apiId') && !has(process, 'env.VO_API_ID')) &&
      isEmpty(options.apiId)
    ) {
      throw new Error('A VictorOps Api ID is a required option.');
    }
    if ((!has(options, 'apiKey') && !has(process, 'env.VO_API_KEY')) &&
      isEmpty(options.apiKey)
    ) {
      throw new Error('A VictorOps Api Key is a required option.');
    }
    this._apiId = (process.env.VO_API_ID || options.apiId).trim();
    this._apiKey = (process.env.VO_API_KEY || options.apiKey).trim();
    if (!this._apiId.length) {
      this._apiId = undefined;
      throw new Error('A VictorOps Api ID is a required option.');
    }
    if (!this._apiKey.length) {
      this._apiKey = undefined;
      throw new Error('A VictorOps Api Key is a required option.');
    }
  }
_checkOptions ( options ) { if ( ( ! has ( options , 'apiId' ) && ! has ( process , 'env.VO_API_ID' ) ) && isEmpty ( options . apiId ) ) { throw new Error ( 'A VictorOps Api ID is a required option.' ) ; } if ( ( ! has ( options , 'apiKey' ) && ! has ( process , 'env.VO_API_KEY' ) ) && isEmpty ( options . apiKey ) ) { throw new Error ( 'A VictorOps Api Key is a required option.' ) ; } this . _apiId = ( process . env . VO_API_ID || options . apiId ) . trim ( ) ; this . _apiKey = ( process . env . VO_API_KEY || options . apiKey ) . trim ( ) ; if ( ! this . _apiId . length ) { this . _apiId = undefined ; throw new Error ( 'A VictorOps Api ID is a required option.' ) ; } if ( ! this . _apiKey . length ) { this . _apiKey = undefined ; throw new Error ( 'A VictorOps Api Key is a required option.' ) ; } }
Checks the provided options.
Checks the provided options .
// Check the 'apiId'. // Check the 'apiKey'. // Set the API ID and API key values. // Make sure the API ID is not empty. // Make sure the API key is not empty.