项目作者: es-shims

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

开源协议:MIT License

下载


String.prototype.trimStart Version Badge

github actions
coverage
dependency status
dev dependency status
License
Downloads

npm badge

An ES2019-spec-compliant String.prototype.trimStart shim. Invoke its “shim” method to shim String.prototype.trimStart 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 trimStart = require('string.prototype.trimstart');
  2. assert(trimStart(' \t\na \t\n') === 'a \t\n');
  3. if (!String.prototype.trimStart) {
  4. trimStart.shim();
  5. }
  6. assert(trimStart(' \t\na \t\n') === ' \t\na \t\n'.trimStart());

Tests

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