diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
commit | cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch) | |
tree | 92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/code-excerpt | |
parent | 3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff) |
remove node_modules
Diffstat (limited to 'node_modules/code-excerpt')
-rw-r--r-- | node_modules/code-excerpt/index.js | 38 | ||||
-rw-r--r-- | node_modules/code-excerpt/license | 21 | ||||
-rw-r--r-- | node_modules/code-excerpt/package.json | 31 | ||||
-rw-r--r-- | node_modules/code-excerpt/readme.md | 73 |
4 files changed, 0 insertions, 163 deletions
diff --git a/node_modules/code-excerpt/index.js b/node_modules/code-excerpt/index.js deleted file mode 100644 index c05f7d855..000000000 --- a/node_modules/code-excerpt/index.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -const tabsToSpaces = require('convert-to-spaces'); - -const generateLineNumbers = (line, around) => { - const lineNumbers = []; - - const min = line - around; - const max = line + around; - - for (let lineNumber = min; lineNumber <= max; lineNumber++) { - lineNumbers.push(lineNumber); - } - - return lineNumbers; -}; - -module.exports = (source, line, options) => { - if (typeof source !== 'string') { - throw new TypeError('Source code is missing.'); - } - - if (!line || line < 1) { - throw new TypeError('Line number must start from `1`.'); - } - - source = tabsToSpaces(source).split(/\r?\n/); - - if (line > source.length) { - return null; - } - - options = Object.assign({around: 3}, options); - - return generateLineNumbers(line, options.around) - .filter(line => source[line - 1] !== undefined) - .map(line => ({line, value: source[line - 1]})); -}; diff --git a/node_modules/code-excerpt/license b/node_modules/code-excerpt/license deleted file mode 100644 index 3e03f3e75..000000000 --- a/node_modules/code-excerpt/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) vdemedes <vdemedes@gmail.com> (github.com/vdemedes) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/code-excerpt/package.json b/node_modules/code-excerpt/package.json deleted file mode 100644 index 1cbefc2e2..000000000 --- a/node_modules/code-excerpt/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "code-excerpt", - "version": "2.1.1", - "description": "Extract code excerpts", - "license": "MIT", - "repository": "vadimdemedes/code-excerpt", - "author": { - "name": "vdemedes", - "email": "vdemedes@gmail.com", - "url": "github.com/vadimdemedes" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "dependencies": { - "convert-to-spaces": "^1.0.1" - }, - "devDependencies": { - "ava": "^0.16.0", - "xo": "^0.17.1" - }, - "xo": { - "esnext": true - } -} diff --git a/node_modules/code-excerpt/readme.md b/node_modules/code-excerpt/readme.md deleted file mode 100644 index 216b6b3d5..000000000 --- a/node_modules/code-excerpt/readme.md +++ /dev/null @@ -1,73 +0,0 @@ -# code-excerpt [![Build Status](https://travis-ci.org/vadimdemedes/code-excerpt.svg?branch=master)](https://travis-ci.org/vadimdemedes/code-excerpt) - -> Extract code excerpts - - -## Install - -``` -$ npm install --save code-excerpt -``` - - -## Usage - -```js -const codeExcerpt = require('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); -//=> [ -// {line: 2, value: ''}, -// {line: 3, value: 'function someFunc() {}'}, -// {line: 4, value: ''}, -// {line: 5, value: 'module.exports = () => {'}, -// {line: 6, value: ' const a = 1;'}, -// {line: 7, value: ' const b = 2;'}, -// {line: 8, value: ' const c = 3;'} -// ] -``` - - -## API - -### codeExcerpt(source, line, [options]) - -#### source - -Type: `string` - -Source code. - -#### line - -Type: `number` - -Line number to extract excerpt for. - -#### options - -##### around - -Type: `number`<br> -Default: `3` - -Number of surrounding lines to extract. - - -## License - -MIT © [Vadim Demedes](https://github.com/vadimdemedes) |