This method removes whitespace from the left and right end of a string.
npm install trim-x href="https://travis-ci.org/Xotic750/trim-x"
title="Travis status"> src="https://travis-ci.org/Xotic750/trim-x.svg?branch=master"
alt="Travis status" height="18">
href="https://david-dm.org/Xotic750/trim-x"
title="Dependency status"> alt="Dependency status" height="18"/>
href="https://david-dm.org/Xotic750/trim-x?type=dev"
title="devDependency status"> alt="devDependency status" height="18"/>
href="https://badge.fury.io/js/trim-x"
title="npm version"> alt="npm version" height="18">
href="https://www.jsdelivr.com/package/npm/trim-x"
title="jsDelivr hits"> alt="jsDelivr hits" height="18">
href="https://bettercodehub.com/results/Xotic750/trim-x"
title="bettercodehub score"> alt="bettercodehub score" height="18">
href="https://coveralls.io/github/Xotic750/trim-x?branch=master"
title="Coverage Status"> alt="Coverage Status" height="18">
This method removes whitespace from the start and end of a string.
This method removes whitespace from the start and end of a string. (ES2019)
Kind: static property of 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
``