# node-string-pad

> String padding module

Latest version **0.0.4** (published 2014-02-23) · BSD license · 0 weekly downloads

## Install

```sh
npm install node-string-pad
pnpm add node-string-pad
yarn add node-string-pad
bun add node-string-pad
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2014-02-23 |
| First published | 2014-02-22 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Nguyen Tuan Anh |
| Maintainers | netcell |
| Keywords | string, padding, pad |

## Links

- npm: https://www.npmjs.com/package/node-string-pad
- Repository: http://github.com/netcell/node-string-pad
- Issues: http://github.com/netcell/node-string-pad/issues
- npm.io page: https://npm.io/package/node-string-pad

## Dependencies (1)

- [args-js](https://npm.io/package/args-js.md) ~0.10.4

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2014-02-23
- 0.0.3 — 2014-02-22
- 0.0.2 — 2014-02-22
- 0.0.1 — 2014-02-22
- 0.0.0 — 2014-02-22

## README

node-string-pad is a simple function to pad strings.
Original code from [http://www.webtoolkit.info/](http://www.webtoolkit.info/), modified by me as node.js module with better arguments input.

Installing
----------

```bash
npm install node-string-pad
```

Usage
-------

```javascript
var pad = require('node-string-pad');

var padded_string = pad(string, len, [direction, character]);
```

Default: pad RIGHT using ' '.

```javascript
pad('pad', 7).should.equal('pad    ');
```

Direction can be 'RIGHT' or 'LEFT' or 'BOTH', though 'RIGHT' can be omitted.

```javascript
pad('pad', 7, '_').should.equal('pad____');
pad('pad', 7, 'LEFT', '_').should.equal('pad____');
pad('pad', 7, 'BOTH', '_').should.equal('__pad__');
```

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