1 | # babel-code-frame
|
2 |
|
3 | > Generate errors that contain a code frame that point to source locations.
|
4 |
|
5 | ## Install
|
6 |
|
7 | ```sh
|
8 | $ npm install babel-code-frame
|
9 | ```
|
10 |
|
11 | ## Usage
|
12 |
|
13 | ```js
|
14 | import codeFrame from 'babel-code-frame';
|
15 |
|
16 | const rawLines = `class Foo {
|
17 | constructor()
|
18 | }`;
|
19 | const lineNumber = 2;
|
20 | const colNumber = 16;
|
21 |
|
22 | const result = codeFrame(rawLines, lineNumber, colNumber, { /* options */ });
|
23 |
|
24 | console.log(result);
|
25 | ```
|
26 |
|
27 | ```sh
|
28 | 1 | class Foo {
|
29 | > 2 | constructor()
|
30 | | ^
|
31 | 3 | }
|
32 | ```
|