summaryrefslogtreecommitdiff
path: root/node_modules/escape-string-regexp
diff options
context:
space:
mode:
authorShipwreckt <me@shipwreckt.co.uk>2025-10-31 20:02:14 +0000
committerShipwreckt <me@shipwreckt.co.uk>2025-10-31 20:02:14 +0000
commit7a52ddeba2a68388b544f529d2d92104420f77b0 (patch)
tree15ddd47457a2cb4a96060747437d36474e4f6b4e /node_modules/escape-string-regexp
parent53d6ae2b5568437afa5e4995580a3fb679b7b91b (diff)
Changed from static to 11ty!
Diffstat (limited to 'node_modules/escape-string-regexp')
-rw-r--r--node_modules/escape-string-regexp/index.d.ts16
-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.json40
-rw-r--r--node_modules/escape-string-regexp/readme.md34
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..e8f9288
--- /dev/null
+++ b/node_modules/escape-string-regexp/index.d.ts
@@ -0,0 +1,16 @@
+/**
+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 from 'escape-string-regexp';
+
+const escapedString = escapeStringRegexp('How much $ for a 🦄?');
+//=> 'How much \\$ for a 🦄\\?'
+
+new RegExp(escapedString);
+```
+*/
+export default function escapeStringRegexp(string: string): string;
diff --git a/node_modules/escape-string-regexp/index.js b/node_modules/escape-string-regexp/index.js
new file mode 100644
index 0000000..9ce9323
--- /dev/null
+++ b/node_modules/escape-string-regexp/index.js
@@ -0,0 +1,11 @@
+export default function escapeStringRegexp(string) {
+ if (typeof string !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ // Escape characters with special meaning either inside or outside character sets.
+ // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
+ return string
+ .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
+ .replace(/-/g, '\\x2d');
+}
diff --git a/node_modules/escape-string-regexp/license b/node_modules/escape-string-regexp/license
new file mode 100644
index 0000000..fa7ceba
--- /dev/null
+++ b/node_modules/escape-string-regexp/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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..9390a6b
--- /dev/null
+++ b/node_modules/escape-string-regexp/package.json
@@ -0,0 +1,40 @@
+{
+ "name": "escape-string-regexp",
+ "version": "5.0.0",
+ "description": "Escape RegExp special characters",
+ "license": "MIT",
+ "repository": "sindresorhus/escape-string-regexp",
+ "funding": "https://github.com/sponsors/sindresorhus",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "https://sindresorhus.com"
+ },
+ "type": "module",
+ "exports": "./index.js",
+ "engines": {
+ "node": ">=12"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "escape",
+ "regex",
+ "regexp",
+ "regular",
+ "expression",
+ "string",
+ "special",
+ "characters"
+ ],
+ "devDependencies": {
+ "ava": "^3.15.0",
+ "tsd": "^0.14.0",
+ "xo": "^0.38.2"
+ }
+}
diff --git a/node_modules/escape-string-regexp/readme.md b/node_modules/escape-string-regexp/readme.md
new file mode 100644
index 0000000..839df6e
--- /dev/null
+++ b/node_modules/escape-string-regexp/readme.md
@@ -0,0 +1,34 @@
+# escape-string-regexp
+
+> Escape RegExp special characters
+
+## Install
+
+```
+$ npm install escape-string-regexp
+```
+
+## Usage
+
+```js
+import escapeStringRegexp from '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.
+
+---
+
+<div align="center">
+ <b>
+ <a href="https://tidelift.com/subscription/pkg/npm-escape-string-regexp?utm_source=npm-escape-string-regexp&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
+ </b>
+ <br>
+ <sub>
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
+ </sub>
+</div>