Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "cursor"

Index

Functions

Const computeCursorPos

  • computeCursorPos(str: string, pos: number, delim?: string | RegExp): number[]
  • Takes a string, linear index position and optional line split delimiter (or regexp, default: "\n"). Computes and returns position of index as 1-based cursor coords tuple: [line, column]

    example
    computeCursorPos("thi.ng\numbrella", 10);
    // [ 2, 4 ]

    Parameters

    • str: string

      -

    • pos: number

      -

    • Default value delim: string | RegExp = ""

      -

    Returns number[]

Generated using TypeDoc