{"name":"eol","description":"Newline character converter","version":"0.10.0","homepage":"https://ryanve.github.io/eol","funding":"https://github.com/sponsors/ryanve","license":"MIT","author":{"name":"Ryan Van Etten"},"main":"eol.js","types":"eol.d.ts","typings":"eol.d.ts","scripts":{"lint":"npx eslint","preversion":"npm test","pretest":"npm run lint","test":"node test.js"},"repository":{"type":"git","url":"git+https://github.com/ryanve/eol.git"},"bugs":{"url":"https://github.com/ryanve/eol/issues"},"keywords":["eol","lf","cr","crlf","newline","newlines","convert","converter","conversion","character","formatting","format","string","javascript","typescript","ender","file"],"devDependencies":{"aok":"^1.9.0","eslint":"^9.9.1"},"_id":"eol@0.10.0","gitHead":"05a8e9989647b5cdb3063be269486e8798acc962","_nodeVersion":"20.7.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-+w3ktYrOphcIqC1XKmhQYvM+o2uxgQFiimL7B6JPZJlWVxf7Lno9e/JWLPIgbHo7DoZ+b7jsf/NzrUcNe6ZTZQ==","shasum":"51b35c6b9aa0329a26d102b6ddc454be8654739b","tarball":"http://registry-npm.ywwl.com/eol/download/eol-0.10.0.tgz","fileCount":11,"unpackedSize":17650,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCrK6y2iA70tnhaJa9XJSwUBv44iPvidSwT/s+8fEp6kAIgdo1h8nDi+i5Ug4G9Gr1p5fb5Oo6Kp5K578Rw9fjKJIU="}],"size":6140,"noattachment":false,"key":"/eol/-/eol-0.10.0.tgz"},"_npmUser":{"name":"ryanve","email":"ryanve@gmail.com"},"directories":{},"maintainers":[{"name":"ryanve","email":"ryanve@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eol_0.10.0_1725153053057_0.0014017660885610184"},"_hasShrinkwrap":false,"readme":"# [eol](https://ryanve.github.io/eol)\n\n[Newline](http://en.wikipedia.org/wiki/Newline) character converter node module for [JavaScript](eol.js) or [TypeScript](eol.d.ts)\n\n### [npm.im/eol](https://npmjs.com/package/eol)\n\n* `npm install eol`\n* <code><b>let</b> eol = <b>require</b>(\"eol\")</code>\n* <code><b>import</b> eol <b>from</b> \"eol\"</code>\n\n## [API](https://ryanve.github.io/eol#methods)\n\n### eol.auto(<var>text</var>)\n\n* Normalize line endings in <var>text</var> to match the current operating system\n* Returns string with line endings normalized to `\\r\\n` or `\\n`\n\n### eol.crlf(<var>text</var>)\n\n* Normalize line endings in <var>text</var> to <b>CRLF</b> (Windows, DOS)\n* Returns string with line endings normalized to `\\r\\n`\n\n### eol.lf(<var>text</var>)\n\n* Normalize line endings in <var>text</var> to <b>LF</b> (Unix, OS X)\n* Returns string with line endings normalized to `\\n`\n\n### eol.cr(<var>text</var>)\n\n* Normalize line endings in <var>text</var> to <b>CR</b> (Mac OS)\n* Returns string with line endings normalized to `\\r`\n\n### eol.dub(<var>text</var>)\n\n* Generate normalizer where linebreaks become <var>text</var>\n* Used [internally](eol.js) to generate the [normalizers](#api) above\n* Returns composed pure function with [creative potential](#dubbing)\n\n### eol.before(<var>text</var>)\n\n* Add linebreak before <var>text</var>\n* Returns string with linebreak added before text\n* Uses `eol.auto` linebreak\n* `eol.lf(eol.before(text))` &vellip;\n\n### eol.after(<var>text</var>)\n\n* Add linebreak after <var>text</var>\n* Returns string with linebreak added after text\n* Uses `eol.auto` linebreak\n* `eol.lf(eol.after(text))` &vellip;\n\n### eol.match(<var>text</var>)\n\n* Detect or inspect linebreaks in <var>text</var>\n* Returns array of matched linebreaks\n\n### eol.split(<var>text</var>)\n\n* Split <var>text</var> by newline\n* Returns array of lines\n\n### Joining\n\nCoercing [normalizers](#api) to string yields the appropriate character...useful glue for joining\n\n```js\nString(eol.lf) // \"\\n\"\neol.split(text).join(eol.auto) // === eol.auto(text)\neol.split(text).filter(line => line).join(eol.auto) // text joined after removing empty lines\neol.split(text).slice(-3).join(eol.auto) // last 3 lines joined\n```\n\n### Matching\n\nDetect or inspect via match\n\n```js\neol.match(\" \") // []\neol.match(\"world\\nwide\\nweb\") // [\"\\n\",\"\\n\"]\n```\n\n### Dubbing\n\nGenerate alternate [normalizers](#api)\n\n```\nlet extra = eol.dub(\"\\n\\n\\n\")\nextra(\"...\")\n```\n\n```\nlet huh = eol.dub(\"???\")\nhuh(\"...\")\n```\n\n## modularitY\n\n### [edit-file](https://github.com/ryanve/edit-file)\n\n```js\nlet eol = require(\"eol\")\nlet edit = require(\"edit-file\")\n\nedit(\"sample.txt\", eol.lf)\n```\n\n### [map-file](https://github.com/ryanve/map-file)\n\n```js\nlet eol = require(\"eol\")\nlet map = require(\"map-file\")\n\nmap({\n  from: \"from.txt\",\n  to: \"to.txt\",\n  map: eol.lf\n})\n```\n\n### [ssv](https://ryanve.github.io/ssv)\n\n```js\nlet ssv = require(\"ssv\")\nlet eol = require(\"eol\")\n\nlet deep = eol.split(\"spaced.txt\").map(ssv.split)\n```\n\n### Yours\n\nHave an `eol` sample to share?\n\n[Then please do](../../issues/new) :test_tube: :test_tube: :test_tube: :test_tube:\n\n## [opensource](package.json)\n\n[<b>MIT</b> License](LICENSE.md)\n\n[**∞/0**](#eol)\n","publish_time":1725153053204,"_cnpm_publish_time":1725153053204,"dist-tags":{"latest":"0.10.0"}}