index.js
function typedValue(value) {
  if (value[0] == '!') value = value.substr(1)
  var regex = value.match(/^\/(.*)\/(i?)$/);
  var quotedString = value.match(/(["'])(?:\\\1|.)*?\1/);

  if (regex) {
    return new RegExp(regex[1], regex[2]);
  } else if (quotedString) {
    return quotedString[0].substr(1, quotedString[0].length - 2);
  } else if (value === 'true') {
    return true;
  } else if (value === 'false') {
    return false;
  } else if (iso8601.test(value) && value.length !== 4) {
    return new Date(value);
  } else if (!isNaN(Number(value))) {
    return Number(value);
  }

  return value;
}
function typedValue(value) {
  if (value[0] == '!') value = value.substr(1)
  var regex = value.match(/^\/(.*)\/(i?)$/);
  var quotedString = value.match(/(["'])(?:\\\1|.)*?\1/);

  if (regex) {
    return new RegExp(regex[1], regex[2]);
  } else if (quotedString) {
    return quotedString[0].substr(1, quotedString[0].length - 2);
  } else if (value === 'true') {
    return true;
  } else if (value === 'false') {
    return false;
  } else if (iso8601.test(value) && value.length !== 4) {
    return new Date(value);
  } else if (!isNaN(Number(value))) {
    return Number(value);
  }

  return value;
}
function typedValue ( value ) { if ( value [ 0 ] == '!' ) value = value . substr ( 1 ) var regex = value . match ( / ^\/(.*)\/(i?)$ / ) ; var quotedString = value . match ( / (["'])(?:\\\1|.)*?\1 / ) ; if ( regex ) { return new RegExp ( regex [ 1 ] , regex [ 2 ] ) ; } else if ( quotedString ) { return quotedString [ 0 ] . substr ( 1 , quotedString [ 0 ] . length - 2 ) ; } else if ( value === 'true' ) { return true ; } else if ( value === 'false' ) { return false ; } else if ( iso8601 . test ( value ) && value . length !== 4 ) { return new Date ( value ) ; } else if ( ! isNaN ( Number ( value ) ) ) { return Number ( value ) ; } return value ; }
Convert String to Number, Date, or Boolean if possible. Also strips ! prefix
Convert String to Number Date or Boolean if possible . Also strips ! prefix