diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:38:50 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:40:43 +0200 |
commit | 7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch) | |
tree | 6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/equal-length | |
parent | 963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff) |
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/equal-length')
-rw-r--r-- | node_modules/equal-length/index.js | 20 | ||||
-rw-r--r-- | node_modules/equal-length/license | 21 | ||||
-rw-r--r-- | node_modules/equal-length/package.json | 32 | ||||
-rw-r--r-- | node_modules/equal-length/readme.md | 44 |
4 files changed, 117 insertions, 0 deletions
diff --git a/node_modules/equal-length/index.js b/node_modules/equal-length/index.js new file mode 100644 index 000000000..2085dde66 --- /dev/null +++ b/node_modules/equal-length/index.js @@ -0,0 +1,20 @@ +'use strict'; + +module.exports = input => { + if (typeof input !== 'string') { + throw new TypeError(`Expected input to be a string, got ${typeof input}`); + } + + const lines = input.split('\n'); + const maxLength = Math.max.apply(null, lines.map(line => line.length)); + + return lines + .map(line => { + if (line.length < maxLength) { + line += ' '.repeat(maxLength - line.length); + } + + return line; + }) + .join('\n'); +}; diff --git a/node_modules/equal-length/license b/node_modules/equal-length/license new file mode 100644 index 000000000..03ded2f68 --- /dev/null +++ b/node_modules/equal-length/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vadim Demedes <vdemedes@gmail.com> (github.com/vadimdemedes) + +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/equal-length/package.json b/node_modules/equal-length/package.json new file mode 100644 index 000000000..406e9051b --- /dev/null +++ b/node_modules/equal-length/package.json @@ -0,0 +1,32 @@ +{ + "name": "equal-length", + "version": "1.0.1", + "description": "Extend lines to equal length", + "license": "MIT", + "repository": "vadimdemedes/equal-length", + "author": { + "name": "vdemedes", + "email": "vdemedes@gmail.com", + "url": "github.com/vadimdemedes" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "equal", + "line" + ], + "devDependencies": { + "ava": "^0.17.0", + "xo": "^0.17.1" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/equal-length/readme.md b/node_modules/equal-length/readme.md new file mode 100644 index 000000000..df7a82af8 --- /dev/null +++ b/node_modules/equal-length/readme.md @@ -0,0 +1,44 @@ +# equal-length [![Build Status](https://travis-ci.org/vadimdemedes/equal-length.svg?branch=master)](https://travis-ci.org/vadimdemedes/equal-length) + +> Extend lines to equal length + + +## Install + +``` +$ npm install --save equal-length +``` + + +## Usage + +*.join() and .split() are used only to demo line length* + +```js +const equalLength = require('equal-length'); + +equalLength([ + 'abc', + 'a' +].join('\n')).split('\n'); +// => [ +// 'abc', +// 'a ' +// ] +``` + + +## API + +### equalLength(input) + +#### input + +Type: `string` + +Multiline string. + + +## License + +MIT © [Vadim Demedes](https://github.com/vadimdemedes) |