JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 72846854
  • Score
    100M100P100Q322480F
  • License MIT

Maps lines and columns to character offsets and back.

Package Exports

  • lines-and-columns

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lines-and-columns) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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