'use strict';

/**
 * PhoneNumber
 *
 **/


var Helpers = require('./helpers');
var definitions = require('./definitions');

/**
 * PhoneNumber#phoneNumber(format = null) -> String
 * - format (string): input format for example '#####-####'
 *
 * Generate phone number by format. Each sharp symbol will be replaced by number.
 * If format is null, then randomly
 **/
exports.phoneNumber = function ( format ){
  if (!format) {
    format = Helpers.randomize(definitions.phone_formats());
  }
  return Helpers.replaceSymbolWithNumber(format);
};

'use strict';

/**
 * PhoneNumber
 *
 **/


var Helpers = require('./helpers');
var Charlatan = require('./charlatan');


/**
 * PhoneNumber#phoneNumber() -> String
 *
 * Generate phone number.
 **/
exports.phoneNumber = function() {
  return Charlatan.numerify(Charlatan.fetch('phone_number.formats'));
};


/**
 * PhoneNumber#phoneNumber() -> String
 *
 * Generate cell phone number. If locale hasn't `cell_phone` section then use `phone`.
 **/
exports.cellPhone = function() {
  try {
    Charlatan.numerify(Charlatan.fetch('phone_number.cell_phone'));
  }
  catch (e) {
    return exports.phoneNumber();
  }
};

Move PhoneNumber section to new api
Move PhoneNumber section to new api
