{"_id":"linewrap","_rev":"241935","name":"linewrap","description":"Word wrapping with HTML, ANSI color code, indentation and paragraphing support.","dist-tags":{"latest":"0.2.1"},"maintainers":[{"name":"halfninety","email":"halfninety@gmail.com"}],"time":{"modified":"2021-06-03T15:58:08.000Z","created":"2013-08-17T01:09:11.673Z","0.2.1":"2013-09-07T01:53:04.646Z","0.2.0":"2013-08-17T01:09:11.673Z"},"users":{"tkh44":true},"author":{"name":"Feng Qiu","email":"feng@ban90.com"},"repository":{"type":"git","url":"git://github.com/halfninety/linewrap.git"},"versions":{"0.2.1":{"name":"linewrap","description":"Word wrapping with HTML, ANSI color code, indentation and paragraphing support.","version":"0.2.1","repository":{"type":"git","url":"git://github.com/halfninety/linewrap.git"},"main":"./index.js","keywords":["word","wrap","line","paragraph","text","string","indent","rule","format","column"],"directories":{"lib":".","example":"example","test":"test"},"scripts":{"pretest":"jshint --verbose --config test/jshint.json ./*js test/*js example/*js","test":"expresso"},"devDependencies":{"expresso":"=0.7.x","jshint":"*","wordwrap":"*"},"engines":{"node":">=0.4.0"},"license":"MIT","author":{"name":"Feng Qiu","email":"feng@ban90.com"},"readmeFilename":"README.markdown","bugs":{"url":"https://github.com/halfninety/linewrap/issues"},"_id":"linewrap@0.2.1","dist":{"shasum":"5caef1579383b9b5fcb682b2d498dc9d74c545cf","size":33414,"noattachment":false,"key":"/linewrap/-/linewrap-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/linewrap/download/linewrap-0.2.1.tgz"},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"halfninety","email":"halfninety@gmail.com"},"maintainers":[{"name":"halfninety","email":"halfninety@gmail.com"}],"publish_time":1378518784646,"_cnpm_publish_time":1378518784646,"_hasShrinkwrap":false},"0.2.0":{"name":"linewrap","description":"Wrap those words. Show them at what columns to start and stop.","version":"0.2.0","repository":{"type":"git","url":"git://github.com/halfninety/node-linewrap.git"},"main":"./index.js","keywords":["word","wrap","line","paragraph","text","rule","format","column"],"directories":{"lib":".","example":"example","test":"test"},"scripts":{"pretest":"jshint --verbose --config test/jshint.json ./*js test/*js example/*js","test":"expresso"},"devDependencies":{"expresso":"=0.7.x","jshint":"*","wordwrap":"*"},"engines":{"node":">=0.4.0"},"license":"MIT","author":{"name":"Feng Qiu","email":"feng@ban90.com"},"readmeFilename":"README.markdown","bugs":{"url":"https://github.com/halfninety/node-linewrap/issues"},"_id":"linewrap@0.2.0","dist":{"shasum":"79a1d40910cd7c61cdec9d939cd7cc677ace62a9","size":31545,"noattachment":false,"key":"/linewrap/-/linewrap-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/linewrap/download/linewrap-0.2.0.tgz"},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"halfninety","email":"halfninety@gmail.com"},"maintainers":[{"name":"halfninety","email":"halfninety@gmail.com"}],"publish_time":1376701751673,"_cnpm_publish_time":1376701751673,"_hasShrinkwrap":false}},"readme":"linewrap\n========\n\nA fork of [wordwrap](https://github.com/substack/node-wordwrap) that's faster and more powerful,\nsupporting HTML, ANSI Color Codes, multiple paragraphing styles, and more.\n\nOn a 3.4GHz Sandy Bridge core, Linewrap achieves roughly 20MB/s when wrapping\nat 80 columns, or 15MB/s if wrapping at 20 columns.\n\nLinewrap is *almost* backwards compatible with wordwrap. The behavior only differs\nin some edge cases where I believe wordwrap didn't make the best choice. You probably\nwon't notice any difference in normal usage.\n\n\nUsage\n=====\n\n```js\n    var linewrap = require('linewrap');\n\n    // Wrap the string at 20 columns, using Windows-style line breaks.\n    var wrap = linewrap(20, {lineBreak: '\\r\\n' /*, other options */});\n    console.log(wrap('You and your whole family are made out of meat.'));\n\n    // Wrap the string at 20 columns, prepend 10 spaces to each line, and\n    // skip HTML tags when counting columns for wrapping.\n    var wrap = linewrap(10, 30, {skipScheme: 'html' /*, other options */});\n    console.log(wrap('You and your <b>whole family</b> are made out of <i>meat</i>.'));\n```\n\n\nOptions\n=======\n\nSkip strings\n------------\n\n**Relevant options**: `skip`, `skipScheme`.\n\nSometimes certain characters in the text are used to control styling, annotate\nadditional information, etc, and are not intended to be displayed. Examples\ninclude HTML tags and ANSI color codes. These characters shouldn't be counted\nwhen doing a wrap.\n\n**Supported values** of `skip`:\n\n1. `RegExp`.\n2. `string`.\n\nThe specified regular expression or string is matched against the input, and all\nmatching sequences in the input are simply copied to the output and are ignored\nby the wrapping algorithm.\n\n`skipScheme` can take one of the following values: `\"ansi-color\"`, `\"html\"`, and\n`\"bbcode\"`. They are pre-configured regular expressions for common tasks.\n\nWhen both options are specified, `skip` takes precedence.\n\n\nLine break strings\n------------------\n\n**Relevant options**: `lineBreak`, `lineBreakScheme`.\n\nTo support custom line breaks, there are actually two parameters that need to be\nspecified: a regular expression that is used to match line breaks in the input (`P1`),\nand a string that is used as line breaks in the output (`P2`).\n\n**Supported values** of `lineBreak`:\n\n1. `string`. It is used as `P2`, and a `RegExp` object is created from the string\n   to be used as `P1`.\n2. `[RegExp, string]`. The `RegExp` object is used as `P1`, and the string is used\n   as `P2`.\n3. `[string, string]`. A `RegExp` object is created from the first string and used\n   as `P1`, the second string is used as `P2`.\n4. `RegExp`. It is used as `P1`. We will match the regular expression against the\n   input and use the first match as `P2`. If no match is found, an exception is\n   thrown. **Not Recommended**\n\nYou can, for example, use `/\\n/` as `P1` and `\"<br>\"` as `P2` to convert the string\nfrom one format to another.\n\n`lineBreakScheme` can take one of the following values: `\"unix\"`, `\"dos\"`, `\"mac\"`,\n`\"html\"`, and `\"xhtml\"`. Each scheme specifies both `P1` and `P2` for the specific\nscenario.\n\nWhen both options are specified, `lineBreak` takes precedence.\n\n\nExisting line breaks\n--------------------\n\n**Relevant option**: `respectLineBreaks`.\n\nThis option controls how to treat existing line breaks in the input. It's important\nfor supporting various paragraphing styles.\n\n**Supported values**:\n\n1. `\"all\"` **Default**. All existing line breaks are preserved.\n2. `\"none\"`. All existing line breaks are discarded.\n3. `\"multi\"`. Only 2 or more consecutive line breaks (there can be whitespaces\n   between them) are preserved, single line breaks are discarded. This can be\n   used to support the paragraphing style that inserts a blank line between\n   paragraphs, so that each paragraph is re-formatted, but the paragraph structure\n   is preserved.\n4. `\"m<num>\"`. A number is specified to indicate how many consecutive line breaks\n   are preserved. For example, `\"multi\"` is equivalent to `\"m2\"`.\n5. `\"s<num>\"`. A number is specified to indicate line breaks that are immediately\n   followed by at least how many whitespaces are preserved. This can be used to\n   support the paragraphing style that indents the first line of each paragraph.\n\n\nWhitespaces\n-----------\n\n**Relevant option**: `whitespace`.\n\nThis option controls whether preceding and trailing whitespaces are stripped from\nthe output. The original wordwrap isn't consistent in this area: it strips preceding\nwhitespaces of all lines except the first one, and it strips trailing whitespaces of\nsome lines but not others.\n\n**Supported values**:\n\n1. `\"default\"` **Default**. Both preceding and trailing whitespaces are stripped.\n   This is the most similar to wordwrap's behavior.\n2. `\"collapse\"`. In addition to `\"default\"`, also collapse consecutive whitespaces\n   within each line.\n3. `\"line\"`. Similar to `\"default\"`, but doesn't strip preceding whitespaces of\n   lines preserved from the input (not wrapped by us). This option can be used\n   with the `\"s<num>\"` options of `respectLineBreaks` to support the indenting\n   paragraphing style, so that the indentations to mark new paragraphs are preserved.\n4. `\"all\"`. All whitespaces are preserved. In this mode, whitespaces are treated\n   like other non-alphabetical characters that are displayed but can be wrapped\n   at any position.\n\n\nHard wrapping\n-------------\n\n**Relevant option**: `mode`.\n\n**Supported values**:\n\n1. `\"soft\"` **Default**. Split chunks by `/(\\S+\\s+/` and don't break up chunks which are\n   longer than the wrap length. So if a single word is longer than the wrap\n   length it will overflow.\n2. `\"hard\"`. Split chunks with `/\\b/` and break up chunks longer than the wrap\n   length.\n\n\nTab width\n---------\n\n**Relevant option**: `tabWidth`.\n\nAll `\\t` characters are replaced with a certain number of spaces before doing\nthe wrap. This option controls how many spaces to replace a `\\t`. Default is 4.\n\n\nPresets\n-------\n\n**Relevant option**: `preset`.\n\nAre you overwhelmed by the sheer amount of options? Worry not, presets are to\nthe rescue!\n\nEach preset contains values for one or more options. You can specify either a\nsingle preset or an array of presets. If multiple presets in the array set the\nsame option, the last one wins.\n\n**Supported values**:\n\n1. `\"html\"`. Sets `skipScheme` and `lineBreakScheme` to `\"html\"`, and `whitespace`\n   to `\"collapse\"`.\n\nOptions that are set explicitly take predence to those set by a preset.\n\nYou are welcome to suggest new schemes and presets by\n[creating an issue](https://github.com/halfninety/node-linewrap/issues/new).\n\n\nAcknowledgements\n================\n\nThanks to [James Halliday](https://github.com/substack) for wordwrap.\n\n\nLicense\n=======\n\nMIT License\n","_attachments":{},"readmeFilename":"README.markdown","bugs":{"url":"https://github.com/halfninety/linewrap/issues"},"license":"MIT"}