<commit_before>/*
# Twilio
This class makes it easy to send text messages with
[Twilio's REST API](http://www.twilio.com/docs/api/rest). Two environment variables
are required:

1. TWILIO_KEY - your "Account SID" on your
[Account Detail](https://www.twilio.com/user/account) page.
2. TWILIO_TOKEN - your "Auth Token" on that same page.
*/

'use strict';

var superagent = require('superagent');

function Twilio(options) {
  /*jshint maxcomplexity: 9 */

  options = options || {};

  this.key = options.key || process.env.THEHELP_TWILIO_KEY;
  if (!this.key) {
    throw new Error('need to provide twilio key by options or env var!');
  }

  this.token = options.token || process.env.THEHELP_TWILIO_TOKEN;
  if (!this.token) {
    throw new Error('need to provide twilio token by options or env var!');
  }

  this.twilio = options.twilio;
  this.development = options.development;
  if (typeof this.development === 'undefined') {
    options.development = process.env.NODE_ENV === 'development';
  }

  this.validate = this.validate.bind(this);

  this.superagent = options.superagent || superagent;
}

// Sending SMS
// --------

/*<commit_msg>Twilio: set this.development not options.dev<commit_after>/*
# Twilio
This class makes it easy to send text messages with
[Twilio's REST API](http://www.twilio.com/docs/api/rest). Two environment variables
are required:

1. TWILIO_KEY - your "Account SID" on your
[Account Detail](https://www.twilio.com/user/account) page.
2. TWILIO_TOKEN - your "Auth Token" on that same page.
*/

'use strict';

var superagent = require('superagent');

function Twilio(options) {
  /*jshint maxcomplexity: 9 */

  options = options || {};

  this.key = options.key || process.env.THEHELP_TWILIO_KEY;
  if (!this.key) {
    throw new Error('need to provide twilio key by options or env var!');
  }

  this.token = options.token || process.env.THEHELP_TWILIO_TOKEN;
  if (!this.token) {
    throw new Error('need to provide twilio token by options or env var!');
  }

  this.twilio = options.twilio;
  this.development = options.development;
  if (typeof this.development === 'undefined') {
    this.development = process.env.NODE_ENV === 'development';
  }

  this.validate = this.validate.bind(this);

  this.superagent = options.superagent || superagent;
}

// Sending SMS
// --------

/*
{'fraction_non_alphanumeric': 0.1416881998277347, 'fraction_numerical': 0.002583979328165375, 'mean_word_length': 3.636726546906188, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6846997', 'n_tokens_mistral': 786, 'n_tokens_neox': 748, 'n_words': 210}