source: imaps-frontend/node_modules/word-wrap/README.md@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 6.2 KB
RevLine 
[d565449]1# word-wrap [![NPM version](https://img.shields.io/npm/v/word-wrap.svg?style=flat)](https://www.npmjs.com/package/word-wrap) [![NPM monthly downloads](https://img.shields.io/npm/dm/word-wrap.svg?style=flat)](https://npmjs.org/package/word-wrap) [![NPM total downloads](https://img.shields.io/npm/dt/word-wrap.svg?style=flat)](https://npmjs.org/package/word-wrap) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/word-wrap.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/word-wrap)
2
3> Wrap words to a specified length.
4
5Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6
7## Install
8
9Install with [npm](https://www.npmjs.com/):
10
11```sh
12$ npm install --save word-wrap
13```
14
15## Usage
16
17```js
18var wrap = require('word-wrap');
19
20wrap('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.');
21```
22
23Results in:
24
25```
26 Lorem ipsum dolor sit amet, consectetur adipiscing
27 elit, sed do eiusmod tempor incididunt ut labore
28 et dolore magna aliqua. Ut enim ad minim veniam,
29 quis nostrud exercitation ullamco laboris nisi ut
30 aliquip ex ea commodo consequat.
31```
32
33## Options
34
35![image](https://cloud.githubusercontent.com/assets/383994/6543728/7a381c08-c4f6-11e4-8b7d-b6ba197569c9.png)
36
37### options.width
38
39Type: `Number`
40
41Default: `50`
42
43The width of the text before wrapping to a new line.
44
45**Example:**
46
47```js
48wrap(str, {width: 60});
49```
50
51### options.indent
52
53Type: `String`
54
55Default: `` (two spaces)
56
57The string to use at the beginning of each line.
58
59**Example:**
60
61```js
62wrap(str, {indent: ' '});
63```
64
65### options.newline
66
67Type: `String`
68
69Default: `\n`
70
71The string to use at the end of each line.
72
73**Example:**
74
75```js
76wrap(str, {newline: '\n\n'});
77```
78
79### options.escape
80
81Type: `function`
82
83Default: `function(str){return str;}`
84
85An escape function to run on each line after splitting them.
86
87**Example:**
88
89```js
90var xmlescape = require('xml-escape');
91wrap(str, {
92 escape: function(string){
93 return xmlescape(string);
94 }
95});
96```
97
98### options.trim
99
100Type: `Boolean`
101
102Default: `false`
103
104Trim trailing whitespace from the returned string. This option is included since `.trim()` would also strip the leading indentation from the first line.
105
106**Example:**
107
108```js
109wrap(str, {trim: true});
110```
111
112### options.cut
113
114Type: `Boolean`
115
116Default: `false`
117
118Break a word between any two letters when the word is longer than the specified width.
119
120**Example:**
121
122```js
123wrap(str, {cut: true});
124```
125
126## About
127
128<details>
129<summary><strong>Contributing</strong></summary>
130
131Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
132
133</details>
134
135<details>
136<summary><strong>Running Tests</strong></summary>
137
138Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
139
140```sh
141$ npm install && npm test
142```
143
144</details>
145
146<details>
147<summary><strong>Building docs</strong></summary>
148
149_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
150
151To generate the readme, run the following command:
152
153```sh
154$ npm install -g verbose/verb#dev verb-generate-readme && verb
155```
156
157</details>
158
159### Related projects
160
161You might also be interested in these projects:
162
163* [common-words](https://www.npmjs.com/package/common-words): Updated list (JSON) of the 100 most common words in the English language. Useful for… [more](https://github.com/jonschlinkert/common-words) | [homepage](https://github.com/jonschlinkert/common-words "Updated list (JSON) of the 100 most common words in the English language. Useful for excluding these words from arrays.")
164* [shuffle-words](https://www.npmjs.com/package/shuffle-words): Shuffle the words in a string and optionally the letters in each word using the… [more](https://github.com/jonschlinkert/shuffle-words) | [homepage](https://github.com/jonschlinkert/shuffle-words "Shuffle the words in a string and optionally the letters in each word using the Fisher-Yates algorithm. Useful for creating test fixtures, benchmarking samples, etc.")
165* [unique-words](https://www.npmjs.com/package/unique-words): Returns an array of unique words, or the number of occurrences of each word in… [more](https://github.com/jonschlinkert/unique-words) | [homepage](https://github.com/jonschlinkert/unique-words "Returns an array of unique words, or the number of occurrences of each word in a string or list.")
166* [wordcount](https://www.npmjs.com/package/wordcount): Count the words in a string. Support for english, CJK and Cyrillic. | [homepage](https://github.com/jonschlinkert/wordcount "Count the words in a string. Support for english, CJK and Cyrillic.")
167
168### Contributors
169
170| **Commits** | **Contributor** |
171| --- | --- |
172| 47 | [jonschlinkert](https://github.com/jonschlinkert) |
173| 7 | [OlafConijn](https://github.com/OlafConijn) |
174| 3 | [doowb](https://github.com/doowb) |
175| 2 | [aashutoshrathi](https://github.com/aashutoshrathi) |
176| 2 | [lordvlad](https://github.com/lordvlad) |
177| 2 | [hildjj](https://github.com/hildjj) |
178| 1 | [danilosampaio](https://github.com/danilosampaio) |
179| 1 | [2fd](https://github.com/2fd) |
180| 1 | [leonard-thieu](https://github.com/leonard-thieu) |
181| 1 | [mohd-akram](https://github.com/mohd-akram) |
182| 1 | [toddself](https://github.com/toddself) |
183| 1 | [wolfgang42](https://github.com/wolfgang42) |
184| 1 | [zachhale](https://github.com/zachhale) |
185
186### Author
187
188**Jon Schlinkert**
189
190* [GitHub Profile](https://github.com/jonschlinkert)
191* [Twitter Profile](https://twitter.com/jonschlinkert)
192* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
193
194### License
195
196Copyright © 2023, [Jon Schlinkert](https://github.com/jonschlinkert).
197Released under the [MIT License](LICENSE).
198
199***
200
201_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on July 22, 2023._
Note: See TracBrowser for help on using the repository browser.