feat: add string/base/for-each-right#1369
Conversation
stdlib-bot
left a comment
There was a problem hiding this comment.
👋 Hi there! 👋
And thank you for opening your first pull request! We will review it shortly. 🏃 💨
string/base/for-each-right
|
Hi @Jaysukh-409 |
Planeshifter
left a comment
There was a problem hiding this comment.
Looks great, thank you @AhmedKhaled590 for working on this package (and to @Jaysukh-409 for reviewing!) We can merge after CI has cleared.
…/index.d.ts Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
| * | ||
| * forEach( 'Hello, World!', log ); | ||
| */ | ||
| declare function forEachRight( str: string, clbk: Callback, thisArg?: any ): string; |
There was a problem hiding this comment.
@Planeshifter We can improve the type for thisArg, correct? That will impact the callbacks above.
There was a problem hiding this comment.
@kgryte Yes, specifically making use of ThisParameterType to extract the type of the 'this' parameter of the callback function type, and then using generics for the forEachRight function that will be passed to the this parameter of the callbacks. But that is currently not done in any of the string/base packages and maybe we should address it in a follow-up PR / issue?
There was a problem hiding this comment.
That is fine. Would you mind creating an issue for this with a link to some sample code where we do use ThisParameterType? This could be a good first issue for contributors to work on.
kgryte
left a comment
There was a problem hiding this comment.
A few nits, but overall looking good. Thanks for working on this @AhmedKhaled590.
Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
Resolves #856
Description
Adding support for invoking a callback for each UTF-16 character of a string, while iterating from right-to-left
This pull request:
@stdlib/string/base/for-each-rightRelated Issues
This pull request:
@stdlib/string/for-each-right#856Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers