From 3274a40bbf7bd36e4fdc977b5adec4e2130cd4ba Mon Sep 17 00:00:00 2001 From: James Kyle Date: Thu, 29 Oct 2015 19:56:25 -0700 Subject: [PATCH] Add babel-code-frame README --- packages/babel-code-frame/README.md | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/packages/babel-code-frame/README.md b/packages/babel-code-frame/README.md index 35f7c2ebf7..851ad32e05 100644 --- a/packages/babel-code-frame/README.md +++ b/packages/babel-code-frame/README.md @@ -1 +1,32 @@ # babel-code-frame + +> Generate errors that contain a code frame that point to source locations. + +## Install + +```sh +$ npm install babel-core +``` + +### Usage + +```js +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); +``` + +```sh + 1 | class Foo { +> 2 | constructor() + | ^ + 3 | } +```