An open API service indexing awesome lists of open source software.

https://github.com/xotic750/trim-x

This method removes whitespace from the left and right end of a string.
https://github.com/xotic750/trim-x

browser ecmascript5 nodejs string trim

Last synced: 8 months ago
JSON representation

This method removes whitespace from the left and right end of a string.

Awesome Lists containing this project

README

          


Travis status


Dependency status


devDependency status


npm version


jsDelivr hits


bettercodehub score


Coverage Status

## trim-x

This method removes whitespace from the start and end of a string.

### `module.exports(string)` ⇒ number

### `trim-x` ⇒ string

This method removes whitespace from the start and end of a string. (ES2019)

**Kind**: static property of [trim-x](#module_trim-x)
**Returns**: string - The trimmed string.
**Throws**:

- TypeError If string is null or undefined or not coercible.

| Param | Type | Description |
| ------ | ------------------- | --------------------------------------- |
| string | string | The string to trim the whitespace from. |

**Example**

```js
import trim from 'trim-x';

console.log(trim(' \t\na \t\n') === 'a'); // true
```