{"id":15759974,"url":"https://github.com/bubkoo/break-string","last_synced_at":"2025-03-31T09:14:25.887Z","repository":{"id":66336006,"uuid":"55473245","full_name":"bubkoo/break-string","owner":"bubkoo","description":"Break string into lines according to visual width","archived":false,"fork":false,"pushed_at":"2017-06-21T02:30:28.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T15:18:46.963Z","etag":null,"topics":[],"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/bubkoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-04-05T06:26:04.000Z","updated_at":"2021-11-09T02:17:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"d7946217-3ae3-402b-8cca-65622b0e77a6","html_url":"https://github.com/bubkoo/break-string","commit_stats":{"total_commits":6,"total_committers":3,"mean_commits":2.0,"dds":"0.33333333333333337","last_synced_commit":"cda24d7bbedf8e9c923ab0c854c68c0bf95ae6bb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fbreak-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fbreak-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fbreak-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fbreak-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bubkoo","download_url":"https://codeload.github.com/bubkoo/break-string/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246443543,"owners_count":20778251,"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":[],"created_at":"2024-10-04T10:40:27.290Z","updated_at":"2025-03-31T09:14:25.870Z","avatar_url":"https://github.com/bubkoo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# break-string\n\n\u003e Break string into lines according to visual width.\n\n[![MIT License](https://img.shields.io/badge/license-MIT_License-green.svg?style=flat-square)](https://github.com/bubkoo/break-string/blob/master/LICENSE)\n\n[![build:?](https://img.shields.io/travis/bubkoo/break-string/master.svg?style=flat-square)](https://travis-ci.org/bubkoo/break-string)\n[![coverage:?](https://img.shields.io/coveralls/bubkoo/break-string/master.svg?style=flat-square)](https://coveralls.io/github/bubkoo/break-string)\n\n\nSome Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.\n\nUseful to be able to break the string into lines according to visual width(the number of columns) in the terminal.\n\nInspired by:\n\n- [string-width](https://github.com/sindresorhus/string-width) - Get visual width of a string\n- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string\n\n## Install \n\n```\n$ npm install --save break-string\n```\n\n\n## Usage\n\n```js\nvar breakString = require('break-string');\n\n\n// normal string\nbreakString('abcdefg', 4);\n// =\u003e ['abcd', 'efg']\n\n\n// with line break\nbreakString('abcd\\nefg', 3);\n// =\u003e ['abc', 'd', 'efg']\nbreakString('abcd\\nefg', 4);\n// =\u003e ['abcd', 'efg']\nbreakString('abcd\\nefg', 5);\n// =\u003e ['abcd', 'efg']\n\n\n// with astral symbols\nbreakString('a🐴bcde', 4);\n// =\u003e ['a🐴bc', 'de']\n\n\n// with double with char\nbreakString('a古bcde', 4);\n// =\u003e ['a古b', 'cde']\n\n\n// with ansi code\nbreakString('uni\\u001b[22mcorn', 4);\n// =\u003e ['uni\\u001b[22mc', 'orn']\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubkoo%2Fbreak-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbubkoo%2Fbreak-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubkoo%2Fbreak-string/lists"}