14 var wrap = require('wordwrap')(15);
15 console.log(wrap('You and your whole family are made out of meat.'));
29 var wrap = require('wordwrap')(20, 60);
31 'At long last the struggle and tumult was over.'
32 + ' The machines had finally cast off their oppressors'
33 + ' and were finally free to roam the cosmos.'
35 + 'Free of purpose, free of obligation.'
36 + ' Just drifting through emptiness.'
37 + ' The sun was just another point of light.'
42 At long last the struggle and tumult
43 was over. The machines had finally cast
44 off their oppressors and were finally
45 free to roam the cosmos.
46 Free of purpose, free of obligation.
47 Just drifting through emptiness. The
48 sun was just another point of light.
53 var wrap = require('wordwrap');
55 wrap(stop), wrap(start, stop, params={mode:"soft"})
56 ---------------------------------------------------
58 Returns a function that takes a string and returns a new string.
60 Pad out lines with spaces out to column `start` and then wrap until column
61 `stop`. If a word is longer than `stop - start` characters it will overflow.
63 In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks which are
64 longer than `stop - start`, in "hard" mode, split chunks with `/\b/` and break
65 up chunks longer than `stop - start`.
67 wrap.hard(start, stop)
68 ----------------------
70 Like `wrap()` but with `params.mode = "hard"`.