Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

annotate-code

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

annotate-code

beautifully annotate source code with a message, given an index, like a parser or compiler

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by133.33%
Maintainers
1
Weekly downloads
 
Created
Source

annotate-code

beautifully annotate source code with a message, given an index, like a parser or compiler

🔧 Install · 🧩 Example · 📜 API docs · 🔥 Releases · 💪🏼 Contribute · 🖐️ Help


Install

$ npm i annotate-code

Example

import { annotate } from 'annotate-code'

console.log(
  annotate({
    message: 'some error message',
    index: 48,
    size: 6,
    code,
  }).message
)

API

Table of Contents

annotate

src/index.ts:44-160

Annotates a source code string given an index and a message.

Parameters
  • settings {message: string, code: string, index: number, linesBefore: number?, linesAfter: number?, size: number?, showLineNumbers: boolean?}

    • settings.message The message to display
    • settings.code The code to annotate
    • settings.index The index position
    • settings.linesBefore How many lines before to show (optional, default 3)
    • settings.linesAfter How many lines after to show (optional, default 3)
    • settings.size The size of the arrows ^^^^ (optional, default 1)
    • settings.showLineNumbers Whether to show line numbers (optional, default true)

Returns {line: number?, col: number?, message: string}

Contribute

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2021 stagas

Keywords

FAQs

Package last updated on 25 Nov 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc