[](https://www.npmjs.org/package/wordwrapjs)
[](https://www.npmjs.org/package/wordwrapjs)
[](https://travis-ci.org/75lb/wordwrapjs)
[](https://david-dm.org/75lb/wordwrapjs)
[](https://github.com/feross/standard)
# wordwrapjs
Word wrapping, with a few features.
- force-break option
- wraps hypenated words
- multilingual - wraps any language that uses whitespace for word separation.
## Synopsis
Wrap some text in a 20 character column.
```js
> wordwrap = require('wordwrapjs')
> text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
> result = wordwrap.wrap(text, { width: 20 })
```
`result` now looks like this:
```
Lorem ipsum dolor
sit amet,
consectetur
adipiscing elit, sed
do eiusmod tempor
incididunt ut labore
et dolore magna
aliqua.
```
By default, long words will not break. Unless you set the `break` option.
```js
> url = 'https://github.com/75lb/wordwrapjs'
> wrap.lines(url, { width: 18 })
[ 'https://github.com/75lb/wordwrapjs' ]
> wrap.lines(url, { width: 18, break: true })
[ 'https://github.com', '/75lb/wordwrapjs' ]
```
## API Reference
{{#module name="wordwrapjs"}}
{{>body~}}
{{>member-index~}}
{{>members~}}
{{/module}}
* * *
© 2015-17 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).