{"name":"wordwrapjs","author":{"name":"Lloyd Brookes","email":"opensource@75lb.com"},"version":"5.1.1","description":"Word-wrapping for javascript.","repository":{"type":"git","url":"git+https://github.com/75lb/wordwrapjs.git"},"license":"MIT","type":"module","exports":{"import":"./index.js","require":"./dist/index.cjs"},"keywords":["word","line","wrap","text","columns","wordwrap"],"engines":{"node":">=12.17"},"scripts":{"test":"npm run dist && npm run test:ci","test:ci":"75lb-nature test-runner test/test.?js","docs":"75lb-nature jsdoc2md -t README.hbs index.js > README.md","dist":"75lb-nature cjs-build index.js && 75lb-nature simple-rollup index.js"},"devDependencies":{},"standard":{"ignore":["dist","tmp"],"envs":[]},"_id":"wordwrapjs@5.1.1","gitHead":"a7555f4d13f16ee3babd2113ade130c41a77ee2d","bugs":{"url":"https://github.com/75lb/wordwrapjs/issues"},"homepage":"https://github.com/75lb/wordwrapjs#readme","_nodeVersion":"24.9.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-0yweIbkINJodk27gX9LBGMzyQdBDan3s/dEAiwBOj+Mf0PPyWL6/rikalkv8EeD0E8jm4o5RXEOrFTP3NXbhJg==","shasum":"bfd1eb426f0f7eec73b7df32cf7df1f618bfb3a9","tarball":"http://registry-npm.ywwl.com/wordwrapjs/download/wordwrapjs-5.1.1.tgz","fileCount":7,"unpackedSize":23598,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDpWaT+BDVTeAfP1ewKGtiGvXfKeg8Pzj1alop2DSTaAAIhAKb2JdDvc/ZFuHM8AzP5M+1CNaXH52CKJUe8aXkYAMeK"}],"size":4520,"noattachment":false,"key":"/wordwrapjs/-/wordwrapjs-5.1.1.tgz"},"_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"directories":{},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wordwrapjs_5.1.1_1760043394557_0.22888549874183428"},"_hasShrinkwrap":false,"readme":"[![view on npm](https://badgen.net/npm/v/wordwrapjs)](https://www.npmjs.org/package/wordwrapjs)\n[![npm module downloads](https://badgen.net/npm/dt/wordwrapjs)](https://www.npmjs.org/package/wordwrapjs)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/wordwrapjs)](https://github.com/75lb/wordwrapjs/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/wordwrapjs)](https://github.com/75lb/wordwrapjs/network/dependents?dependent_type=PACKAGE)\n[![Node.js CI](https://github.com/75lb/wordwrapjs/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/wordwrapjs/actions/workflows/node.js.yml)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n# wordwrapjs\n\nWord wrapping for plain text.\n\n## Synopsis\n\nWrap some text in a 20 character column.\n\n```js\nimport wordwrap from 'wordwrapjs'\n\nconst text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'\nconst result = wordwrap.wrap(text, { width: 20 })\n```\n\n`result` now looks like this:\n```\nLorem ipsum dolor\nsit amet,\nconsectetur\nadipiscing elit, sed\ndo eiusmod tempor\nincididunt ut labore\net dolore magna\naliqua.\n```\n\nForce long words to wrap by setting the `break` flag.\n\n```\nWelcome to Node.js v16.6.2.\n> wrap = require('wordwrapjs')\n\n> url = 'https://github.com/75lb/wordwrapjs'\n> wrap.lines(url, { width: 18 })\n[ 'https://github.com/75lb/wordwrapjs' ]\n\n> wrap.lines(url, { width: 18, break: true })\n[ 'https://github.com', '/75lb/wordwrapjs' ]\n```\n\n## Load anywhere\n\nThis library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.\n\nNode.js:\n\n```js\nconst wordwrap = require('wordwrapjs')\n```\n\nWithin Node.js with ECMAScript Module support enabled:\n\n```js\nimport wordwrap from 'wordwrapjs'\n```\n\nWithin an modern browser ECMAScript Module:\n\n```js\nimport wordwrap from './node_modules/wordwrapjs/dist/index.mjs'\n```\n\nOld browser (adds `window.wordwrapjs`):\n\n```html\n<script nomodule src=\"./node_modules/wordwrapjs/dist/index.js\"></script>\n```\n\n## API Reference\n\n\n* [wordwrapjs](#module_wordwrapjs)\n    * [Wordwrap](#exp_module_wordwrapjs--Wordwrap) ⏏\n        * [new Wordwrap(text, [options])](#new_module_wordwrapjs--Wordwrap_new)\n        * _static_\n            * [.wrap(text, [options])](#module_wordwrapjs--Wordwrap.wrap)\n            * [.lines(text, [options])](#module_wordwrapjs--Wordwrap.lines)\n            * [.isWrappable(text)](#module_wordwrapjs--Wordwrap.isWrappable) ⇒ <code>boolean</code>\n            * [.getChunks(text)](#module_wordwrapjs--Wordwrap.getChunks) ⇒ <code>Array.&lt;string&gt;</code>\n        * _inner_\n            * [~WordwrapOptions](#module_wordwrapjs--Wordwrap..WordwrapOptions) : <code>Object</code>\n\n<a name=\"exp_module_wordwrapjs--Wordwrap\"></a>\n\n### Wordwrap ⏏\n**Kind**: Exported class  \n<a name=\"new_module_wordwrapjs--Wordwrap_new\"></a>\n\n#### new Wordwrap(text, [options])\n\n| Param | Type | Description |\n| --- | --- | --- |\n| text | <code>string</code> | The input text to wrap. |\n| [options] | [<code>WordwrapOptions</code>](#module_wordwrapjs--Wordwrap..WordwrapOptions) |  |\n\n<a name=\"module_wordwrapjs--Wordwrap.wrap\"></a>\n\n#### Wordwrap.wrap(text, [options])\n**Kind**: static method of [<code>Wordwrap</code>](#exp_module_wordwrapjs--Wordwrap)  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| text | <code>string</code> | the input text to wrap |\n| [options] | [<code>WordwrapOptions</code>](#module_wordwrapjs--Wordwrap..WordwrapOptions) |  |\n\n<a name=\"module_wordwrapjs--Wordwrap.lines\"></a>\n\n#### Wordwrap.lines(text, [options])\nWraps the input text, returning an array of strings (lines).\n\n**Kind**: static method of [<code>Wordwrap</code>](#exp_module_wordwrapjs--Wordwrap)  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| text | <code>string</code> | input text |\n| [options] | [<code>WordwrapOptions</code>](#module_wordwrapjs--Wordwrap..WordwrapOptions) |  |\n\n<a name=\"module_wordwrapjs--Wordwrap.isWrappable\"></a>\n\n#### Wordwrap.isWrappable(text) ⇒ <code>boolean</code>\nReturns true if the input text would be wrapped if passed into `.wrap()`.\n\n**Kind**: static method of [<code>Wordwrap</code>](#exp_module_wordwrapjs--Wordwrap)  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| text | <code>string</code> | input text |\n\n<a name=\"module_wordwrapjs--Wordwrap.getChunks\"></a>\n\n#### Wordwrap.getChunks(text) ⇒ <code>Array.&lt;string&gt;</code>\nSplits the input text into an array of words and whitespace.\n\n**Kind**: static method of [<code>Wordwrap</code>](#exp_module_wordwrapjs--Wordwrap)  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| text | <code>string</code> | input text |\n\n<a name=\"module_wordwrapjs--Wordwrap..WordwrapOptions\"></a>\n\n#### Wordwrap~WordwrapOptions : <code>Object</code>\nWordwrap options.\n\n**Kind**: inner typedef of [<code>Wordwrap</code>](#exp_module_wordwrapjs--Wordwrap)  \n**Properties**\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| [width] | <code>number</code> | <code>30</code> | The max column width in characters. |\n| [break] | <code>boolean</code> | <code>false</code> | If true, words exceeding the specified `width` will be forcefully broken |\n| [noTrim] | <code>boolean</code> | <code>false</code> | By default, each line output is trimmed. If `noTrim` is set, no line-trimming occurs - all whitespace from the input text is left in. |\n| [eol] | <code>string</code> | <code>&quot;&#x27;\\\\n&#x27;&quot;</code> | The end of line character to use. Defaults to `\\n`. |\n\n\n* * *\n\n&copy; 2015-25 Lloyd Brookes \\<opensource@75lb.com\\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n","publish_time":1760043394751,"_cnpm_publish_time":1760043394751,"dist-tags":{"latest":"5.1.1","next":"2.0.0-0"}}