{"id":16831145,"url":"https://github.com/chearon/word-breaker","last_synced_at":"2025-03-17T22:50:38.314Z","repository":{"id":142611324,"uuid":"205078138","full_name":"chearon/word-breaker","owner":"chearon","description":"Unicode word boundary algorithm from UAX29 section 4","archived":false,"fork":false,"pushed_at":"2019-09-08T18:37:05.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T19:52:14.853Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chearon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-08-29T04:08:46.000Z","updated_at":"2021-08-06T12:23:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a68a670-d477-4151-b1d8-c7f8f8275eee","html_url":"https://github.com/chearon/word-breaker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chearon%2Fword-breaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chearon%2Fword-breaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chearon%2Fword-breaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chearon%2Fword-breaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chearon","download_url":"https://codeload.github.com/chearon/word-breaker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244122471,"owners_count":20401431,"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-13T11:42:24.488Z","updated_at":"2025-03-17T22:50:38.280Z","avatar_url":"https://github.com/chearon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# word-breaker\n\nImplementation of the Unicode Word Boundary Rules algorithm (UAX29 4.1). At time of writing it targets **Unicode 12**.\n\nWhat are word boundaries used for?\n* When you double click a word inside your web browser, UAX29 sec 4 defines where the start and end of the selection should be\n* CSS's text-transform: uppercase\n* Can be used for search algorithms too\n\nIt will keep together grapheme clusters, like emojis with skin tones or diacritical marks like a grave accent. It passes all 613 tests from the [Unicode auxillary files](https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakTest.html#samples) for word breaks.\n\n## API\n\n```javascript\nconst WordBreaker = require('word-breaker');\nconst string = 'UAX29 has rules like   WB4\\t👌🏼';\nconst wb = new WordBreaker(string);\nlet last = null;\nlet i;\n\nwhile ((i = wb.nextBreak()) !== null) {\n  if (last !== null) console.log(string.slice(last, i));\n  last = i;\n}\n\n// output:\n// UAX29\n// _\n// has\n// _\n// rules\n// _\n// like\n// ___\n// WB4\n// \\t\n// 👌🏼\n```\n\n## More info\n\nInspired by [foliojs/grapheme-breaker](https://github.com/foliojs/grapheme-breaker) which comes from the same specification,  and [foliojs/linebreak](https://github.com/foliojs/linebreak). It uses the same project structure as well as [unicode-trie](https://github.com/foliojs/unicode-trie) for character classification.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchearon%2Fword-breaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchearon%2Fword-breaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchearon%2Fword-breaker/lists"}