{"id":15862108,"url":"https://github.com/afeiship/next-nl2br","last_synced_at":"2026-06-19T01:31:38.802Z","repository":{"id":57122812,"uuid":"105094327","full_name":"afeiship/next-nl2br","owner":"afeiship","description":"Replace \\n with \u003cbr /\u003e in JavaScript.","archived":false,"fork":false,"pushed_at":"2024-04-01T06:42:31.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T07:53:29.168Z","etag":null,"topics":["br","html","next","nl2br","tag"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/afeiship.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2017-09-28T02:45:52.000Z","updated_at":"2024-04-08T04:59:45.000Z","dependencies_parsed_at":"2025-02-07T13:22:37.091Z","dependency_job_id":"d6c4ba1b-0017-4f9f-b10b-d038ca7b9d1e","html_url":"https://github.com/afeiship/next-nl2br","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/afeiship/next-nl2br","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fnext-nl2br","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fnext-nl2br/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fnext-nl2br/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fnext-nl2br/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afeiship","download_url":"https://codeload.github.com/afeiship/next-nl2br/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fnext-nl2br/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34514282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["br","html","next","nl2br","tag"],"created_at":"2024-10-05T22:24:48.915Z","updated_at":"2026-06-19T01:31:38.630Z","avatar_url":"https://github.com/afeiship.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# next-nl2br\n\u003e Replace \\n with `\u003cbr /\u003e` in JavaScript.\n\n[![version][version-image]][version-url]\n[![license][license-image]][license-url]\n[![size][size-image]][size-url]\n[![download][download-image]][download-url]\n\n## installation\n```bash\nnpm install -S @jswork/next-nl2br\n```\n\n## usage\n```js\nimport '@jswork/next-nl2br';\n//   example 1: nl2br('Kevin\\nvan\\nZonneveld')\n//   returns 1: 'Kevin\u003cbr /\u003e\\nvan\u003cbr /\u003e\\nZonneveld'\n//   example 2: nl2br(\"\\nOne\\nTwo\\n\\nThree\\n\", false)\n//   returns 2: '\u003cbr\u003e\\nOne\u003cbr\u003e\\nTwo\u003cbr\u003e\\n\u003cbr\u003e\\nThree\u003cbr\u003e\\n'\n//   example 3: nl2br(\"\\nOne\\nTwo\\n\\nThree\\n\", true)\n//   returns 3: '\u003cbr /\u003e\\nOne\u003cbr /\u003e\\nTwo\u003cbr /\u003e\\n\u003cbr /\u003e\\nThree\u003cbr /\u003e\\n'\n//   example 4: nl2br(null)\n//   returns 4: ''\n```\n\n## other solution\n```js\nwhile (message.indexOf(\"\\\\n\") !== -1) {\n   message = message.replace(\"\\\\n\", \"\u003cbr /\u003e\");\n}\n```\n\n## resources\n- http://locutus.io/php/nl2br/\n- https://stackoverflow.com/questions/6331895/how-to-replace-n-with-br-in-javascript\n\n## license\nCode released under [the MIT license](https://github.com/afeiship/next-nl2br/blob/master/LICENSE.txt).\n\n[version-image]: https://img.shields.io/npm/v/@jswork/next-nl2br\n[version-url]: https://npmjs.org/package/@jswork/next-nl2br\n\n[license-image]: https://img.shields.io/npm/l/@jswork/next-nl2br\n[license-url]: https://github.com/afeiship/next-nl2br/blob/master/LICENSE.txt\n\n[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-nl2br\n[size-url]: https://github.com/afeiship/next-nl2br/blob/master/dist/next-nl2br.min.js\n\n[download-image]: https://img.shields.io/npm/dm/@jswork/next-nl2br\n[download-url]: https://www.npmjs.com/package/@jswork/next-nl2br\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Fnext-nl2br","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafeiship%2Fnext-nl2br","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Fnext-nl2br/lists"}