Skip to content

cenfun/monocart-locator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monocart Locator

A Locator for the source code position between offset and line/column.

Features

  • Position locator
  • Line parser
  • Comment parser

Install

npm i monocart-locator

Usage

const locator = new Locator(source);
console.log(locator.lines);
console.log(locator.comments);

const offset = locator.locationToOffset({ line: 1, column: 1 });
const loc = locator.offsetToLocation(10);