lines-and-columns
Maps lines and columns to character offsets and back.
Last updated 2 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 (2 years ago)
  • 1.1.11                                ...           v11x (4 years ago)
  • 1.2.4                                ...           v12x (4 years ago)

25 Versions

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

Copyright 2013 - present © cnpmjs.org | Home |