pax_global_header 0000666 0000000 0000000 00000000064 15210735731 0014516 g ustar 00root root 0000000 0000000 52 comment=9f316ac605e94df4e34c54049be6eb18d3bae83c
es-shims-String.prototype.trimEnd-4928602/ 0000775 0000000 0000000 00000000000 15210735731 0020357 5 ustar 00root root 0000000 0000000 es-shims-String.prototype.trimEnd-4928602/.editorconfig 0000664 0000000 0000000 00000000436 15210735731 0023037 0 ustar 00root root 0000000 0000000 root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 150
[CHANGELOG.md]
indent_style = space
indent_size = 2
[*.json]
max_line_length = off
[Makefile]
max_line_length = off
es-shims-String.prototype.trimEnd-4928602/.eslintrc 0000664 0000000 0000000 00000000447 15210735731 0022210 0 ustar 00root root 0000000 0000000 {
"root": true,
"extends": "@ljharb",
"rules": {
"id-length": "off",
"new-cap": ["error", {
"capIsNewExceptions": [
"RequireObjectCoercible",
],
}],
},
"overrides": [
{
"files": "test/**",
"rules": {
"id-length": 0,
"no-invalid-this": 1,
},
},
],
}
es-shims-String.prototype.trimEnd-4928602/.github/ 0000775 0000000 0000000 00000000000 15210735731 0021717 5 ustar 00root root 0000000 0000000 es-shims-String.prototype.trimEnd-4928602/.github/workflows/ 0000775 0000000 0000000 00000000000 15210735731 0023754 5 ustar 00root root 0000000 0000000 es-shims-String.prototype.trimEnd-4928602/.github/workflows/node-aught.yml 0000664 0000000 0000000 00000000533 15210735731 0026533 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js < 10'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '< 10'
type: minors
command: npm run tests-only
node:
name: 'node < 10'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: true
es-shims-String.prototype.trimEnd-4928602/.github/workflows/node-pretest.yml 0000664 0000000 0000000 00000000245 15210735731 0027111 0 ustar 00root root 0000000 0000000 name: 'Tests: pretest/posttest'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/pretest.yml@main
es-shims-String.prototype.trimEnd-4928602/.github/workflows/node-tens.yml 0000664 0000000 0000000 00000000547 15210735731 0026401 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js 10 - 20'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 10 < 20'
type: minors
command: npm run tests-only
node:
name: 'node 10 - 20'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: true
es-shims-String.prototype.trimEnd-4928602/.github/workflows/node-twenties.yml 0000664 0000000 0000000 00000000536 15210735731 0027270 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js >= 20'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 20'
type: minors
command: npm run tests-only
node:
name: 'node >= 20'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: true
es-shims-String.prototype.trimEnd-4928602/.github/workflows/rebase.yml 0000664 0000000 0000000 00000000473 15210735731 0025744 0 ustar 00root root 0000000 0000000 name: Automatic Rebase
on: [pull_request_target]
permissions:
contents: write # for ljharb/rebase to push code to rebase
pull-requests: read # for ljharb/rebase to get info about PR
jobs:
_:
uses: ljharb/actions/.github/workflows/rebase.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
es-shims-String.prototype.trimEnd-4928602/.github/workflows/require-allow-edits.yml 0000664 0000000 0000000 00000000515 15210735731 0030376 0 ustar 00root root 0000000 0000000 name: Require “Allow Edits”
on: [pull_request_target]
permissions:
contents: read
jobs:
_:
permissions:
pull-requests: read # for ljharb/require-allow-edits to check 'allow edits' on PR
name: "Require “Allow Edits”"
runs-on: ubuntu-latest
steps:
- uses: ljharb/require-allow-edits@main
es-shims-String.prototype.trimEnd-4928602/.gitignore 0000664 0000000 0000000 00000001173 15210735731 0022351 0 ustar 00root root 0000000 0000000 # Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage/
.nyc_output/
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock
.npmignore
es-shims-String.prototype.trimEnd-4928602/.npmrc 0000664 0000000 0000000 00000000067 15210735731 0021502 0 ustar 00root root 0000000 0000000 allow-same-version=true
message=v%s
package-lock=false
es-shims-String.prototype.trimEnd-4928602/.nycrc 0000664 0000000 0000000 00000000213 15210735731 0021472 0 ustar 00root root 0000000 0000000 {
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}
es-shims-String.prototype.trimEnd-4928602/CHANGELOG.md 0000664 0000000 0000000 00000030735 15210735731 0022200 0 ustar 00root root 0000000 0000000 # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.0.10](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.9...v1.0.10) - 2026-06-05
### Commits
- [Fix] avoid quadratic runtime trimming strings with large internal whitespace runs [`14ee151`](https://github.com/es-shims/String.prototype.trimEnd/commit/14ee1516d13537c2c63afa56c85048ead5f2e7c8)
- [actions] update workflows [`867fda8`](https://github.com/es-shims/String.prototype.trimEnd/commit/867fda84fa544487659ed49407ab53986cf67897)
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `eslint`, `has-strict-mode`, `npmignore` [`c1dad08`](https://github.com/es-shims/String.prototype.trimEnd/commit/c1dad08e7b3410f7cf37d0031452db166a671b3f)
- [Deps] update `call-bind`, `call-bound`, `es-object-atoms` [`9f23631`](https://github.com/es-shims/String.prototype.trimEnd/commit/9f23631ac981b82d3f769b20538c3b429dc86e93)
- [readme] remove dead badges [`5156bc8`](https://github.com/es-shims/String.prototype.trimEnd/commit/5156bc89dfaceb0bbfb48c553517db9242a5c09a)
- [readme] replace runkit CI badge with shields.io check-runs badge [`79f9686`](https://github.com/es-shims/String.prototype.trimEnd/commit/79f96868928b28ce477bcbd01d8d4b55e60753e6)
## [v1.0.9](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.8...v1.0.9) - 2024-12-11
### Commits
- [actions] split out node 10-20, and 20+ [`7e5ffdc`](https://github.com/es-shims/String.prototype.trimEnd/commit/7e5ffdc2ab30b09e19773f35df5dceffddc660d4)
- [meta] sort package.json mildly [`2f99c8b`](https://github.com/es-shims/String.prototype.trimEnd/commit/2f99c8bc69d50dc0c56af3900cc31129ef42bc1b)
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `auto-changelog`, `tape` [`2774fe6`](https://github.com/es-shims/String.prototype.trimEnd/commit/2774fe6660c9de92eacf2a8173f494aa151b1fc1)
- [Refactor] use `call-bound` directly [`9e3bbec`](https://github.com/es-shims/String.prototype.trimEnd/commit/9e3bbec66695b715ec38f832aa472e1a82ffe095)
- [Tests] replace `aud` with `npm audit` [`cb9a462`](https://github.com/es-shims/String.prototype.trimEnd/commit/cb9a4623b86d2a91cb0a5b704739b6fe43078abd)
- [meta] add missing `engines.node` [`f46c829`](https://github.com/es-shims/String.prototype.trimEnd/commit/f46c829985a3c78e92482247fe30800781b4a9e3)
- [Deps] update `call-bind` [`e892c32`](https://github.com/es-shims/String.prototype.trimEnd/commit/e892c32d30aaaee372c8159b7ac94d564cf7f0e9)
- [Dev Deps] add missing peer dep [`e1a59da`](https://github.com/es-shims/String.prototype.trimEnd/commit/e1a59da39cc18bbe546371b12d39f86b4c947896)
## [v1.0.8](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.7...v1.0.8) - 2024-03-16
### Commits
- [Refactor] replace `es-abstract` with `es-object-atoms` [`0df2b01`](https://github.com/es-shims/String.prototype.trimEnd/commit/0df2b018d3ba214e2435b9841a7a03fc06c24fd0)
- [Dev Deps] update `aud`, `npmignore`, `tape` [`190e9c5`](https://github.com/es-shims/String.prototype.trimEnd/commit/190e9c5d74f84d8f90f61c9e9ad4b05f657df830)
## [v1.0.7](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.6...v1.0.7) - 2023-09-07
### Commits
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`1a10293`](https://github.com/es-shims/String.prototype.trimEnd/commit/1a102935636b564cd346d83666f62a9398864081)
- [Deps] update `define-properties`, `es-abstract` [`6ba2e19`](https://github.com/es-shims/String.prototype.trimEnd/commit/6ba2e19a78f9c63bad2daf0627ce7f2e33f1aeb9)
## [v1.0.6](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.5...v1.0.6) - 2022-11-07
### Commits
- [meta] use `npmignore` to autogenerate an npmignore file [`1d1e717`](https://github.com/es-shims/String.prototype.trimEnd/commit/1d1e71720ada81e484c9bffb386f65d7a6a1335e)
- [actions] update rebase action to use reusable workflow [`83f2683`](https://github.com/es-shims/String.prototype.trimEnd/commit/83f268325cc37ca72bea995281167a9d2821810b)
- [Dev Deps] update `aud`, `tape` [`a3a9129`](https://github.com/es-shims/String.prototype.trimEnd/commit/a3a9129dd995a949bdb93d278f403aa400e088ed)
- [Deps] update `es-abstract` [`a6e476d`](https://github.com/es-shims/String.prototype.trimEnd/commit/a6e476dc0120a41a22e66b5079bf3b407da387fa)
## [v1.0.5](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.4...v1.0.5) - 2022-05-02
### Commits
- [actions] reuse common workflows [`69a56ce`](https://github.com/es-shims/String.prototype.trimEnd/commit/69a56ce95343848d5e498f8e939a0697db8ac9f2)
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5d7db31`](https://github.com/es-shims/String.prototype.trimEnd/commit/5d7db314948faac975705db56305b6cc3dae7ba9)
- [Fix] ensure main entry point properly checks the receiver in ES3 engines [`bb1983d`](https://github.com/es-shims/String.prototype.trimEnd/commit/bb1983dc27504733ab883a42f55b134f679a642d)
- [Fix] as of unicode v6, the mongolian vowel separator is no longer whitespace [`10a1091`](https://github.com/es-shims/String.prototype.trimEnd/commit/10a10916e1ffc8cdab78515b2cc521cc74c08277)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`a08e14b`](https://github.com/es-shims/String.prototype.trimEnd/commit/a08e14bfea5e27d419ef742e83f467a169a69971)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `functions-have-names`, `tape` [`1c4c8da`](https://github.com/es-shims/String.prototype.trimEnd/commit/1c4c8dab4aefc1c5823a61b5a0286bb6fe1e036c)
- [actions] update codecov uploader [`70c4a7c`](https://github.com/es-shims/String.prototype.trimEnd/commit/70c4a7c566fd5bf72475df9318ec2cd218ceca26)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `tape` [`4b08ed7`](https://github.com/es-shims/String.prototype.trimEnd/commit/4b08ed78a579585b593b3ca4ac7919d13906e840)
- [readme] add github actions/codecov badges [`9805501`](https://github.com/es-shims/String.prototype.trimEnd/commit/980550105b304385bcccb8ec05a247e02c24d04a)
- [Dev Deps] update `eslint`, `tape` [`50ec335`](https://github.com/es-shims/String.prototype.trimEnd/commit/50ec335ed42b59d1ab626dbe412f4ae23ab99b4b)
- [actions] update workflows [`bf9c32e`](https://github.com/es-shims/String.prototype.trimEnd/commit/bf9c32efe08e98b53302df67581dc971b7a758cd)
- [meta] use `prepublishOnly` script for npm 7+ [`9d921bd`](https://github.com/es-shims/String.prototype.trimEnd/commit/9d921bdbcaf8cebebbc302e6df518cbc3e4907bd)
- [Deps] update `define-properties` [`15617ce`](https://github.com/es-shims/String.prototype.trimEnd/commit/15617ced8ac2ea3ab8324a04d16fd294b12059b5)
## [v1.0.4](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.3...v1.0.4) - 2021-02-23
### Commits
- [meta] do not publish github action workflow files [`08e735c`](https://github.com/es-shims/String.prototype.trimEnd/commit/08e735cd55b00ae78a9dc16c6b4e786f7931085b)
- [readme] remove travis badge [`10e0e47`](https://github.com/es-shims/String.prototype.trimEnd/commit/10e0e47cb2ecfd171e68b40f8486c5d007dcf3ef)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `functions-have-names`, `has-strict-mode`, `tape` [`0871432`](https://github.com/es-shims/String.prototype.trimEnd/commit/0871432c70c2f6a3929acd740a5d1f57c939f345)
- [Tests] increase coverage [`711e6a6`](https://github.com/es-shims/String.prototype.trimEnd/commit/711e6a66660f30f7a30fef536be435af1a13d05c)
- [actions] update workflows [`deb0d06`](https://github.com/es-shims/String.prototype.trimEnd/commit/deb0d06f41ac1c3e1e640ecd1cf0e69303ab5799)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`e250b4a`](https://github.com/es-shims/String.prototype.trimEnd/commit/e250b4a38401e7c02a067dab26cc68316da47ef7)
- [meta] gitignore coverage output [`55231df`](https://github.com/es-shims/String.prototype.trimEnd/commit/55231dfd9829277ba5c3f07be5434dc385703ca9)
- [Deps] update `call-bind` [`0580f5f`](https://github.com/es-shims/String.prototype.trimEnd/commit/0580f5f915ecb87677764d03fe3cf023e3bee7d8)
## [v1.0.3](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.2...v1.0.3) - 2020-11-21
### Commits
- [Tests] migrate tests to Github Actions [`23e7a09`](https://github.com/es-shims/String.prototype.trimEnd/commit/23e7a09a4ad37c21c3db3d7761212c7d84a371a2)
- [Tests] add `implementation` test; run `es-shim-api` in postlint; use `tape` runner [`26e8623`](https://github.com/es-shims/String.prototype.trimEnd/commit/26e8623cf35c1859d0b482d4bb5b3450d101a810)
- [Tests] run `nyc` on all tests [`a72a546`](https://github.com/es-shims/String.prototype.trimEnd/commit/a72a546f671c5d3ac65dff68b4db1a1cc7089bfd)
- [Deps] replace `es-abstract` with `call-bind` [`f07b87d`](https://github.com/es-shims/String.prototype.trimEnd/commit/f07b87dd452090a2601d666edceb1daa90d45f24)
- [Dev Deps] update `eslint`, `aud`; add `safe-publish-latest` [`122ecb7`](https://github.com/es-shims/String.prototype.trimEnd/commit/122ecb726b1dc043b9ef27fa5a7b4172a4d5df37)
## [v1.0.2](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.1...v1.0.2) - 2020-10-20
### Commits
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`a003e71`](https://github.com/es-shims/String.prototype.trimEnd/commit/a003e7166d8de16c551a14b0ec855187357cce43)
- [actions] add "Allow Edits" workflow [`0b4b43c`](https://github.com/es-shims/String.prototype.trimEnd/commit/0b4b43cb605f7b3532e61c43dfc7f1795296c5a4)
- [Deps] update `es-abstract` [`75ca6b0`](https://github.com/es-shims/String.prototype.trimEnd/commit/75ca6b0e9757d64013ae863cfaac49ebcb36f1cf)
- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`552016c`](https://github.com/es-shims/String.prototype.trimEnd/commit/552016cb631ac13c12bbbc0d6dd65012e5e79583)
## [v1.0.1](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.0...v1.0.1) - 2020-04-09
### Commits
- [meta] add some missing repo metadata [`6abe248`](https://github.com/es-shims/String.prototype.trimEnd/commit/6abe248ba0b57a8b0e16bbe01de07a4d37c421bc)
- [Dev Deps] update `auto-changelog` [`e2eaab2`](https://github.com/es-shims/String.prototype.trimEnd/commit/e2eaab2fd1bc27a3d224b3d76db16190c1dd6d08)
## [v1.0.0](https://github.com/es-shims/String.prototype.trimEnd/compare/v0.1.0...v1.0.0) - 2020-03-30
### Commits
- [Breaking] convert to es-shim API [`2c6ef13`](https://github.com/es-shims/String.prototype.trimEnd/commit/2c6ef13d3f0b07a9bc55e367b311dbb731780405)
- [meta] add `auto-changelog` [`6f1fcc1`](https://github.com/es-shims/String.prototype.trimEnd/commit/6f1fcc1739de1e9541bd603b659807646a13dd7f)
- [meta] update readme [`ed4ce0d`](https://github.com/es-shims/String.prototype.trimEnd/commit/ed4ce0d84d53e626b48375c5959be20332464eaf)
- [Tests] add `npm run lint` [`eadaf2c`](https://github.com/es-shims/String.prototype.trimEnd/commit/eadaf2c83f2d791b54d80d7b30a9961ebc0f246f)
- Only apps should have lockfiles [`44d355f`](https://github.com/es-shims/String.prototype.trimEnd/commit/44d355f7dafcb0b51c5001824b07f7a2b9f1d06e)
- [actions] add automatic rebasing / merge commit blocking [`e78bf8e`](https://github.com/es-shims/String.prototype.trimEnd/commit/e78bf8e5fc04fcb3379dd1c98360d7df4f9ea7d6)
- [Tests] use shared travis-ci configs [`983c563`](https://github.com/es-shims/String.prototype.trimEnd/commit/983c5639efca2c9bb8b93ebbb917fbcb2561b94c)
- [meta] add `funding` field [`35139d6`](https://github.com/es-shims/String.prototype.trimEnd/commit/35139d6236ceacfc1501d08fb196d18a936ee583)
- [meta] fix non-updated version number [`a2d308b`](https://github.com/es-shims/String.prototype.trimEnd/commit/a2d308b99967ca427936c54747175794ca7336e1)
## [v0.1.0](https://github.com/es-shims/String.prototype.trimEnd/compare/v0.0.1...v0.1.0) - 2017-12-19
### Commits
- updated README [`f1c71a0`](https://github.com/es-shims/String.prototype.trimEnd/commit/f1c71a0a882e89e1c207ed2b316d91670be2b075)
## v0.0.1 - 2017-12-19
### Commits
- finished polyfill [`e58d550`](https://github.com/es-shims/String.prototype.trimEnd/commit/e58d550ab8695924ff4221ebe91f00f29801aa4b)
- created README file [`f78628a`](https://github.com/es-shims/String.prototype.trimEnd/commit/f78628ab123171f8b7759bba331d6a589702584f)
- Initial commit [`9199478`](https://github.com/es-shims/String.prototype.trimEnd/commit/9199478256da953e2f5bddfc4d82a161f4537e85)
- typo [`d1f4558`](https://github.com/es-shims/String.prototype.trimEnd/commit/d1f4558a51157833f14d8a424426d038d06576ce)
es-shims-String.prototype.trimEnd-4928602/LICENSE 0000664 0000000 0000000 00000002061 15210735731 0021363 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2017 Khaled Al-Ansari
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
es-shims-String.prototype.trimEnd-4928602/README.md 0000664 0000000 0000000 00000004252 15210735731 0021641 0 ustar 00root root 0000000 0000000 # String.prototype.trimEnd [![Version Badge][npm-version-svg]][package-url]
[![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
es-shims-String.prototype.trimEnd-4928602/auto.js 0000664 0000000 0000000 00000000044 15210735731 0021663 0 ustar 00root root 0000000 0000000 'use strict';
require('./shim')();
es-shims-String.prototype.trimEnd-4928602/implementation.js 0000664 0000000 0000000 00000001540 15210735731 0023742 0 ustar 00root root 0000000 0000000 'use strict';
var callBound = require('call-bound');
var $slice = callBound('String.prototype.slice');
var $charAt = callBound('String.prototype.charAt');
var $test = callBound('RegExp.prototype.test');
var mvsIsWS = (/^\s$/).test('\u180E');
/* eslint-disable no-control-regex */
var isWhitespace = mvsIsWS
? /* istanbul ignore next */ /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]$/
: /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]$/;
/* eslint-enable no-control-regex */
module.exports = function trimEnd() {
var S = $slice(this, 0);
var end = S.length;
while (end > 0 && $test(isWhitespace, $charAt(S, end - 1))) {
end -= 1;
}
return $slice(S, 0, end);
};
es-shims-String.prototype.trimEnd-4928602/index.js 0000664 0000000 0000000 00000001074 15210735731 0022026 0 ustar 00root root 0000000 0000000 'use strict';
var callBind = require('call-bind');
var define = require('define-properties');
var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible');
var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var shim = require('./shim');
var bound = callBind(getPolyfill());
var boundMethod = function trim(receiver) {
RequireObjectCoercible(receiver);
return bound(receiver);
};
define(boundMethod, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = boundMethod;
es-shims-String.prototype.trimEnd-4928602/package.json 0000664 0000000 0000000 00000004033 15210735731 0022645 0 ustar 00root root 0000000 0000000 {
"name": "string.prototype.trimend",
"version": "1.0.10",
"author": "Jordan Harband ",
"contributors": [
"Jordan Harband ",
"Khaled Al-Ansari "
],
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"description": "ES2019 spec-compliant String.prototype.trimEnd shim.",
"license": "MIT",
"main": "index.js",
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"lint": "eslint --ext=js,mjs .",
"postlint": "es-shim-api --bound",
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "npx npm@'>= 10.2' audit --production",
"tests-only": "nyc tape 'test/**/*.js'",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git://github.com/es-shims/String.prototype.trimEnd.git"
},
"keywords": [
"es6",
"es7",
"es8",
"javascript",
"prototype",
"polyfill",
"utility",
"trim",
"trimLeft",
"trimRight",
"trimStart",
"trimEnd",
"tc39"
],
"dependencies": {
"call-bind": "^1.0.9",
"call-bound": "^1.0.4",
"define-properties": "^1.2.1",
"es-object-atoms": "^1.1.2"
},
"devDependencies": {
"@es-shims/api": "^2.5.1",
"@ljharb/eslint-config": "^22.2.3",
"auto-changelog": "^2.6.0",
"eslint": "^8.57.1",
"functions-have-names": "^1.2.3",
"has-strict-mode": "^1.1.0",
"in-publish": "^2.0.1",
"npmignore": "^0.3.5",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"engines": {
"node": ">= 0.4"
}
}
es-shims-String.prototype.trimEnd-4928602/polyfill.js 0000664 0000000 0000000 00000000712 15210735731 0022547 0 ustar 00root root 0000000 0000000 'use strict';
var implementation = require('./implementation');
module.exports = function getPolyfill() {
if (!String.prototype.trimEnd && !String.prototype.trimRight) {
return implementation;
}
var zeroWidthSpace = '\u200b';
var trimmed = zeroWidthSpace.trimEnd ? zeroWidthSpace.trimEnd() : zeroWidthSpace.trimRight();
if (trimmed !== zeroWidthSpace) {
return implementation;
}
return String.prototype.trimEnd || String.prototype.trimRight;
};
es-shims-String.prototype.trimEnd-4928602/shim.js 0000664 0000000 0000000 00000000511 15210735731 0021652 0 ustar 00root root 0000000 0000000 'use strict';
var define = require('define-properties');
var getPolyfill = require('./polyfill');
module.exports = function shimTrimEnd() {
var polyfill = getPolyfill();
define(
String.prototype,
{ trimEnd: polyfill },
{ trimEnd: function () { return String.prototype.trimEnd !== polyfill; } }
);
return polyfill;
};
es-shims-String.prototype.trimEnd-4928602/test/ 0000775 0000000 0000000 00000000000 15210735731 0021336 5 ustar 00root root 0000000 0000000 es-shims-String.prototype.trimEnd-4928602/test/implementation.js 0000664 0000000 0000000 00000001175 15210735731 0024725 0 ustar 00root root 0000000 0000000 'use strict';
var implementation = require('../implementation');
var callBind = require('call-bind');
var test = require('tape');
var hasStrictMode = require('has-strict-mode')();
var runTests = require('./tests');
test('as a function', function (t) {
t.test('bad array/this value', { skip: !hasStrictMode }, function (st) {
/* eslint no-useless-call: 0 */
st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object');
st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object');
st.end();
});
runTests(callBind(implementation), t);
t.end();
});
es-shims-String.prototype.trimEnd-4928602/test/index.js 0000664 0000000 0000000 00000000666 15210735731 0023013 0 ustar 00root root 0000000 0000000 'use strict';
var trimEnd = require('../');
var test = require('tape');
var runTests = require('./tests');
test('as a function', function (t) {
t.test('bad array/this value', function (st) {
st['throws'](function () { trimEnd(undefined, 'a'); }, TypeError, 'undefined is not an object');
st['throws'](function () { trimEnd(null, 'a'); }, TypeError, 'null is not an object');
st.end();
});
runTests(trimEnd, t);
t.end();
});
es-shims-String.prototype.trimEnd-4928602/test/shimmed.js 0000664 0000000 0000000 00000002507 15210735731 0023326 0 ustar 00root root 0000000 0000000 'use strict';
require('../auto');
var runTests = require('./tests');
var test = require('tape');
var defineProperties = require('define-properties');
var callBind = require('call-bind');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var functionsHaveNames = require('functions-have-names')();
test('shimmed', function (t) {
t.equal(String.prototype.trimEnd.length, 0, 'String#trimEnd has a length of 0');
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
st.equal((/^(?:trimRight|trimEnd)$/).test(String.prototype.trimEnd.name), true, 'String#trimEnd has name "trimRight" or "trimEnd"');
st.end();
});
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
et.equal(false, isEnumerable.call(String.prototype, 'trimEnd'), 'String#trimEnd is not enumerable');
et.end();
});
var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
t.test('bad string/this value', { skip: !supportsStrictMode }, function (st) {
st['throws'](function () { return String.prototype.trimEnd.call(undefined, 'a'); }, TypeError, 'undefined is not an object');
st['throws'](function () { return String.prototype.trimEnd.call(null, 'a'); }, TypeError, 'null is not an object');
st.end();
});
runTests(callBind(String.prototype.trimEnd), t);
t.end();
});
es-shims-String.prototype.trimEnd-4928602/test/tests.js 0000664 0000000 0000000 00000003314 15210735731 0023037 0 ustar 00root root 0000000 0000000 'use strict';
module.exports = function (trimEnd, t) {
t.test('normal cases', function (st) {
st.equal(trimEnd(' \t\na \t\n'), ' \t\na', 'strips whitespace off the left side');
st.equal(trimEnd('a'), 'a', 'noop when no whitespace');
var allWhitespaceChars = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
st.equal(trimEnd(allWhitespaceChars + 'a' + allWhitespaceChars), allWhitespaceChars + 'a', 'all expected whitespace chars are trimmed');
st.end();
});
t.test('pathological case', function (st) {
var manySpaces = new Array(100001).join(' ');
var input = 'A' + manySpaces + 'A' + manySpaces;
var start = Date.now();
var result = trimEnd(input);
var elapsed = Date.now() - start;
st.equal(result, 'A' + manySpaces + 'A', 'trailing whitespace is trimmed; internal whitespace is preserved');
st.ok(elapsed < 250, 'completes in linear time (took ' + elapsed + 'ms)');
st.end();
});
// see https://codeblog.jonskeet.uk/2014/12/01/when-is-an-identifier-not-an-identifier-attack-of-the-mongolian-vowel-separator/
var mongolianVowelSeparator = '\u180E';
var mvsIsWS = (/^\s$/).test(mongolianVowelSeparator);
t.test('mongolian vowel separator: unicode >= 4 && < 6.3', function (st) {
st.equal(
trimEnd(mongolianVowelSeparator + 'a' + mongolianVowelSeparator),
mongolianVowelSeparator + 'a' + (mvsIsWS ? '' : mongolianVowelSeparator),
'mongolian vowel separator is ' + (mvsIsWS ? '' : 'not ') + 'whitespace'
);
st.end();
});
t.test('zero-width spaces', function (st) {
var zeroWidth = '\u200b';
st.equal(trimEnd(zeroWidth), zeroWidth, 'zero width space does not trim');
st.end();
});
};