Files
NapCatQQ/.pnpm-store/v3/files/8b/1c7d05c48835e5aa83b30c511b83672c1fdf622c36eb13532cf4838676e5990f3173d0ae5e0508d5c88f0ae89ed9fb571e5d51a39653fa8004f15a1e044e73
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

29 lines
952 B
Plaintext

# @marijn/find-cluster-break
Small JavaScript module for finding grapheme cluster breaks in
strings, scanning from a given position.
```javascript
import {findClusterBreak} from "@marijn/find-cluster-break"
console.log(findClusterBreak("💪🏽🦋", 0))
// → 4
```
This code is open source, released under an MIT license.
## Documentation
**`findClusterBreak`**`(str: string, pos: number, forward = true, includeExtending = true): number`
Returns a next grapheme cluster break _after_ (not equal to) `pos`,
if `forward` is true, or before otherwise. Returns `pos` itself if no
further cluster break is available in the string. Moves across
surrogate pairs, extending characters (when `includeExtending` is
true, which is the default), characters joined with zero-width joiners,
and flag emoji.
**`isExtendingChar`**`(code: number): boolean`
Query whether the given character has a `Grapheme_Cluster_Break` value
of `Extend` in Unicode.