range.ts — react Source File
Architecture documentation for range.ts, a typescript file in the react codebase. 2 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 8e72bb38_0446_40c5_e453_1f12111e8936["range.ts"] 52e3d8d7_abf4_7343_1f98_3f701ec04082["types"] 8e72bb38_0446_40c5_e453_1f12111e8936 --> 52e3d8d7_abf4_7343_1f98_3f701ec04082 68521835_0a40_a94c_8edf_d1628eba6b29["node"] 8e72bb38_0446_40c5_e453_1f12111e8936 --> 68521835_0a40_a94c_8edf_d1628eba6b29 45729896_cc85_f8cb_a3e3_efc08e3b01a6["index.ts"] 45729896_cc85_f8cb_a3e3_efc08e3b01a6 --> 8e72bb38_0446_40c5_e453_1f12111e8936 08a4e47f_6b9c_64f7_9030_8560a35663d9["autodepsdecorations.ts"] 08a4e47f_6b9c_64f7_9030_8560a35663d9 --> 8e72bb38_0446_40c5_e453_1f12111e8936 style 8e72bb38_0446_40c5_e453_1f12111e8936 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.
*/
import * as t from '@babel/types';
import {type Position} from 'vscode-languageserver/node';
export type Range = [Position, Position];
export function isPositionWithinRange(
position: Position,
[start, end]: Range,
): boolean {
return position.line >= start.line && position.line <= end.line;
}
export function isRangeWithinRange(aRange: Range, bRange: Range): boolean {
const startComparison = comparePositions(aRange[0], bRange[0]);
const endComparison = comparePositions(aRange[1], bRange[1]);
return startComparison >= 0 && endComparison <= 0;
}
function comparePositions(a: Position, b: Position): number {
const lineComparison = a.line - b.line;
if (lineComparison === 0) {
return a.character - b.character;
} else {
return lineComparison;
}
}
export function sourceLocationToRange(
loc: t.SourceLocation,
): [Position, Position] {
return [
{line: loc.start.line - 1, character: loc.start.column},
{line: loc.end.line - 1, character: loc.end.column},
];
}
Domain
Subdomains
Types
Dependencies
- node
- types
Imported By
Source
Frequently Asked Questions
What does range.ts do?
range.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in range.ts?
range.ts defines 4 function(s): comparePositions, isPositionWithinRange, isRangeWithinRange, sourceLocationToRange.
What does range.ts depend on?
range.ts imports 2 module(s): node, types.
What files import range.ts?
range.ts is imported by 2 file(s): autodepsdecorations.ts, index.ts.
Where is range.ts in the architecture?
range.ts is located at compiler/packages/react-forgive/server/src/utils/range.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/react-forgive/server/src/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free