Permalink
Browse files

hard wrap mode docs

  • Loading branch information...
1 parent 24e5824 commit 9421b7c5e458d2bbbb8c64860685579bfd799e13 @substack committed Aug 26, 2011
Showing with 19 additions and 3 deletions.
  1. +18 −2 README.markdown
  2. +1 −1 package.json
View
@@ -47,8 +47,24 @@ output:
Just drifting through emptiness. The
sun was just another point of light.
-wrap(stop), wrap(start, stop)
-=============================
+methods
+=======
+
+var wrap = require('wordwrap');
+
+wrap(stop), wrap(start, stop, params={mode:"soft"})
+---------------------------------------------------
+
+Returns a function that takes a string and returns a new string.
Pad out lines with spaces out to column `start` and then wrap until column
`stop`. If a word is longer than `stop - start` characters it will overflow.
+
+In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks which are
+longer than `stop - start`, in "hard" mode, split chunks with `/\b/` and break
+up chunks longer than `stop - start`.
+
+wrap.hard(start, stop)
+----------------------
+
+Like `wrap()` but with `params.mode = "hard"`.
View
@@ -1,7 +1,7 @@
{
"name" : "wordwrap",
"description" : "Wrap those words. Show them at what columns to start and stop.",
- "version" : "0.0.1",
+ "version" : "0.0.2",
"repository" : {
"type" : "git",
"url" : "git://github.com/substack/node-wordwrap.git"

0 comments on commit 9421b7c

Please sign in to comment.