code-excerpt 
Extract code excerpts
Install
$ npm install --save code-excerpt
Usage
import codeExcerpt from 'code-excerpt';
const source = `
'use strict';
function someFunc() {}
module.exports = () => {
const a = 1;
const b = 2;
const c = 3;
someFunc();
};
`.trim();
const excerpt = codeExcerpt(source, 5);
API
codeExcerpt(source, line, [options])
source
Type: string
Source code.
line
Type: number
Line number to extract excerpt for.
options
around
Type: number
Default: 3
Number of surrounding lines to extract.