index.js
function validateVarName(regex, name, strict) {

  if (strict) {
    // These are only an issue in strict mode.
    if (name === 'eval') { return false; }
    if (name === 'arguments') { return false; }
  }

  var result = regex.test(name);
  result = result && validateCommonReservedWords(name);
  return result;
}
function validateVarName(regex, name, strict) {

  if (strict) {
    // These are only an issue in strict mode.
    if (name === 'eval') { return false; }
    if (name === 'arguments') { return false; }
  }

  var result = regex.test(name);
  result = result && validateCommonReservedWords(name);
  return result;
}
function validateVarName ( regex , name , strict ) { if ( strict ) { // These are only an issue in strict mode. if ( name === 'eval' ) { return false ; } if ( name === 'arguments' ) { return false ; } } var result = regex . test ( name ) ; result = result && validateCommonReservedWords ( name ) ; return result ; }
Validates a variable name using the regular expression provided.  Also uses
reserved words common to ES5 and ES2015.

@param regex {RegExp} A regular expression used to validate name.
@param name {String} The variable name to check.
@param [strict] If this is true, strict mode checking is on.
@return true if the name is valid, or false if it is not.
@private
Validates a variable name using the regular expression provided . Also uses reserved words common to ES5 and ES2015 .