1.0.3 • Published 8 years ago

nano-rows v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Gitter NPM version Build status Test coverage Dependency Status License Downloads

nano-rows

Text rows indexer. Calculates text coords (row/col) by character index.

var Rows = require('nano-rows');

var index = new Rows(fs.readFile('source.txt', 'utf8'), 'source.txt');

try {
	console.log(index.get_label(index.indexOf('blah')), '"blah" position');
} catch (e) {
	console.log('no "blah" found');
}

API

Constructor: Rows(text, name)

  • text String
  • name String -- text name

rows.get_coords(offset)

Returns row, col for the character offset.

rows.get_label(offset)

Returns text like "{text-name}({row},{col})".

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago