项目作者: es-shims

项目描述 :
ES2019 spec-compliant String.prototype.trimEnd shim
高级语言: JavaScript
项目地址: git://github.com/es-shims/String.prototype.trimEnd.git
创建时间: 2017-12-18T20:04:00Z
项目社区:https://github.com/es-shims/String.prototype.trimEnd

开源协议:MIT License

下载


String.prototype.trimEnd Version Badge

github actions
coverage
dependency status
dev dependency status
License
Downloads

npm badge

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 interface. It works in an ES3-supported environment and complies with the spec. In an ES6 environment, it will also work properly with Symbols.

Most common usage:

  1. var trimEnd = require('string.prototype.trimend');
  2. assert(trimEnd(' \t\na \t\n') === 'a \t\n');
  3. if (!String.prototype.trimEnd) {
  4. trimEnd.shim();
  5. }
  6. assert(trimEnd(' \t\na \t\n ') === ' \t\na \t\n '.trimEnd());

Tests

Simply clone the repo, npm install, and run npm test