Comparing version 1.0.1 to 1.0.2
@@ -8,2 +8,3 @@ /*! | ||
* Adapted from http://james.padolsey.com/javascript/wordwrap-for-javascript/ | ||
* @attribution | ||
*/ | ||
@@ -18,5 +19,5 @@ | ||
var width = options.width || 50; | ||
var indent = (typeof options.indent === 'undefined') | ||
? ' ' | ||
: options.indent; | ||
var indent = (typeof options.indent === 'string') | ||
? options.indent | ||
: ' '; | ||
@@ -28,2 +29,3 @@ var newline = options.newline || '\n' + indent; | ||
var res = indent + lines.join(newline); | ||
if (options.trim === true) { | ||
@@ -30,0 +32,0 @@ res = res.replace(/[ \t]*$/gm, ''); |
{ | ||
"name": "word-wrap", | ||
"description": "Wrap words to a specified length.", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/jonschlinkert/word-wrap", | ||
@@ -17,5 +17,5 @@ "author": { | ||
}, | ||
"licenses": { | ||
"license": { | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/word-wrap/blob/master/LICENSE-MIT" | ||
"url": "https://github.com/jonschlinkert/word-wrap/blob/master/LICENSE" | ||
}, | ||
@@ -50,2 +50,2 @@ "files": [ | ||
] | ||
} | ||
} |
@@ -17,5 +17,3 @@ # word-wrap [![NPM version](https://badge.fury.io/js/word-wrap.svg)](http://badge.fury.io/js/word-wrap) | ||
var str = 'A project without documentation is like a project that doesn\'t exist. Verb solves this by making it dead simple to generate project documentation, using simple markdown templates, with zero configuration required.'; | ||
console.log(wrap(str)); | ||
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.'); | ||
``` | ||
@@ -26,28 +24,17 @@ | ||
``` | ||
A project without documentation is like a project | ||
that doesn't exist. Verb solves this by making it | ||
dead simple to generate project documentation, | ||
using simple markdown templates, with zero | ||
configuration required. | ||
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. | ||
``` | ||
## Options | ||
### trim | ||
![image](https://cloud.githubusercontent.com/assets/383994/6543728/7a381c08-c4f6-11e4-8b7d-b6ba197569c9.png) | ||
Type: `Boolean` | ||
Default: `false` | ||
### options.width | ||
Trim trailing whitespace from the returned string. | ||
**Example:** | ||
```js | ||
wrap(str, {trim: true}); | ||
``` | ||
### width | ||
Type: `Number` | ||
@@ -66,3 +53,3 @@ | ||
### indent | ||
### options.indent | ||
@@ -82,3 +69,3 @@ Type: `String` | ||
### newline | ||
### options.newline | ||
@@ -98,2 +85,35 @@ Type: `String` | ||
### options.trim | ||
Type: `Boolean` | ||
Default: `false` | ||
Trim trailing whitespace from the returned string. This option is included since `.trim()` would also strip the leading indentation from the first line. | ||
**Example:** | ||
```js | ||
wrap(str, {trim: true}); | ||
``` | ||
## Related projects | ||
* [wordcount](https://github.com/jonschlinkert/wordcount): Count the words in string. Has basic support for Cyrillic and CJK. | ||
* [unique-words](https://github.com/jonschlinkert/unique-words): Return the unique words in a string or array. | ||
* [common-words](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. | ||
* [shuffle-words](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. | ||
## Running tests | ||
Install dev dependencies. | ||
```bash | ||
npm i -d && npm test | ||
``` | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/word-wrap/issues) | ||
## Author | ||
@@ -106,9 +126,8 @@ | ||
## License | ||
Copyright (c) 2015 Jon Schlinkert | ||
Released under the , licenses | ||
Released under the MIT license | ||
*** | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on February 27, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 07, 2015._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
5694
0
27
128