lines-and-columns (1.2.4)
Published 2026-02-24 14:00:51 +00:00 by atheaadmin
Installation
registry=npm install lines-and-columns@1.2.4"lines-and-columns": "1.2.4"About this package
lines-and-columns
Maps lines and columns to character offsets and back. This is useful for parsers and other text processors that deal in character ranges but process text with meaningful lines and columns.
Install
$ npm install [--save] lines-and-columns
Usage
import { LinesAndColumns } from 'lines-and-columns'
const lines = new LinesAndColumns(
`table {
border: 0
}`
)
lines.locationForIndex(9)
// { line: 1, column: 1 }
lines.indexForLocation({ line: 1, column: 2 })
// 10
License
MIT
Dependencies
Development Dependencies
| ID | Version |
|---|---|
| @types/jest | ^27.0.3 |
| @types/node | ^16.11.9 |
| @typescript-eslint/eslint-plugin | ^5.4.0 |
| @typescript-eslint/parser | ^5.4.0 |
| esbuild | ^0.13.15 |
| esbuild-runner | ^2.2.1 |
| eslint | ^8.2.0 |
| eslint-config-prettier | ^8.3.0 |
| eslint-plugin-prettier | ^4.0.0 |
| is-ci-cli | ^2.2.0 |
| jest | ^27.3.1 |
| prettier | ^2.4.1 |
| semantic-release | ^18.0.0 |
| typescript | ^4.5.2 |
Keywords
lines
columns
parser