# trim-fix

> Trim string whitespace

Latest version **0.0.2** (published 2020-11-01) · 0 weekly downloads

## Install

```sh
npm install trim-fix
pnpm add trim-fix
yarn add trim-fix
bun add trim-fix
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2020-11-01 |
| First published | 2020-11-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alexey Shpakov |
| Maintainers | li0liq |
| Keywords | string, trim |

## Links

- npm: https://www.npmjs.com/package/trim-fix
- Repository: https://github.com/Li0liQ/trim-fix
- Homepage: https://github.com/Li0liQ/trim-fix#readme
- Issues: https://github.com/Li0liQ/trim-fix/issues
- npm.io page: https://npm.io/package/trim-fix

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 0.0.2 (latest) — 2020-11-01

## README

# trim-fix

  A fork of [trim](https://www.npmjs.com/package/trim) package to fix [ReDoS vulnerability](https://snyk.io/vuln/SNYK-JS-TRIM-1017038)

  Trims string whitespace.

## How to fix the vulnerability when using yarn

In `yarn.lock` add an entry to `resolutions` field:
```json
resolutions: {
    "trim": "npm:trim-fix@^0.0.1"
}
```
and run `yarn install`.

## Installation

```
$ npm install trim-fix
```

## API

   - [trim(str)](#trimstr)
   - [.left(str)](#leftstr)
   - [.right(str)](#rightstr)
<a name="" />
 
<a name="trimstr" />
### trim(str)
should trim leading / trailing whitespace.

```js
trim('  foo bar  ').should.equal('foo bar');
trim('\n\n\nfoo bar\n\r\n\n').should.equal('foo bar');
```

<a name="leftstr" />
### .left(str)
should trim leading whitespace.

```js
trim.left('  foo bar  ').should.equal('foo bar  ');
```

<a name="rightstr" />
### .right(str)
should trim trailing whitespace.

```js
trim.right('  foo bar  ').should.equal('  foo bar');
```

---
_Source: https://npm.io/package/trim-fix · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
