JSPM

trim-fix

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q10801F

Trim string whitespace

Package Exports

  • trim-fix

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (trim-fix) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

trim-fix

A fork of trim package to fix ReDoS vulnerability

Trims string whitespace.

How to fix the vulnerability when using yarn

In yarn.lock add an entry to resolutions field:

resolutions: {
    "trim": "npm:trim-fix@^0.0.1"
}

and run yarn install.

Installation

$ npm install trim-fix

API

### trim(str) should trim leading / trailing whitespace.
trim('  foo bar  ').should.equal('foo bar');
trim('\n\n\nfoo bar\n\r\n\n').should.equal('foo bar');
### .left(str) should trim leading whitespace.
trim.left('  foo bar  ').should.equal('foo bar  ');
### .right(str) should trim trailing whitespace.
trim.right('  foo bar  ').should.equal('  foo bar');