# lpad

> Left-pad each line in a string

Latest version **3.0.0** (published 2021-04-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install lpad
pnpm add lpad
yarn add lpad
bun add lpad
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-04-08 |
| First published | 2013-04-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 1 |
| Unpacked size | 2.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | pad, indent, format, string, padding |

## Links

- npm: https://www.npmjs.com/package/lpad
- Repository: https://github.com/sindresorhus/lpad
- Homepage: https://github.com/sindresorhus/lpad#readme
- Issues: https://github.com/sindresorhus/lpad/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/lpad

## Dependencies (1)

- [split-lines](https://npm.io/package/split-lines.md) ^3.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2021-04-08
- 2.0.1 — 2015-06-15
- 2.0.0 — 2015-04-29
- 1.0.0 — 2014-08-13
- 0.2.1 — 2014-03-06
- 0.2.0 — 2014-03-06
- 0.1.0 — 2013-04-06

## README

# lpad

> Left-pad each line in a string

![](screenshot.png)

## Install

```
$ npm install lpad
```

## Usage

```js
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.

---
_Source: https://npm.io/package/lpad · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
