https://github.com/iansinnott/trimstring
🔪 Neatly trim template strings
https://github.com/iansinnott/trimstring
string template trim
Last synced: about 1 month ago
JSON representation
🔪 Neatly trim template strings
- Host: GitHub
- URL: https://github.com/iansinnott/trimstring
- Owner: iansinnott
- License: mit
- Created: 2017-02-01T20:45:36.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-02T07:00:00.000Z (over 9 years ago)
- Last Synced: 2026-03-13T11:14:02.791Z (3 months ago)
- Topics: string, template, trim
- Language: JavaScript
- Homepage:
- Size: 109 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# trimstring
[](https://circleci.com/gh/iansinnott/trimstring)
[](https://www.npmjs.com/package/trimstring)
> 🔪 Neatly trim template strings
## Install
```
$ npm install --save trimstring
```
## Usage
```js
const trimstring = require('trimstring');
const genHtml = props => {
return trimstring(`
${props.title}
${props.body}
`);
};
// Leading whitespace and trailing newlines will be trimmed.
genHtml({ title: 'Trimstring', body: 'This is my favorite library!' }); //=>
`
Trimstring
This is my favorite library!
`
```
## API
### trimstring(templateString)
#### templateString
Type: `string`
A multiline string for trimming.
**NOTE:** If your string does not need multiple lines then trimstring probably won't help you. The core use of this library is for creating strings without leading whitespace or trailing/leading newlines but allowing you to still write your code in a readable way.
## License
MIT © [Ian Sinnott](http://iansinnott.com)