.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / word-wrap / README.md
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
5 ## Install
6
7 Install with [npm](https://www.npmjs.com/):
8
9 ```sh
10 $ npm install --save word-wrap
11 ```
12
13 ## Usage
14
15 ```js
16 var wrap = require('word-wrap');
17
18 wrap('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.');
19 ```
20
21 Results in:
22
23 ```
24   Lorem ipsum dolor sit amet, consectetur adipiscing
25   elit, sed do eiusmod tempor incididunt ut labore
26   et dolore magna aliqua. Ut enim ad minim veniam,
27   quis nostrud exercitation ullamco laboris nisi ut
28   aliquip ex ea commodo consequat.
29 ```
30
31 ## Options
32
33 ![image](https://cloud.githubusercontent.com/assets/383994/6543728/7a381c08-c4f6-11e4-8b7d-b6ba197569c9.png)
34
35 ### options.width
36
37 Type: `Number`
38
39 Default: `50`
40
41 The width of the text before wrapping to a new line.
42
43 **Example:**
44
45 ```js
46 wrap(str, {width: 60});
47 ```
48
49 ### options.indent
50
51 Type: `String`
52
53 Default: `` (two spaces)
54
55 The string to use at the beginning of each line.
56
57 **Example:**
58
59 ```js
60 wrap(str, {indent: '      '});
61 ```
62
63 ### options.newline
64
65 Type: `String`
66
67 Default: `\n`
68
69 The string to use at the end of each line.
70
71 **Example:**
72
73 ```js
74 wrap(str, {newline: '\n\n'});
75 ```
76
77 ### options.escape
78
79 Type: `function`
80
81 Default: `function(str){return str;}`
82
83 An escape function to run on each line after splitting them.
84
85 **Example:**
86
87 ```js
88 var xmlescape = require('xml-escape');
89 wrap(str, {
90   escape: function(string){
91     return xmlescape(string);
92   }
93 });
94 ```
95
96 ### options.trim
97
98 Type: `Boolean`
99
100 Default: `false`
101
102 Trim trailing whitespace from the returned string. This option is included since `.trim()` would also strip the leading indentation from the first line.
103
104 **Example:**
105
106 ```js
107 wrap(str, {trim: true});
108 ```
109
110 ### options.cut
111
112 Type: `Boolean`
113
114 Default: `false`
115
116 Break a word between any two letters when the word is longer than the specified width.
117
118 **Example:**
119
120 ```js
121 wrap(str, {cut: true});
122 ```
123
124 ## About
125
126 ### Related projects
127
128 * [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.")
129 * [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.")
130 * [unique-words](https://www.npmjs.com/package/unique-words): Return the unique words in a string or array. | [homepage](https://github.com/jonschlinkert/unique-words "Return the unique words in a string or array.")
131 * [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.")
132
133 ### Contributing
134
135 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
136
137 ### Contributors
138
139 | **Commits** | **Contributor** | 
140 | --- | --- |
141 | 43 | [jonschlinkert](https://github.com/jonschlinkert) |
142 | 2 | [lordvlad](https://github.com/lordvlad) |
143 | 2 | [hildjj](https://github.com/hildjj) |
144 | 1 | [danilosampaio](https://github.com/danilosampaio) |
145 | 1 | [2fd](https://github.com/2fd) |
146 | 1 | [toddself](https://github.com/toddself) |
147 | 1 | [wolfgang42](https://github.com/wolfgang42) |
148 | 1 | [zachhale](https://github.com/zachhale) |
149
150 ### Building docs
151
152 _(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.)_
153
154 To generate the readme, run the following command:
155
156 ```sh
157 $ npm install -g verbose/verb#dev verb-generate-readme && verb
158 ```
159
160 ### Running tests
161
162 Running 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:
163
164 ```sh
165 $ npm install && npm test
166 ```
167
168 ### Author
169
170 **Jon Schlinkert**
171
172 * [github/jonschlinkert](https://github.com/jonschlinkert)
173 * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
174
175 ### License
176
177 Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
178 Released under the [MIT License](LICENSE).
179
180 ***
181
182 _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 02, 2017._