1. pinpoint
Display an arrow in a string of code to point to a location
pinpoint
Package: pinpoint
Created by: curvedmark
Last modified: Fri, 24 Jun 2022 00:13:41 GMT
Version: 1.1.0
License: MIT
Downloads: 2,010,871
Repository: https://github.com/curvedmark/pinpoint

Install

npm install pinpoint
yarn add pinpoint

pinpoint

Add line numbers and an arrow to a string of code that points to a specific location.

Installation

npm install pinpoint

Example

With this code:

 function add(left, right) {
  return left + right;
}

console.log(add(1 + 1));

When being asked to point to line 2 and column 2, generates this:

 1| function add(left, right) {
2|   return left + right;
-----^
3| }
4|
5| console.log(add(1 + 1));

API

 var pinpoint = require('pinpoint');

var str = pinpoint(code, options);
  • code - a string of code
  • options - an object literal supports these options:
    • line - the line number to point to, 1-based.
    • column - the column number to point to, 1-based.
    • showLines - the number of lines to show. The pointed line will try to stay in the middle of the displays lines.
    • indent - indent string prepend to each line, before the line number.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code