package
Convert a string index to its line and column position
npm install index-to-positionGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
4.6 kB
Includes dependencies.
Convert a string index to its line and column position
npm install index-to-positionimport indexToPosition from 'index-to-position';
indexToPosition('hello\nworld\n!', 7);
//=> {line: 1, column: 1}indexToPosition(text, index, options?)Type: string
The text in which to find the line and column position.
Type: number
The index in the string for which to find the line and column position.
Type: object
Type: boolean
Default: false
Whether to use 1-based or 0-based indexing for the result.
Type: boolean
Default: false
Whether to use 1-based or 0-based line indexing for the result.
Type: boolean
Default: false
Whether to use 1-based or 0-based column indexing for the result.