bigint-crypto-utils/node_modules/wordwrapjs
juanelas c29b520108 JS Standard. Some fixes with the test. Better structure 2020-04-06 13:17:22 +02:00
..
jsdoc2md JS Standard. Some fixes with the test. Better structure 2020-04-06 13:17:22 +02:00
.npmignore JS Standard. Some fixes with the test. Better structure 2020-04-06 13:17:22 +02:00
.travis.yml JS Standard. Some fixes with the test. Better structure 2020-04-06 13:17:22 +02:00
LICENSE JS Standard. Some fixes with the test. Better structure 2020-04-06 13:17:22 +02:00
README.md JS Standard. Some fixes with the test. Better structure 2020-04-06 13:17:22 +02:00
index.js JS Standard. Some fixes with the test. Better structure 2020-04-06 13:17:22 +02:00
package.json JS Standard. Some fixes with the test. Better structure 2020-04-06 13:17:22 +02:00
test.js JS Standard. Some fixes with the test. Better structure 2020-04-06 13:17:22 +02:00

README.md

view on npm npm module downloads Build Status Dependency Status js-standard-style

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.

> 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.

> 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

WordWrap ⏏

Kind: Exported class

WordWrap.wrap(text, [options]) ⇒ string

Kind: static method of WordWrap

Param Type Description
text string the input text to wrap
[options] object optional configuration
[options.width] number the max column width in characters (defaults to 30).
[options.break] boolean if true, words exceeding the specified width will be forcefully broken
[options.noTrim] boolean By default, each line output is trimmed. If noTrim is set, no line-trimming occurs - all whitespace from the input text is left in.

WordWrap.lines(text, options)

Wraps the input text, returning an array of strings (lines).

Kind: static method of WordWrap

Param Type Description
text string input text
options object Accepts same options as constructor.

WordWrap.isWrappable(text) ⇒ boolean

Returns true if the input text would be wrapped if passed into .wrap().

Kind: static method of WordWrap

Param Type Description
text string input text

WordWrap.getChunks(text) ⇒ Array.<string>

Splits the input text into an array of words and whitespace.

Kind: static method of WordWrap

Param Type Description
text string input text

© 2015-17 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.