Sha256: 5ac31937bbf830e8b432311f7e9c3d280dd9185d0067c5500d649c12f10be943

Contents?: true

Size: 1.21 KB

Versions: 153

Compression:

Stored size: 1.21 KB

Contents

/** Used to escape characters for inclusion in compiled regexes. */
var regexpEscapes = {
  '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34',
  '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39',
  'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46',
  'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66',
  'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78'
};

/** Used to escape characters for inclusion in compiled string literals. */
var stringEscapes = {
  '\\': '\\',
  "'": "'",
  '\n': 'n',
  '\r': 'r',
  '\u2028': 'u2028',
  '\u2029': 'u2029'
};

/**
 * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes.
 *
 * @private
 * @param {string} chr The matched character to escape.
 * @param {string} leadingChar The capture group for a leading character.
 * @param {string} whitespaceChar The capture group for a whitespace character.
 * @returns {string} Returns the escaped character.
 */
function escapeRegExpChar(chr, leadingChar, whitespaceChar) {
  if (leadingChar) {
    chr = regexpEscapes[chr];
  } else if (whitespaceChar) {
    chr = stringEscapes[chr];
  }
  return '\\' + chr;
}

module.exports = escapeRegExpChar;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/internal/escapeRegExpChar.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/escapeRegExpChar.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/internal/escapeRegExpChar.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/internal/escapeRegExpChar.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/internal/escapeRegExpChar.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/escapeRegExpChar.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/internal/escapeRegExpChar.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/internal/escapeRegExpChar.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/escapeRegExpChar.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/escapeRegExpChar.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/escapeRegExpChar.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/escapeRegExpChar.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/escapeRegExpChar.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/escapeRegExpChar.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/escapeRegExpChar.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/internal/escapeRegExpChar.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/escapeRegExpChar.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/escapeRegExpChar.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/escapeRegExpChar.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/escapeRegExpChar.js