{"id":15070111,"url":"https://github.com/ryanve/eol","last_synced_at":"2025-04-07T06:13:10.813Z","repository":{"id":14943939,"uuid":"17668528","full_name":"ryanve/eol","owner":"ryanve","description":"JavaScript newline character converter","archived":false,"fork":false,"pushed_at":"2024-09-01T01:07:07.000Z","size":79,"stargazers_count":40,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T05:03:24.035Z","etag":null,"topics":["character-converter","eol","javascript","linebreak","linebreaks","newline","node","node-js","nodejs"],"latest_commit_sha":null,"homepage":"http://ryanve.dev/eol","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"zombieCraig/CarHackerBookCode","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ryanve","ko_fi":"ryanve"}},"created_at":"2014-03-12T13:50:40.000Z","updated_at":"2025-01-06T06:33:57.000Z","dependencies_parsed_at":"2024-06-18T13:59:01.379Z","dependency_job_id":"a0aca45d-394a-43e8-9943-defc8d21a19a","html_url":"https://github.com/ryanve/eol","commit_stats":{"total_commits":70,"total_committers":4,"mean_commits":17.5,"dds":0.05714285714285716,"last_synced_commit":"7045668d0b0aba1e9f1433638548235baf0c04cb"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Feol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Feol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Feol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Feol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanve","download_url":"https://codeload.github.com/ryanve/eol/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601449,"owners_count":20964864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["character-converter","eol","javascript","linebreak","linebreaks","newline","node","node-js","nodejs"],"created_at":"2024-09-25T01:48:06.948Z","updated_at":"2025-04-07T06:13:10.794Z","avatar_url":"https://github.com/ryanve.png","language":"HTML","funding_links":["https://github.com/sponsors/ryanve","https://ko-fi.com/ryanve"],"categories":[],"sub_categories":[],"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* \u003ccode\u003e\u003cb\u003elet\u003c/b\u003e eol = \u003cb\u003erequire\u003c/b\u003e(\"eol\")\u003c/code\u003e\n* \u003ccode\u003e\u003cb\u003eimport\u003c/b\u003e eol \u003cb\u003efrom\u003c/b\u003e \"eol\"\u003c/code\u003e\n\n## [API](https://ryanve.github.io/eol#methods)\n\n### eol.auto(\u003cvar\u003etext\u003c/var\u003e)\n\n* Normalize line endings in \u003cvar\u003etext\u003c/var\u003e to match the current operating system\n* Returns string with line endings normalized to `\\r\\n` or `\\n`\n\n### eol.crlf(\u003cvar\u003etext\u003c/var\u003e)\n\n* Normalize line endings in \u003cvar\u003etext\u003c/var\u003e to \u003cb\u003eCRLF\u003c/b\u003e (Windows, DOS)\n* Returns string with line endings normalized to `\\r\\n`\n\n### eol.lf(\u003cvar\u003etext\u003c/var\u003e)\n\n* Normalize line endings in \u003cvar\u003etext\u003c/var\u003e to \u003cb\u003eLF\u003c/b\u003e (Unix, OS X)\n* Returns string with line endings normalized to `\\n`\n\n### eol.cr(\u003cvar\u003etext\u003c/var\u003e)\n\n* Normalize line endings in \u003cvar\u003etext\u003c/var\u003e to \u003cb\u003eCR\u003c/b\u003e (Mac OS)\n* Returns string with line endings normalized to `\\r`\n\n### eol.dub(\u003cvar\u003etext\u003c/var\u003e)\n\n* Generate normalizer where linebreaks become \u003cvar\u003etext\u003c/var\u003e\n* Used [internally](eol.js) to generate the [normalizers](#api) above\n* Returns composed pure function with [creative potential](#dubbing)\n\n### eol.before(\u003cvar\u003etext\u003c/var\u003e)\n\n* Add linebreak before \u003cvar\u003etext\u003c/var\u003e\n* Returns string with linebreak added before text\n* Uses `eol.auto` linebreak\n* `eol.lf(eol.before(text))` \u0026vellip;\n\n### eol.after(\u003cvar\u003etext\u003c/var\u003e)\n\n* Add linebreak after \u003cvar\u003etext\u003c/var\u003e\n* Returns string with linebreak added after text\n* Uses `eol.auto` linebreak\n* `eol.lf(eol.after(text))` \u0026vellip;\n\n### eol.match(\u003cvar\u003etext\u003c/var\u003e)\n\n* Detect or inspect linebreaks in \u003cvar\u003etext\u003c/var\u003e\n* Returns array of matched linebreaks\n\n### eol.split(\u003cvar\u003etext\u003c/var\u003e)\n\n* Split \u003cvar\u003etext\u003c/var\u003e 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 =\u003e 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[\u003cb\u003eMIT\u003c/b\u003e License](LICENSE.md)\n\n[**∞/0**](#eol)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Feol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanve%2Feol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Feol/lists"}