{"id":18037491,"url":"https://github.com/lautis/unicode-substring","last_synced_at":"2025-07-07T04:10:35.054Z","repository":{"id":57386147,"uuid":"29986662","full_name":"lautis/unicode-substring","owner":"lautis","description":"Unicode-aware substring for JavaScript","archived":false,"fork":false,"pushed_at":"2017-07-11T18:41:19.000Z","size":9,"stargazers_count":23,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T00:39:51.993Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/lautis.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}},"created_at":"2015-01-28T20:25:19.000Z","updated_at":"2024-04-14T03:12:05.000Z","dependencies_parsed_at":"2022-08-31T14:31:59.214Z","dependency_job_id":null,"html_url":"https://github.com/lautis/unicode-substring","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lautis/unicode-substring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lautis%2Funicode-substring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lautis%2Funicode-substring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lautis%2Funicode-substring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lautis%2Funicode-substring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lautis","download_url":"https://codeload.github.com/lautis/unicode-substring/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lautis%2Funicode-substring/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264010960,"owners_count":23543717,"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-30T13:10:42.679Z","updated_at":"2025-07-07T04:10:35.033Z","avatar_url":"https://github.com/lautis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unicode-substring [![Build Status](https://travis-ci.org/lautis/unicode-substring.svg?branch=master)](https://travis-ci.org/lautis/unicode-substring)\n\nUnicode-aware substring for JavaScript. Surrogate pairs are counted as a single character.\n\n## What?\n\nCharacters in JavaScript strings are exposed as 16-bit code points, also known as UCS-2 encoding. This usually good enough, but since there are more than 2^16 characters in Unicode, 16 bits is not enough to represent all characters. To overcome this limitation, characters with scalar value over `0x10FFFF` need to be encoded as surrogate pairs. This encoding is known as UTF-16.\n\nThe purpose of this library is to treat surrogate pairs as one character when extracting substrings from a string. This might be preferable if indices are returned from an Unicode-compatible environment.\n\n## Usage\n\n```javascript\n\nvar unicodeSubstring = require('unicode-substring')\n// unicodeSubstring(string, start, end)\nunicodeSubstring(\"💥Emoji Rule💥\", 0, 6)\n// =\u003e \"💥Emoji\"\n```\n\nThe `start` and `end` parameters behave similarly as [String.prototype.substring](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/substring).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flautis%2Funicode-substring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flautis%2Funicode-substring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flautis%2Funicode-substring/lists"}