-
-
Notifications
You must be signed in to change notification settings - Fork 600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add string/base/last-grapheme-cluster
#1810
feat: add string/base/last-grapheme-cluster
#1810
Conversation
I have implemented the I think before moving ahead with this pr we should address rewriting of edit prev-grapheme-cluster -> prev-grapheme-cluster-break |
It doesn't need to be rewritten tmk, just fixed. |
Relevant issues:
Now that I am jogging my memory, yes, |
Yes, to be fixed Also just to be clear the packages mentioned in #1062 What should be the further course of action, fixing |
@adityacodes30 I'd say go ahead and implement in terms of |
Alright , ill edit this package to use |
i have implemented this package with the logic
i think this approach should suffice until prev-grapheme-cluster-break receives the fixes, will push code in a bit |
Hmm...I wonder if this can be implemented in a single pass, even with next-grapheme-cluster-break. |
In fact, I am fairly sure you don't need to first compute the number of grapheme clusters. |
I thought about it as well, however |
Yes, you can use a circular buffer (see https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/circular-buffer), where the buffer size is |
got it ! I thought of another approach as well , we could use the Edit - Thought a bit more on it, it would unnecessarily increase the space complexity. Circular buffer approach seems the best. |
implementation updated ! |
@Planeshifter @kgryte |
This is handled through automation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @adityacodes30 I recommend spending some time going over the changes I made to simplify your implementation and avoid unnecessary string concatenation.
Resolves #1729
Description
This PR adds the package
@stdlib/string/base/last-grapheme-cluster
This pull request:
@stdlib/string/base/last-grapheme-cluster
which returns the lastn
grapheme clusters (i.e., user-perceived characters) of a string.Related Issues
#854
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers