linemap

1.0.0 • Public • Published

LineMap

Make conversions between character offsets and line numbers.

Usage

var LineMap = require('linemap');
var linemap = new LineMap(somestring);
 
// find out the character offset for the beginning of line 2
var offset = linemap.getOffsetForLine(2);
 
// find out what line number the character at offset 44 is on
var line = linemap.getLineForOffset(44);

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    1

Package Sidebar

Install

npm i linemap

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • joshwnj