stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

[RFC]: Add `@stdlib/string/for-each-right`

Open kgryte opened this issue 1 year ago • 9 comments

Description

This RFC proposes adding support for invoking a callback for each (visual) character of a string, while iterating from right-to-left.

Signature:

forEachRight( str, clbk[, thisArg] )

where clbk (similar to @stdlib/utils/for-each-right) is provided

  • value: visual character
  • idx: starting character index
  • str: input string

Package: @stdlib/string/for-each-right Alias: forEachRight

Related Issues

None.

Questions

No.

Other

Will require iterating over grapheme cluster breaks. See @stdlib/string/reverse for such an example.

Checklist

  • [X] I have read and understood the Code of Conduct.
  • [X] Searched for existing issues and pull requests.
  • [X] The issue name begins with RFC:.

kgryte avatar Feb 07 '23 23:02 kgryte

Similar to @stdlib/string/for-each, this package should be decomposed into the following base packages:

  • [x] @stdlib/string/base/for-each-right
    • similar to https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/string/base/for-each
  • [x] @stdlib/string/base/for-each-code-point-right
    • similar to https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/string/base/for-each-code-point
  • [ ] @stdlib/string/base/for-each-grapheme-cluster-right
    • similar to https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/string/base/for-each-grapheme-cluster

kgryte avatar Jan 04 '24 05:01 kgryte

Hi @kgryte, Hope all is well! I'd be interested in working on this RFC, if it's still available. Could you please assign me to it? Thanks,

AhmedKhaled590 avatar Feb 24 '24 09:02 AhmedKhaled590

@AhmedKhaled590 Sure thing. Please start by working on @stdlib/string/base/for-each-right. If that goes well, we can move on to the others.

kgryte avatar Feb 24 '24 09:02 kgryte

Hi @kgryte
should I proceed with moving on to the others or should I wait?

AhmedKhaled590 avatar Feb 25 '24 19:02 AhmedKhaled590

@AhmedKhaled590 Looks like that one is near the finish line, so feel free to find another issue.

kgryte avatar Feb 25 '24 19:02 kgryte

@kgryte Okaaay 👍🫡

AhmedKhaled590 avatar Feb 25 '24 19:02 AhmedKhaled590

@Planeshifter This issue should not have been closed.

kgryte avatar Apr 08 '24 02:04 kgryte

The only package which was implemented was @stdlib/string/base/for-each-right. The other packages still need implementing.

kgryte avatar Apr 08 '24 02:04 kgryte

@kgryte @Planeshifter I will complete working on the two remaining packages

AhmedKhaled590 avatar Apr 11 '24 21:04 AhmedKhaled590