string.prototype.trimstart

ES2019 spec-compliant String.prototype.trimStart shim.

MIT 11 个版本
安装
npm install string.prototype.trimstart
yarn add string.prototype.trimstart
pnpm add string.prototype.trimstart
bun add string.prototype.trimstart
README

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:

var trimStart = require('string.prototype.trimstart');

assert(trimStart(' \t\na \t\n') === 'a \t\n');

if (!String.prototype.trimStart) {
	trimStart.shim();
}

assert(trimStart(' \t\na \t\n') === ' \t\na \t\n'.trimStart());

Tests

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

版本列表
1.0.8 2024-03-21
1.0.7 2023-09-05
1.0.6 2022-11-07
1.0.5 2022-05-03
1.0.4 2021-02-24
1.0.3 2020-11-22
1.0.2 2020-10-20
1.0.1 2020-04-09
1.0.0 2020-03-30
0.1.0 2017-12-19
0.0.1 2017-12-19