{"name":"collapse-whitespace","version":"1.1.7","description":"Remove unnecessary whitespace from an element.","main":"lib/whitespace.js","types":"whitespace.d.ts","scripts":{"prepublishOnly":"make","test":"make test"},"keywords":["browser","collapse","collapse-whitespace","dom","whitespace"],"repository":{"type":"git","url":"git://github.com/lucthev/collapse-whitespace.git"},"author":{"name":"Luc Thevenard","email":"lucthevenard@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/lucthev/serialize/issues"},"homepage":"https://github.com/lucthev/serialize","devDependencies":{"babel":"^5.6.14","browserify":"^10.2.6","standard":"^4.5.3","uglify-js":"^2.4.23"},"dependencies":{"block-elements":"^1.0.0","void-elements":"^2.0.1"},"gitHead":"b0be35118bb6ac13ad826dde60a5d78d4b3d68c9","_id":"collapse-whitespace@1.1.7","_npmVersion":"6.4.1","_nodeVersion":"11.1.0","_npmUser":{"name":"lucthev","email":"lucthevenard@gmail.com"},"dist":{"integrity":"sha512-24up1hbQSsnaDSGHPOvGQT84vmxvG0QUrI8tguiQpo9I5irrnypCKwddXindXMyXhoTe+9V6LYj3aFIhTQ4UCg==","shasum":"a290ab498f0adca99e9e380453afd384a83a316c","tarball":"http://registry-npm.ywwl.com/collapse-whitespace/download/collapse-whitespace-1.1.7.tgz","fileCount":9,"unpackedSize":19435,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5bArCRA9TVsSAnZWagAAhg0QAISmlZAlr8H4X7qCPsha\nUZyNJzdTriODqxDsIvRWVQfKpQVtMAlz8ILKx9Im6qJS9MEYp4dgiGNR1iie\nbLMe9oBMcMrdmwT2B27Vb0ZUheBmRYIxsugFmTUbKWX6rfCGX6eMq4yfKoPk\nRR+9Xr/7VMIFxOX5F3CEhfEEdcXADdU1naYh11TmfM/CcfWi+Iq6noYA/Cft\n4m66uFDw5sjRzW8mJ3EgeRAak3wCTVHkOxDtPnFiRfPpQQalYmNWMJFCrkzR\nEYh+syXw6/N+BUFin/iZxGjeZXDbxrPkyMb8P6JDlRSfyQqyXjEqoCb8MPsZ\nvCnWFHBWXgI3jfpVpYBkw1Jw05l/MU3DpWwD277lJSPiszrnrwjaRjF4oy8+\neeV5FrUm32XG6oo0bl14HAXYT23OWHHpLuS06QD0dA5bpkVOe1Y9lwqcQMCx\nOQjw1aw9Ve9PTHUJNQr+U5IsGJNQQz5tklECxRuLt31ffsx41pwPWi1fbTSx\nhjzhqzhiYt/D2nlnuIxlhprppFJYzRBz2BZzVgSJZApO5aKKLLl06+q2I6t5\nJL7kn3C4wySXVxxaRK8pyec3hGN7B/CEdVYFq0ZXGuXyBkqGubGApLV4vgqB\n+1oBqJne3jvPPuVHc0oL7cVcepDgt9K2/B3ghkjxhNmWtu40MqTUMN+XF7pP\nrL2H\r\n=GiMq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDCBGmDMG1Uo0dkp2tNpw7HFBI/KprwzNDMQRBwGMdh0QIhANWG5Uufn5AYTaTcrjdtyn8D/XEVmyksuqNSaRD+f0hZ"}],"size":5970,"noattachment":false,"key":"/collapse-whitespace/-/collapse-whitespace-1.1.7.tgz"},"maintainers":[{"name":"bradley.ayers","email":"bradley.ayers@gmail.com"},{"name":"lucthev","email":"lucthevenard@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/collapse-whitespace_1.1.7_1541779498725_0.8347944897725514"},"_hasShrinkwrap":false,"readme":"# collapse-whitespace\n\n`collapse-whitespace` is a module for removing unnecessary whitespace from a DOM node.\n\n## Installation\n\nUse [`npm`](https://www.npmjs.org/):\n\n```\n$ npm install collapse-whitespace\n```\n\nThen, if you’re using [`browserify`](https://github.com/substack/node-browserify) or something similar:\n\n```js\nvar collapse = require('collapse-whitespace')\n```\n\nOtherwise, just include the minified file, `whitespace.min.js`, somewhere on your page, and this module will make itself available as `collapse`:\n\n```html\n<script src=\"./node_modules/collapse-whitespace/whitespace.min.js\"></script>\n```\n\n## Usage\n\n```js\nvar collapse = require('collapse-whitespace')\nvar div = document.createElement('div')\n\ndiv.innerHTML = '   <p>Foo   bar</p>  <p>Words</p> '\ncollapse(div)\n\nconsole.log(div.innerHTML)\n// '<p>Foo bar</p><p>Words</p>'\n```\n\nFor more examples of what `collapse-whitespace` does, check out the [test page](https://github.com/lucthev/collapse-whitespace/blob/master/test.html).\n\n## API\n\n`collapse-whitespace` exposes a single function (called `collapse` if you're including this module via a `script` tag).\n\n### collapse(node [, isBlock [, isPre]])\n\nRemoves all extraneous whitespace from the given node. By default, `collapse-whitespace` relies on a theoretical [list][blocks] of block elements to determine which elements are block and which ones are inline. This list may be unsuitable for your needs; the optional parameter `isBlock` can be used to tweak this behaviour. `isBlock` should be a function that accepts a DOM node and returns a Boolean.\n\nNote that `collapse-whitespace` also does not take into account the parent(s) of the given node:\n\n```html\n<pre>\n  <span class=\"test\">\n    Lots of whitespace around this text.\n  </span>\n</pre>\n\n<script>\n  collapse(document.querySelector('.test'))\n</script>\n\n<!-- Results in: -->\n<pre>\n  <span class=\"test\">Lots of whitespace around this text.</span>\n</pre>\n```\n\nBy default only `PRE` nodes have whitespace preserved, but this can be customized via the optional `isPre` parameter. `isPre` should be a function that accepts a DOM node and returns a Boolean.\n\n## License\n\nMIT\n\n[regexp]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/RegExp\n[blocks]: https://github.com/webmodules/block-elements\n","publish_time":1541779498846,"_cnpm_publish_time":1541779498846,"dist-tags":{"latest":"1.1.7"}}