simple-code-frame
A tiny utility to create code frames
Last updated 5 years ago by marvinhagemeister .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install simple-code-frame 
SYNC missed versions from official npm registry.

simple-code-frame

Tiny library for displaying code frames. The main difference to @babel/code-frame is that this library doesn't ship with a parser. It is soley aimed at taking text input and adding column + line markers.

Usage

npm install simple-code-frame
# or via yarn
yarn add simple-code-frame

Usage

import { createCodeFrame } from 'simple-code-frame';

const str = `foo\nbar\nbob`;

const codeFrame = createCodeFrame(str, 1, 2);
console.log(codeFrame);
// Logs:
//   1 | foo
// > 2 | bar
//     |  ^
//   3 | bob

License

MIT, see the license file.

Current Tags

  • 1.3.0                                ...           latest (4 years ago)

5 Versions

  • 1.3.0                                ...           4 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.1                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Total 19
Today 0
This Week 4
This Month 15
Last Day 0
Last Week 9
Last Month 0
Dependencies (1)
Dev Dependencies (9)
Dependents (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE