# code-frame

> Minimal Code Frame like babel-code-frame, but smaller

Latest version **5.0.0** (published 2016-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install code-frame
pnpm add code-frame
yarn add code-frame
bun add code-frame
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2016-11-21 |
| First published | 2016-08-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Henry Snopek |
| Maintainers | hhsnopek |

## Links

- npm: https://www.npmjs.com/package/code-frame
- Repository: https://github.com/hhsnopek/code-frame
- Homepage: https://github.com/hhsnopek/code-frame#readme
- Issues: https://github.com/hhsnopek/code-frame/issues
- npm.io page: https://npm.io/package/code-frame

## Dependencies (1)

- [left-pad](https://npm.io/package/left-pad.md) ^1.1.3

## Recent versions

- 5.0.0 (latest) — 2016-11-21
- 4.0.0 — 2016-09-04
- 3.0.0 — 2016-09-03
- 2.0.0 — 2016-08-19
- 1.0.1 — 2016-08-19
- 1.0.0 — 2016-08-19

## README

# Code Frame [![npm](https://img.shields.io/npm/v/code-frame.svg?style=flat-square)](https://npmjs.com/package/code-frame) [![tests](https://img.shields.io/travis/hhsnopek/code-frame.svg?style=flat-square)](https://travis-ci.org/hhsnopek/code-frame?branch=master) [![coverage](https://img.shields.io/coveralls/hhsnopek/code-frame.svg?style=flat-square)](https://coveralls.io/r/hhsnopek/code-frame?branch=master)
> Minimal Code Frame like babel-code-frame, but smaller

## Install
```bash
npm install --save code-frame
```

## Usage
```javascript
const framer = require('code-frame')

// framer('...', OffendingLine, OffendingColumn, {
//   frameSize: 3,
//   tabSize: 2
// })

// Opts:
//   'frameSize': (default: 3)
//       This is calcuation is Line - Surrounding.
//       If you provide, 3, it will capture a total of two surrounding lines.
//           2 | function (foo) {
//         > 3 |   console.log(foo
//             |                  ^
//
//       The frame is formed from bottom to top. ex: 4 = ((3 - 1) / 2) gives us 1
//       line on top and bottom. If you provide an even number, 4, you'd result in
//       2 lines above and one below.
//           2 | var bar = function (foo) {
//         > 3 |   console.log(foo
//             |                  ^
//           4 |   foo = foo ? foo : 'baz'
//
//       Inorder to get the opposite result you'd inverse the frameSize, -4
//           1 | // function bar
//           2 | var bar = function (foo) {
//         > 3 |   console.log(foo
//             |                  ^
//
//       Caveats:
//         frame cuts off if the wrapping lines hit EOF/Start of File. If the
//         frameSize is 3 and the error is on line 1:
//           > 1 | 'use strict;
//               |            ^
//
//   'tabSize': (default: 2)
//     If mixed tabs are found on anylines while constructing the frame, we
//     convert them over to spaces. You may define a positive integer.
```

## License
MIT © [Henry Snopek](https://hhsnopek.com)

---
_Source: https://npm.io/package/code-frame · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
