818969eaa0b5dab4e94841f178709b51a672182aae351764ac399154698e47127289e63a70d6463af094ee984d2a33cd9161d9c44282d47ec7fc886ffcef3f 2.3 KB

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