lpad

v1.0.0
Left pad each line in a string
pad indent format string str

lpad

Left-pad each line in a string

Install

$ npm install lpad

Usage

import leftPad from 'lpad';

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

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

API

lpad(string, padString)

Pads each line in a string with the supplied string.

string

Type: string

String that will be padded.

padString

Type: string

String that will be prepended to each line.

Metadata

  • MIT
  • >=0.10.0
  • Sindre Sorhus
  • released 8/13/2014

Downloads

Maintainers