Home / File/ clamp.js — react Source File

clamp.js — react Source File

Architecture documentation for clamp.js, a javascript file in the react codebase. 0 imports, 3 dependents.

File javascript BabelCompiler Validation 3 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  adc3924b_f490_6a42_b89a_7b496d5a55de["clamp.js"]
  6e3184c5_8737_3bc9_5c7e_598f40316d02["ResizableView.js"]
  6e3184c5_8737_3bc9_5c7e_598f40316d02 --> adc3924b_f490_6a42_b89a_7b496d5a55de
  825c21a2_17e6_e471_9e5e_405457bd221d["clamp-test.js"]
  825c21a2_17e6_e471_9e5e_405457bd221d --> adc3924b_f490_6a42_b89a_7b496d5a55de
  d0e34df5_54e0_bd63_7394_3bfe61a4c376["scrollState.js"]
  d0e34df5_54e0_bd63_7394_3bfe61a4c376 --> adc3924b_f490_6a42_b89a_7b496d5a55de
  style adc3924b_f490_6a42_b89a_7b496d5a55de 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.
 *
 * @flow
 */

export function clamp(min: number, max: number, value: number): number {
  if (Number.isNaN(min) || Number.isNaN(max) || Number.isNaN(value)) {
    throw new Error(
      `Clamp was called with NaN. Args: min: ${min}, max: ${max}, value: ${value}.`,
    );
  }
  return Math.min(max, Math.max(min, value));
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does clamp.js do?
clamp.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 clamp.js?
clamp.js defines 1 function(s): clamp.
What files import clamp.js?
clamp.js is imported by 3 file(s): ResizableView.js, clamp-test.js, scrollState.js.
Where is clamp.js in the architecture?
clamp.js is located at packages/react-devtools-timeline/src/view-base/utils/clamp.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-timeline/src/view-base/utils).

Analyze Your Own Codebase

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

Try Supermodel Free