@lint-todo/utils
Version:
 [](https://badge.fury.io/js/%40lint-todo%2Futils) [](h
28 lines • 1.08 kB
TypeScript
import { Range } from './types';
export declare const _sourceCache: Map<string, string>;
/**
* Converts node positional numbers into a Range object.
*
* @param line - The source start line.
* @param column - The source start column.
* @param endLine - The source end line.
* @param endColumn - The source end column.
* @returns A range object.
*/
export declare function buildRange(line: number, column: number, endLine?: number, endColumn?: number): Range;
/**
* Reads a source file, optionally caching it if it's already been read.
*
* @param filePath - The path to the source file.
* @returns The file contents.
*/
export declare function readSource(filePath: string | undefined): string;
/**
* Extracts a source fragment from a file's contents based on the provided Range.
*
* @param source - The file contents.
* @param range - A Range object representing the range to extract from the file contents.
* @returns The source fragment.
*/
export declare function getSourceForRange(source: string, range: Range): string;
//# sourceMappingURL=source.d.ts.map