Skip to content
Left pad each line in a string
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitattributes
.gitignore
.travis.yml
index.js
license
package.json
readme.md
screenshot.png
test.js

readme.md

lpad Build Status

Left pad each line in a string

Install

$ npm install --save lpad

Usage

const lpad = require('lpad');

const str = 'foo\nbar';
/*
foo
bar
*/

lpad(str, '    ');
/*
    foo
    bar
*/

API

lpad(input, pad)

Pads each line in a string with the supplied string.

input

Type: string

String that will be padded.

pad

Type: string

String that will be prepended to each line.

License

MIT © Sindre Sorhus

You can’t perform that action at this time.