Replace graphemesplit by compatible standard Intl.Segmenter - #33
Open
IagoSRL wants to merge 2 commits into
Open
Conversation
…ibution deps, same tests pass.
There was a problem hiding this comment.
Pull request overview
Replaces the external graphemesplit dependency with the platform-provided Intl.Segmenter to perform grapheme segmentation, reducing distribution/runtime dependencies while keeping fuzzy matching’s grapheme-aware normalization behavior.
Changes:
- Swapped
graphemesplitimport for anIntl.Segmenter-basedsplit()implementation. - Removed
graphemesplitfromdependencies(and pruned lockfile entries). - Updated package metadata/lockfile versioning accordingly.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/fuzzy.js | Reimplements grapheme splitting using Intl.Segmenter instead of graphemesplit. |
| package.json | Removes the graphemesplit runtime dependency. |
| package-lock.json | Removes graphemesplit and its transitive dependencies from the lockfile. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2
to
+3
| const segmenter = new Intl.Segmenter(undefined, {granularity: "grapheme"}); | ||
| const split = (str) => [...segmenter.segment(str)].map((segment) => segment.segment); |
Comment on lines
52
to
54
| "rollup-plugin-copy": "^3.3.0" | ||
| }, | ||
| "dependencies": { | ||
| "graphemesplit": "^2.4.1" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intl.Segmenter is Baseline 2024 Newly Available; at Node since v16, 2021.
With this change, there is no production/distribution dependencies.
All tests passes unchanged.
Following recommendations to reduce packages as in e18e.