Comparing version 0.0.3 to 0.0.4
@@ -5,10 +5,16 @@ var exports, splitString, | ||
splitString = function(str, length) { | ||
var head, min, tail; | ||
if (str.length < length) { | ||
return str; | ||
var first, head, min, rest, tail, tmp, _ref; | ||
_ref = str.split('\n'), first = _ref[0], tmp = 2 <= _ref.length ? __slice.call(_ref, 1) : []; | ||
rest = tmp.join("\n"); | ||
if (first.length < length) { | ||
if (rest.length === 0) { | ||
return first; | ||
} else { | ||
return "" + first + "\n" + (splitString(rest, length)); | ||
} | ||
} else { | ||
min = Math.min(str.length, length); | ||
head = str.substring(0, min); | ||
tail = str.substring(min, str.length); | ||
return "" + head + "\n" + (splitString(tail, length)); | ||
min = Math.min(first.length, length); | ||
head = first.substring(0, min); | ||
tail = first.substring(min, first.length); | ||
return "" + head + "\n" + (splitString(tail + '\n' + rest, length)); | ||
} | ||
@@ -15,0 +21,0 @@ }; |
{ | ||
"name": "breakwrap", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"author": "Mike Groseclose", | ||
@@ -5,0 +5,0 @@ "email": "mike.groseclose@gmail.com", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8333
38