| 1 | |
| 2 | * react-router v8.3.0
|
| 3 | *
|
| 4 | * Copyright (c) Remix Software Inc.
|
| 5 | *
|
| 6 | * This source code is licensed under the MIT license found in the
|
| 7 | * LICENSE.md file in the root directory of this source tree.
|
| 8 | *
|
| 9 | * @license MIT
|
| 10 | */
|
| 11 |
|
| 12 | const ESCAPE_LOOKUP = {
|
| 13 | "&": "\\u0026",
|
| 14 | ">": "\\u003e",
|
| 15 | "<": "\\u003c",
|
| 16 | "\u2028": "\\u2028",
|
| 17 | "\u2029": "\\u2029"
|
| 18 | };
|
| 19 | const ESCAPE_REGEX = /[&><\u2028\u2029]/g;
|
| 20 | function escapeHtml(html) {
|
| 21 | return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
|
| 22 | }
|
| 23 |
|
| 24 | export { escapeHtml };
|