Socket
Socket
Sign inDemoInstall

string.prototype.trim

Package Overview
Dependencies
64
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    string.prototype.trim

ES5 spec-compliant shim for String.prototype.trim


Version published
Maintainers
1
Install size
1.52 MB
Created

Changelog

Source

v1.2.2 - 2020-09-15

Commits

  • [Tests] use nyc for coverage [0884270`](https://github.com/es-shims/String.prototype.trim/commit/0884270b26f7e6f7602d9f355dc3b4d5cd12d97e)
  • [Tests] add implementation tests 475c480
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape d70d913
  • [actions] add "Allow Edits" workflow 6e6be23
  • [Refactor] use RequireObjectCoercible instead of CheckObjectCoercible 5bfaf17
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape, functions-have-names; add safe-publish-latest 65be600
  • [Deps] update es-abstract, remove function-bind 5f4d1ec
  • [Refactor] switch from 2019 to 2020 AOs 4c2d5d2
  • [Dev Deps] update auto-changelog, tape c7fc9e2
  • [Dev Deps] update auto-changelog; add aud e1dec36
  • [actions] switch Automatic Rebase workflow to pull_request_target event 35826c2
  • [Deps] update es-abstract 54095ef
  • [Deps] update es-abstract 486dd9c

Readme

Source

String.prototype.trim Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

browser support

An ES5 spec-compliant String.prototype.trim shim. Invoke its "shim" method to shim String.prototype.trim if it is unavailable.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.

Most common usage:

var assert = require('assert');
var trim = require('string.prototype.trim');

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

trim.shim(); // will be a no-op if not needed

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

Engine Bugs

Some implementations of String#trim incorrectly trim zero-width spaces. This shim detects and corrects this behavior.

Tests

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

Keywords

FAQs

Last updated on 15 Sep 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc