# string.prototype.padstart

> ES2017 spec-compliant String.prototype.padStart shim.

Latest version **3.1.7** (published 2025-03-14) · MIT license · 0 weekly downloads

> **Native alternative:** String.prototype.padStart — Use native JavaScript (Node 8.0.0+) (https://developer.mozilla.orgGlobal_Objects/String/padStart)

## Install

```sh
npm install string.prototype.padstart
pnpm add string.prototype.padstart
yarn add string.prototype.padstart
bun add string.prototype.padstart
```

## Health

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

Positive: no vulnerabilities.

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

Negative: stale.

## Facts

| | |
|---|---|
| Version | 3.1.7 |
| Published | 2025-03-14 |
| First published | 2015-11-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.4 |
| Dependencies | 5 |
| Unpacked size | 18.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Jordan Harband |
| Maintainers | ljharb |
| Keywords | String.prototype.padLeft, String.prototype.padStart, string, ES8, ES2017, shim, trim, padLeft, padRight, padStart, padEnd, polyfill, es-shim API |

## Links

- npm: https://www.npmjs.com/package/string.prototype.padstart
- Repository: https://github.com/es-shims/String.prototype.padStart
- Homepage: https://github.com/es-shims/String.prototype.padStart#readme
- Issues: https://github.com/es-shims/String.prototype.padStart/issues
- Funding: https://github.com/sponsors/ljharb
- npm.io page: https://npm.io/package/string.prototype.padstart

## Dependencies (5)

- [call-bind](https://npm.io/package/call-bind.md) ^1.0.8
- [call-bound](https://npm.io/package/call-bound.md) ^1.0.4
- [es-abstract](https://npm.io/package/es-abstract.md) ^1.23.9
- [es-object-atoms](https://npm.io/package/es-object-atoms.md) ^1.1.1
- [define-properties](https://npm.io/package/define-properties.md) ^1.2.1

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 3.1.7 (latest) — 2025-03-14
- 3.1.6 — 2024-03-17
- 3.1.5 — 2023-08-29
- 3.1.4 — 2022-11-07
- 3.1.3 — 2021-10-05
- 3.1.2 — 2021-02-20
- 3.1.1 — 2020-11-21
- 3.1.0 — 2019-12-14
- 3.0.0 — 2015-11-17

## README

# String.prototype.padStart <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

An ES2017 spec-compliant `String.prototype.padStart` shim. Invoke its "shim" method to shim `String.prototype.padStart` if it is unavailable.

This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://github.com/tc39/ecma262/pull/581).

Most common usage:
```js
var padStart = require('string.prototype.padstart');

assert(padStart('foo', 5, 'bar') === 'bafoo');

padStart.shim();

assert(padStart('foo', 2) === 'foo'.padStart(2));
```

## Tests
Simply clone the repo, `npm install`, and run `npm test`

[package-url]: https://npmjs.com/package/string.prototype.padstart
[npm-version-svg]: http://versionbadg.es/es-shims/String.prototype.padStart.svg
[travis-svg]: https://travis-ci.org/es-shims/String.prototype.padStart.svg
[travis-url]: https://travis-ci.org/es-shims/String.prototype.padStart
[deps-svg]: https://david-dm.org/es-shims/String.prototype.padStart.svg
[deps-url]: https://david-dm.org/es-shims/String.prototype.padStart
[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.padStart/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.padStart#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/string.prototype.padstart.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/string.prototype.padstart.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/string.prototype.padstart.svg
[downloads-url]: http://npm-stat.com/charts.html?package=string.prototype.padstart
[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.padStart/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.padStart/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.padStart
[actions-url]: https://github.com/es-shims/String.prototype.padStart/actions

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