Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/es-shims/String.prototype.trimright
ES2019 spec-compliant shim for String.prototype.trimRight.
https://github.com/es-shims/String.prototype.trimright
ecmascript javascript polyfill shim string trim trimend trimright
Last synced: about 1 month ago
JSON representation
ES2019 spec-compliant shim for String.prototype.trimRight.
- Host: GitHub
- URL: https://github.com/es-shims/String.prototype.trimright
- Owner: es-shims
- License: mit
- Created: 2015-07-29T21:49:09.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2022-11-07T22:47:16.000Z (about 2 years ago)
- Last Synced: 2024-05-12T14:42:20.313Z (7 months ago)
- Topics: ecmascript, javascript, polyfill, shim, string, trim, trimend, trimright
- Language: JavaScript
- Homepage: https://github.com/tc39/proposal-string-left-right-trim
- Size: 86.9 KB
- Stars: 8
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ponyfills - string.prototype.trimright - [`String.prototype.trimEnd`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/TrimEnd) (Strings)
README
# String.prototype.trimRight [![Version Badge][npm-version-svg]][package-url]
[![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]
A ES2019-spec-compliant `String.prototype.trimRight` shim. Invoke its "shim" method to shim `String.prototype.trimRight` 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://262.ecma-international.org/6.0/#sec-object.assign). In an ES6 environment, it will also work properly with `Symbol`s.
Most common usage:
```js
var trimRight = require('string.prototype.trimright');assert(trimRight(' \t\na \t\n') === 'a \t\n');
if (!String.prototype.trimRight) {
trimRight.shim();
}assert(trimRight(' \t\na \t\n ') === ' \t\na \t\n '.trimRight());
```## Tests
Simply clone the repo, `npm install`, and run `npm test`[package-url]: https://npmjs.com/package/string.prototype.trimright
[npm-version-svg]: https://vb.teelaun.ch/es-shims/String.prototype.trimRight.svg
[deps-svg]: https://david-dm.org/es-shims/String.prototype.trimRight.svg
[deps-url]: https://david-dm.org/es-shims/String.prototype.trimRight
[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.trimRight/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.trimRight#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/string.prototype.trimright.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/string.prototype.trimright.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/string.prototype.trimright.svg
[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.trimright
[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.trimRight/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.trimRight/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.trimRight
[actions-url]: https://github.com/es-shims/String.prototype.trimRight/actions