# string.prototype.trimend

> ES2019 spec-compliant String.prototype.trimEnd shim.

Latest version **1.0.10** (published 2026-06-06) · MIT license · 0 weekly downloads

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

## Install

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

## Health

**Score 45/100 (D)** — status: active.

Positive: no vulnerabilities.

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

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2026-06-06 |
| First published | 2017-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.4 |
| Dependencies | 4 |
| Unpacked size | 24.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Jordan Harband |
| Maintainers | khaledelansari, ljharb |
| Keywords | es6, es7, es8, javascript, prototype, polyfill, utility, trim, trimLeft, trimRight, trimStart, trimEnd, tc39 |

## Links

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

## Dependencies (4)

- [call-bind](https://npm.io/package/call-bind.md) ^1.0.9
- [call-bound](https://npm.io/package/call-bound.md) ^1.0.4
- [es-object-atoms](https://npm.io/package/es-object-atoms.md) ^1.1.2
- [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

- 1.0.10 (latest) — 2026-06-06
- 1.0.9 — 2024-12-11
- 1.0.8 — 2024-03-17
- 1.0.7 — 2023-09-07
- 1.0.6 — 2022-11-07
- 1.0.5 — 2022-05-03
- 1.0.4 — 2021-02-24
- 1.0.3 — 2020-11-22
- 1.0.2 — 2020-10-20
- 1.0.1 — 2020-04-09
- 1.0.0 — 2020-03-30
- 0.1.0 — 2017-12-19
- 0.0.1 — 2017-12-19

## README

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

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

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

An ES2019-spec-compliant `String.prototype.trimEnd` shim. Invoke its "shim" method to shim `String.prototype.trimEnd` 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://www.ecma-international.org/ecma-262/6.0/#sec-object.assign). In an ES6 environment, it will also work properly with `Symbol`s.

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

assert(trimEnd(' \t\na \t\n') === 'a \t\n');

if (!String.prototype.trimEnd) {
	trimEnd.shim();
}

assert(trimEnd(' \t\na \t\n ') === ' \t\na \t\n '.trimEnd());
```

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

[package-url]: https://npmjs.com/package/string.prototype.trimend
[npm-version-svg]: https://vb.teelaun.ch/es-shims/String.prototype.trimEnd.svg
[deps-svg]: https://david-dm.org/es-shims/String.prototype.trimEnd.svg
[deps-url]: https://david-dm.org/es-shims/String.prototype.trimEnd
[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.trimEnd/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.trimEnd#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/string.prototype.trimend.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/string.prototype.trimend.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/string.prototype.trimend.svg
[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.trimend
[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.trimEnd/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.trimEnd/
[actions-image]: https://img.shields.io/github/check-runs/es-shims/String.prototype.trimEnd/main
[actions-url]: https://github.com/es-shims/String.prototype.trimEnd/actions

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