Kevin 29b9a0c50c clean && clean html base | 4 years ago | |
---|---|---|
.. | ||
cli.js | 4 years ago | |
index.js | 4 years ago | |
license | 4 years ago | |
package.json | 4 years ago | |
readme.md | 4 years ago |
Left pad a string to align with the longest string in an array
$ npm install --save lpad-align
const lpadAlign = require('lpad-align');
const words = [
'foo',
'foobar',
'foobarcat'
];
for (const x of words) {
console.log(lpadAlign(x, words, 4));
}
/*
foo
foobar
foobarcat
*/
Type: string
String that will be padded.
Type: Array
Array to align against.
Type: number
Default: 4
Indentation to prepend the string with.
$ npm install --global lpad-align
Usage
$ cat <file> | lpad-align
Example
$ cat unicorn.txt | lpad-align
foo
foobar
foobarcat
MIT © Kevin Mårtensson