Home / File/ escapeTextForBrowser.js — react Source File

escapeTextForBrowser.js — react Source File

Architecture documentation for escapeTextForBrowser.js, a javascript file in the react codebase. 1 imports, 2 dependents.

File javascript BabelCompiler Validation 1 imports 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  12a08100_717c_694e_2f9c_24bc208ee2f7["escapeTextForBrowser.js"]
  0ae63ebd_b26a_05c8_1c6d_275a5f6b76c7["CheckStringCoercion"]
  12a08100_717c_694e_2f9c_24bc208ee2f7 --> 0ae63ebd_b26a_05c8_1c6d_275a5f6b76c7
  4ae326e8_2c2e_2843_d5a5_16edbddd103a["ReactFizzConfigDOM.js"]
  4ae326e8_2c2e_2843_d5a5_16edbddd103a --> 12a08100_717c_694e_2f9c_24bc208ee2f7
  f8daa652_1e2b_f62f_5171_e158bbf29a8e["ReactFizzConfigDOMLegacy.js"]
  f8daa652_1e2b_f62f_5171_e158bbf29a8e --> 12a08100_717c_694e_2f9c_24bc208ee2f7
  style 12a08100_717c_694e_2f9c_24bc208ee2f7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * Based on the escape-html library, which is used under the MIT License below:
 *
 * Copyright (c) 2012-2013 TJ Holowaychuk
 * Copyright (c) 2015 Andreas Lubbe
 * Copyright (c) 2015 Tiancheng "Timothy" Gu
 *
 * 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.
 *
 * @flow
 */

// code copied and modified from escape-html
/**
 * Module variables.
 * @private
 */

import {checkHtmlStringCoercion} from 'shared/CheckStringCoercion';

const matchHtmlRegExp = /["'&<>]/;

/**
 * Escapes special characters and HTML entities in a given html string.
 *
 * @param  {string} string HTML string to escape for later insertion
 * @return {string}
 * @public
 */

function escapeHtml(string: string) {
  if (__DEV__) {
    checkHtmlStringCoercion(string);
  }
  const str = '' + string;
  const match = matchHtmlRegExp.exec(str);

  if (!match) {
// ... (63 more lines)

Domain

Subdomains

Functions

Dependencies

  • CheckStringCoercion

Frequently Asked Questions

What does escapeTextForBrowser.js do?
escapeTextForBrowser.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in escapeTextForBrowser.js?
escapeTextForBrowser.js defines 1 function(s): escapeHtml.
What does escapeTextForBrowser.js depend on?
escapeTextForBrowser.js imports 1 module(s): CheckStringCoercion.
What files import escapeTextForBrowser.js?
escapeTextForBrowser.js is imported by 2 file(s): ReactFizzConfigDOM.js, ReactFizzConfigDOMLegacy.js.
Where is escapeTextForBrowser.js in the architecture?
escapeTextForBrowser.js is located at packages/react-dom-bindings/src/server/escapeTextForBrowser.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/server).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free