Socket
Book a DemoInstallSign in
Socket

nano-rows

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nano-rows

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

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

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})".

Keywords

text rows

FAQs

Package last updated on 29 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts