1 | # String.prototype.trimEnd <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
---|
2 |
|
---|
3 | [![github actions][actions-image]][actions-url]
|
---|
4 | [![coverage][codecov-image]][codecov-url]
|
---|
5 | [![dependency status][deps-svg]][deps-url]
|
---|
6 | [![dev dependency status][dev-deps-svg]][dev-deps-url]
|
---|
7 | [![License][license-image]][license-url]
|
---|
8 | [![Downloads][downloads-image]][downloads-url]
|
---|
9 |
|
---|
10 | [![npm badge][npm-badge-png]][package-url]
|
---|
11 |
|
---|
12 | An ES2019-spec-compliant `String.prototype.trimEnd` shim. Invoke its "shim" method to shim `String.prototype.trimEnd` if it is unavailable.
|
---|
13 |
|
---|
14 | 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.
|
---|
15 |
|
---|
16 | Most common usage:
|
---|
17 | ```js
|
---|
18 | var trimEnd = require('string.prototype.trimend');
|
---|
19 |
|
---|
20 | assert(trimEnd(' \t\na \t\n') === 'a \t\n');
|
---|
21 |
|
---|
22 | if (!String.prototype.trimEnd) {
|
---|
23 | trimEnd.shim();
|
---|
24 | }
|
---|
25 |
|
---|
26 | assert(trimEnd(' \t\na \t\n ') === ' \t\na \t\n '.trimEnd());
|
---|
27 | ```
|
---|
28 |
|
---|
29 | ## Tests
|
---|
30 | Simply clone the repo, `npm install`, and run `npm test`
|
---|
31 |
|
---|
32 | [package-url]: https://npmjs.com/package/string.prototype.trimend
|
---|
33 | [npm-version-svg]: https://vb.teelaun.ch/es-shims/String.prototype.trimEnd.svg
|
---|
34 | [deps-svg]: https://david-dm.org/es-shims/String.prototype.trimEnd.svg
|
---|
35 | [deps-url]: https://david-dm.org/es-shims/String.prototype.trimEnd
|
---|
36 | [dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.trimEnd/dev-status.svg
|
---|
37 | [dev-deps-url]: https://david-dm.org/es-shims/String.prototype.trimEnd#info=devDependencies
|
---|
38 | [npm-badge-png]: https://nodei.co/npm/string.prototype.trimend.png?downloads=true&stars=true
|
---|
39 | [license-image]: https://img.shields.io/npm/l/string.prototype.trimend.svg
|
---|
40 | [license-url]: LICENSE
|
---|
41 | [downloads-image]: https://img.shields.io/npm/dm/string.prototype.trimend.svg
|
---|
42 | [downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.trimend
|
---|
43 | [codecov-image]: https://codecov.io/gh/es-shims/String.prototype.trimEnd/branch/main/graphs/badge.svg
|
---|
44 | [codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.trimEnd/
|
---|
45 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.trimEnd
|
---|
46 | [actions-url]: https://github.com/es-shims/String.prototype.trimEnd/actions
|
---|