Socket
Socket
Sign inDemoInstall

word-wrap

Package Overview
Dependencies
0
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.1.0

5

index.js

@@ -25,2 +25,7 @@ /*!

var re = new RegExp('.{1,' + width + '}(\\s+|$)|\\S+?(\\s+|$)', 'g');
if (options.cut) {
re = new RegExp('.{1,' + width + '}', 'g');
}
var lines = str.match(re) || [];

@@ -27,0 +32,0 @@ var res = indent + lines.join(newline);

20

package.json
{
"name": "word-wrap",
"description": "Wrap words to a specified length.",
"version": "1.0.3",
"version": "1.1.0",
"homepage": "https://github.com/jonschlinkert/word-wrap",
"author": {
"name": "Jon Schlinkert",
"url": "http://github.com/jonschlinkert/"
},
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/word-wrap.git"
},
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"repository": "jonschlinkert/word-wrap",
"bugs": {
"url": "https://github.com/jonschlinkert/word-wrap/issues"
},
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/word-wrap/blob/master/LICENSE"
},
"license": "MIT",
"files": [

@@ -32,4 +23,3 @@ "index.js"

"devDependencies": {
"mocha": "^2.1.0",
"should": "^4.3.0"
"mocha": "*"
},

@@ -36,0 +26,0 @@ "keywords": [

@@ -1,12 +0,11 @@

# word-wrap [![NPM version](https://badge.fury.io/js/word-wrap.svg)](http://badge.fury.io/js/word-wrap) [![Build Status](https://travis-ci.org/jonschlinkert/word-wrap.svg)](https://travis-ci.org/jonschlinkert/word-wrap)
# word-wrap [![NPM version](https://badge.fury.io/js/word-wrap.svg)](http://badge.fury.io/js/word-wrap) [![Build Status](https://travis-ci.org/jonschlinkert/word-wrap.svg)](https://travis-ci.org/jonschlinkert/word-wrap)
> Wrap words to a specified length.
## Install with [npm](npmjs.org)
Install with [npm](https://www.npmjs.com/)
```bash
npm i word-wrap --save
```sh
$ npm i word-wrap --save
```
## Usage

@@ -30,8 +29,6 @@

## Options
![image](https://cloud.githubusercontent.com/assets/383994/6543728/7a381c08-c4f6-11e4-8b7d-b6ba197569c9.png)
[![image](https://cloud.githubusercontent.com/assets/383994/6543728/7a381c08-c4f6-11e4-8b7d-b6ba197569c9.png)](https://www.npmjs.com/)
### options.width

@@ -51,3 +48,2 @@

### options.indent

@@ -57,3 +53,3 @@

Default: ` ` (two spaces)
Default: `` (two spaces)

@@ -68,3 +64,2 @@ The string to use at the beginning of each line.

### options.newline

@@ -84,3 +79,2 @@

### options.trim

@@ -100,33 +94,49 @@

### options.cut
Type: `Boolean`
Default: `false`
Break a word between any two letters when the word is longer than the specified width.
**Example:**
```js
wrap(str, {cut: 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.
* [common-words](https://github.com/jonschlinkert/common-words): Updated list (JSON) of the 100 most common words in the English language. Useful for… [more](https://github.com/jonschlinkert/common-words)
* [shuffle-words](https://github.com/jonschlinkert/shuffle-words): Shuffle the words in a string and optionally the letters in each word using the… [more](https://github.com/jonschlinkert/shuffle-words)
* [unique-words](https://github.com/jonschlinkert/unique-words): Return the unique words in a string or array.
* [wordcount](https://github.com/jonschlinkert/wordcount): Count the words in string. Has basic support for Cyrillic and CJK.
## Running tests
Install dev dependencies:
```bash
npm i -d && npm test
```sh
$ 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)
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/word-wrap/issues/new)
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 19, 2015._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 17, 2015._
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc