# s-trimmer

> Format spaces from the left and right end of a string and between strings

Latest version **1.1.1** (published 2021-05-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install s-trimmer
pnpm add s-trimmer
yarn add s-trimmer
bun add s-trimmer
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2021-05-01 |
| First published | 2020-06-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jakub Biesiada |
| Maintainers | jbiesiada |
| Keywords | string, trim, spaces, start, end, between, format |

## Links

- npm: https://www.npmjs.com/package/s-trimmer
- Repository: https://github.com/JB1905/s-trimmer
- Homepage: https://github.com/JB1905/s-trimmer#readme
- Issues: https://github.com/JB1905/s-trimmer/issues
- npm.io page: https://npm.io/package/s-trimmer

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2021-05-01
- 1.1.0-beta.1 (beta) — 2021-05-01
- 1.1.0 — 2021-05-01
- 1.0.0 — 2020-06-19

## README

# [s-trimmer](https://github.com/JB1905/s-trimmer)

[![NPM version](https://img.shields.io/npm/v/s-trimmer?style=flat-square)](https://www.npmjs.com/package/s-trimmer)
[![NPM downloads](https://img.shields.io/npm/dm/s-trimmer?style=flat-square)](https://www.npmjs.com/package/s-trimmer)
[![NPM license](https://img.shields.io/npm/l/s-trimmer?style=flat-square)](https://www.npmjs.com/package/s-trimmer)
[![Codecov](https://img.shields.io/codecov/c/github/JB1905/s-trimmer?style=flat-square)](https://codecov.io/gh/JB1905/s-trimmer)
[![Travis](https://img.shields.io/travis/com/JB1905/s-trimmer/master?style=flat-square)](https://travis-ci.com/JB1905/s-trimmer)
[![Bundle size](https://img.shields.io/bundlephobia/min/s-trimmer?style=flat-square)](https://bundlephobia.com/result?p=s-trimmer)

## About

Format spaces from the left and right end of a string and between strings

### Similar Projects

Remove spaces from text:

- [trimStart/trimLeft from String object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart)
- [trimEnd/trimRight from String object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd)
- [trim from String object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)
- [trim](https://www.npmjs.com/package/trim/) by [tjholowaychuk](https://www.npmjs.com/~tjholowaychuk/)

Remove spaces from class names (one of the many features):

- [classnames](https://github.com/JedWatson/classnames/) by [Jed Watson](https://github.com/JedWatson/)
- [clsx](https://github.com/lukeed/clsx/) by [Luke Edwards](https://github.com/lukeed/)

## How to Install

First, install the library in your project by npm:

```sh
$ npm install s-trimmer
```

Or Yarn:

```sh
$ yarn add s-trimmer
```

## Getting Started

**Connect libary to project using ES6 import:**

```js
import sTrimmer, {
  trimStart,
  trimLeft,
  trimEnd,
  trimRight,
  trimBetween,
  trimCenter,
} from 's-trimmer';
```

**Or CommonJS:**

```js
const sTrimmer = require('s-trimmer').default;
const {
  trimStart,
  trimLeft,
  trimEnd,
  trimRight,
  trimBetween,
  trimCenter,
} = require('s-trimmer');
```

Next use library:

**sTrimmer**

```js
const value = '    lorem  ipsum dolor  ';

const formattedValue = sTrimmer(value); // 'lorem ipsum dolor'
```

**trimStart (alias trimLeft)**

```js
const value = '    lorem  ipsum dolor  ';

trimStart(value); // 'lorem  ipsum dolor  '
trimLeft(value); // 'lorem  ipsum dolor  '
```

**trimEnd (alias trimRight)**

```js
const value = '    lorem  ipsum dolor  ';

trimEnd(value); // '    lorem  ipsum dolor'
trimRight(value); // '    lorem  ipsum dolor'
```

**trimBetween (alias trimCenter)**

```js
const value = '    lorem  ipsum dolor  ';

trimBetween(value); // '    lorem ipsum dolor  '
trimCenter(value); // '    lorem ipsum dolor  '
```

### Params

| Type   | Description           |
| ------ | --------------------- |
| string | value to be formatted |

## License

This project is licensed under the MIT License © 2020-present Jakub Biesiada

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