Comparing version 1.0.0 to 1.0.1
12
index.js
@@ -24,2 +24,3 @@ function smartWrap(text,options){ | ||
defaults.splitAt = [" ","\t"]; | ||
defaults.trim = true; | ||
defaults.width = 10; | ||
@@ -49,9 +50,16 @@ defaults.words = []; | ||
var unfilteredWords = []; | ||
//to trim or not to trim... | ||
var modifiedText = text; | ||
if(wrapObj.trim){ | ||
modifiedText = modifiedText.trim(); | ||
} | ||
if(wrapObj.splitAt.indexOf('\t')!==-1){ | ||
//split at both spaces and tabs | ||
unfilteredWords = text.split(/ |\t/i); | ||
unfilteredWords = modifiedText.split(/ |\t/i); | ||
} | ||
else{ | ||
//split at whitespace | ||
unfilteredWords = text.split(' '); | ||
unfilteredWords = modifiedText.split(' '); | ||
} | ||
@@ -58,0 +66,0 @@ |
{ | ||
"name": "smartwrap", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Wordwrap that doesn't split words unless the word length is greater that the line width.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,1 +19,3 @@ # smartwrap | ||
``` | ||
*Because these are wide characters and occupy 2 spaces, even though | ||
in javascript their string length is 1. |
Sorry, the diff of this file is not supported yet
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
29328
262
21