Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

babel-code-frame

Package Overview
Dependencies
3
Maintainers
5
Versions
54
Issues
File Explorer

Advanced tools

babel-code-frame

Generate errors that contain a code frame that point to source locations.

    6.26.0latest

Version published
Maintainers
5
Weekly downloads
4,878,857
decreased by-19.02%

Weekly downloads

Readme

Source

babel-code-frame

Generate errors that contain a code frame that point to source locations.

Install

npm install --save-dev babel-code-frame

Usage

import codeFrame from 'babel-code-frame'; const rawLines = `class Foo { constructor() }`; const lineNumber = 2; const colNumber = 16; const result = codeFrame(rawLines, lineNumber, colNumber, { /* options */ }); console.log(result); 1 | class Foo { > 2 | constructor() | ^ 3 | }

If the column number is not known, you may pass null instead.

Options

highlightCode

boolean, defaults to false.

Toggles syntax highlighting the code as JavaScript for terminals.

linesAbove

number, defaults to 2.

Adjust the number of lines to show above the error.

linesBelow

number, defaults to 3.

Adjust the number of lines to show below the error.

forceColor

boolean, defaults to false.

Enable this to forcibly syntax highlight the code as JavaScript (for non-terminals); overrides highlightCode.

FAQs

What is babel-code-frame?

Generate errors that contain a code frame that point to source locations.

Is babel-code-frame popular?

The npm package babel-code-frame receives a total of 4,092,393 weekly downloads. As such, babel-code-frame popularity was classified as popular.

Is babel-code-frame well maintained?

We found that babel-code-frame demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 5 open source maintainers collaborating on the project.

Last updated on 16 Aug 2017

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc