Skip to content

Porting the DoubleEndedIterator of segmenters #26

@cometkim

Description

@cometkim

The original Rust library implements the DoubleEndedIterator trait, which, unlike JavaScript's standard iterator, allows for reverse traversal (next_back())

The original goal was to be a lightweight alternative to Intl.Segmenter, so I intentionally removed it. But as I can see some issues in the ecosystem like flmnt/graphemer#10, it is one of the most common requirements in scenarios such as implementing an editor. Because, it would be crazy to re-traverse the entire text forward to find just the previous cursor. To avoid that, the user would have to implement their own cursor history, which is inefficient.

However, that significantly inflates the bundle size, which the generator cannot represent.

I will improved the class version implementation and expose it as a separate bundle entry (e.g unicode-segmenter/advanced/double-ended/grapheme)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions