aboutsummaryrefslogtreecommitdiff
path: root/node_modules/escape-string-regexp
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
committerJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
commit080c5819d87b933816d724a83f3bf4f1686770a7 (patch)
tree4a2ccc68b27edf7d4cbc586c932cc7542b655e19 /node_modules/escape-string-regexp
parent5ac7049a9d30733165cc212dee308163c2a14644 (diff)
parentd003b82235a9329f912522a2f70aa950dfce4998 (diff)
downloadLYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.tar.gz
LYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.zip
Merge branch 'master' of https://github.com/JoelHMikael/FoodJS
Updating remote changes
Diffstat (limited to 'node_modules/escape-string-regexp')
-rw-r--r--node_modules/escape-string-regexp/index.d.ts18
-rw-r--r--node_modules/escape-string-regexp/index.js11
-rw-r--r--node_modules/escape-string-regexp/license9
-rw-r--r--node_modules/escape-string-regexp/package.json43
-rw-r--r--node_modules/escape-string-regexp/readme.md29
5 files changed, 110 insertions, 0 deletions
diff --git a/node_modules/escape-string-regexp/index.d.ts b/node_modules/escape-string-regexp/index.d.ts
new file mode 100644
index 0000000..7d34edc
--- /dev/null
+++ b/node_modules/escape-string-regexp/index.d.ts
@@ -0,0 +1,18 @@
+/**
+Escape RegExp special characters.
+
+You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
+
+@example
+```
+import escapeStringRegexp = require('escape-string-regexp');
+
+const escapedString = escapeStringRegexp('How much $ for a 🦄?');
+//=> 'How much \\$ for a 🦄\\?'
+
+new RegExp(escapedString);
+```
+*/
+declare const escapeStringRegexp: (string: string) => string;
+
+export = escapeStringRegexp;
diff --git a/node_modules/escape-string-regexp/index.js b/node_modules/escape-string-regexp/index.js
new file mode 100644
index 0000000..58217a4
--- /dev/null
+++ b/node_modules/escape-string-regexp/index.js
@@ -0,0 +1,11 @@
+'use strict';
+
+const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
+
+module.exports = string => {
+ if (typeof string !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ return string.replace(matchOperatorsRegex, '\\$&');
+};
diff --git a/node_modules/escape-string-regexp/license b/node_modules/escape-string-regexp/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/node_modules/escape-string-regexp/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/escape-string-regexp/package.json b/node_modules/escape-string-regexp/package.json
new file mode 100644
index 0000000..2e343cf
--- /dev/null
+++ b/node_modules/escape-string-regexp/package.json
@@ -0,0 +1,43 @@
+{
+ "name": "escape-string-regexp",
+ "version": "2.0.0",
+ "description": "Escape RegExp special characters",
+ "license": "MIT",
+ "repository": "sindresorhus/escape-string-regexp",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "maintainers": [
+ "Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
+ "Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)"
+ ],
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "escape",
+ "regex",
+ "regexp",
+ "re",
+ "regular",
+ "expression",
+ "string",
+ "str",
+ "special",
+ "characters"
+ ],
+ "devDependencies": {
+ "ava": "^1.4.1",
+ "tsd": "^0.7.2",
+ "xo": "^0.24.0"
+ }
+}
diff --git a/node_modules/escape-string-regexp/readme.md b/node_modules/escape-string-regexp/readme.md
new file mode 100644
index 0000000..157472b
--- /dev/null
+++ b/node_modules/escape-string-regexp/readme.md
@@ -0,0 +1,29 @@
+# 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
+
+```
+$ npm install escape-string-regexp
+```
+
+
+## Usage
+
+```js
+const escapeStringRegexp = require('escape-string-regexp');
+
+const escapedString = escapeStringRegexp('How much $ for a 🦄?');
+//=> 'How much \\$ for a 🦄\\?'
+
+new RegExp(escapedString);
+```
+
+You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)