lines-and-columns

Maps lines and columns to character offsets and back.

please use 1.1.8 or 2.0.1 or later
Last updated 3 years ago by eventualbuddha .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install lines-and-columns 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.0.4                                ...           latest (a year ago)
  • 1.1.11                                ...           v11x (3 years ago)
  • 1.2.4                                ...           v12x (3 years ago)

25 Versions

  • 2.0.4                                ...           a year ago
  • 2.0.3                                ...           3 years ago
  • 1.2.4                                ...           3 years ago
  • 1.1.11                                ...           3 years ago
  • 1.1.10                                ...           3 years ago
  • 1.2.3                                ...           3 years ago
  • 1.2.2 [deprecated]           ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 1.2.1 [deprecated]           ...           3 years ago
  • 1.1.9 [deprecated]           ...           3 years ago
  • 1.1.8 [deprecated]           ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0 [deprecated]           ...           3 years ago
  • 1.2.0 [deprecated]           ...           3 years ago
  • 1.1.7 [deprecated]           ...           3 years ago
  • 1.1.6                                ...           8 years ago
  • 1.1.5                                ...           8 years ago
  • 1.1.4                                ...           8 years ago
  • 1.1.3                                ...           8 years ago
  • 1.1.2                                ...           8 years ago
  • 1.1.1                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.2                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (14)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |