linecol2index

    1.0.3 • Public • Published

    linecol2index NPM version

    Maps a line and column number to the index position of a string

    Installation

    $ npm install --save linecol2index

    Usage

    const {linecol2index} = require('linecol2index');
     
    const text = getTextFromFile('example.py'); // "print("Hello, World!")\nprint("Goodbye!")"
    const line = 2
    const col = 1
     
    const index = linecol2index(line, col, text);
    console.log(text[index]) // 'p'

    License

    ISC © Anthony Yang

    Install

    npm i linecol2index

    DownloadsWeekly Downloads

    2

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    5.04 kB

    Total Files

    7

    Last publish

    Collaborators

    • ayang4114