aboutsummaryrefslogtreecommitdiff
path: root/node_modules/escape-string-regexp
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/escape-string-regexp')
-rw-r--r--node_modules/escape-string-regexp/index.js11
-rw-r--r--node_modules/escape-string-regexp/package.json36
-rw-r--r--node_modules/escape-string-regexp/readme.md27
3 files changed, 74 insertions, 0 deletions
diff --git a/node_modules/escape-string-regexp/index.js b/node_modules/escape-string-regexp/index.js
new file mode 100644
index 000000000..ac6572cab
--- /dev/null
+++ b/node_modules/escape-string-regexp/index.js
@@ -0,0 +1,11 @@
+'use strict';
+
+var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
+
+module.exports = function (str) {
+ if (typeof str !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ return str.replace(matchOperatorsRe, '\\$&');
+};
diff --git a/node_modules/escape-string-regexp/package.json b/node_modules/escape-string-regexp/package.json
new file mode 100644
index 000000000..1dff6ff23
--- /dev/null
+++ b/node_modules/escape-string-regexp/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "escape-string-regexp",
+ "version": "1.0.2",
+ "description": "Escape RegExp special characters",
+ "license": "MIT",
+ "repository": "sindresorhus/escape-string-regexp",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "http://sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "scripts": {
+ "test": "mocha"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "regex",
+ "regexp",
+ "re",
+ "regular",
+ "expression",
+ "escape",
+ "string",
+ "str",
+ "special",
+ "characters"
+ ],
+ "devDependencies": {
+ "mocha": "*"
+ }
+}
diff --git a/node_modules/escape-string-regexp/readme.md b/node_modules/escape-string-regexp/readme.md
new file mode 100644
index 000000000..808a963a8
--- /dev/null
+++ b/node_modules/escape-string-regexp/readme.md
@@ -0,0 +1,27 @@
+# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp)
+
+> Escape RegExp special characters
+
+
+## Install
+
+```sh
+$ npm install --save escape-string-regexp
+```
+
+
+## Usage
+
+```js
+var escapeStringRegexp = require('escape-string-regexp');
+
+var escapedString = escapeStringRegexp('how much $ for a unicorn?');
+//=> how much \$ for a unicorn\?
+
+new RegExp(escapedString);
+```
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)