Home / File/ clamp-test.js — react Source File

clamp-test.js — react Source File

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

Entity Profile

Dependency Diagram

graph LR
  825c21a2_17e6_e471_9e5e_405457bd221d["clamp-test.js"]
  adc3924b_f490_6a42_b89a_7b496d5a55de["clamp.js"]
  825c21a2_17e6_e471_9e5e_405457bd221d --> adc3924b_f490_6a42_b89a_7b496d5a55de
  602ea433_ce95_7eee_6236_3ffd5c7bd98b["clamp"]
  825c21a2_17e6_e471_9e5e_405457bd221d --> 602ea433_ce95_7eee_6236_3ffd5c7bd98b
  style 825c21a2_17e6_e471_9e5e_405457bd221d 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
 */

import {clamp} from '../clamp';

describe('clamp', () => {
  it('should return min if value < min', () => {
    expect(clamp(0, 1, -1)).toBe(0);
    expect(clamp(0.1, 1.1, 0.05)).toBe(0.1);
  });

  it('should return value if min <= value <= max', () => {
    expect(clamp(0, 1, 0)).toBe(0);
    expect(clamp(0, 1, 0.5)).toBe(0.5);
    expect(clamp(0, 1, 1)).toBe(1);
    expect(clamp(0.1, 1.1, 0.15)).toBe(0.15);
  });

  it('should return max if max < value', () => {
    expect(clamp(0, 1, 2)).toBe(1);
    expect(clamp(0.1, 1.1, 1.15)).toBe(1.1);
  });
});

Domain

Dependencies

Frequently Asked Questions

What does clamp-test.js do?
clamp-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does clamp-test.js depend on?
clamp-test.js imports 2 module(s): clamp, clamp.js.
Where is clamp-test.js in the architecture?
clamp-test.js is located at packages/react-devtools-timeline/src/view-base/utils/__tests__/clamp-test.js (domain: BabelCompiler, directory: packages/react-devtools-timeline/src/view-base/utils/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free