Skip to content
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

Support for forEachRight #107

Closed
haejunejung opened this issue Jul 2, 2024 · 4 comments · Fixed by #119
Closed

Support for forEachRight #107

haejunejung opened this issue Jul 2, 2024 · 4 comments · Fixed by #119

Comments

@haejunejung
Copy link
Contributor

Hello,
If you need loadsh's forEachRight function, Can I work it?

If it is okay to proceed, lodash's forEachRight supports both Array and Object, but in [#91], I would like to ask if it is only necessary to implement array in the array category.

@raon0211
Copy link
Collaborator

raon0211 commented Jul 2, 2024

Sure! I think we might just implement it for arrays.

@haejunejung
Copy link
Contributor Author

I've implemented a forEachRight function:

export function forEachRight<T>(arr: T[] = [], callbackfn: (value: T, index: number, arr: T[]) => void): void {
  for (let i = arr.length - 1; i >= 0; i--) {
    const element = arr[i];
    callbackfn(element, i, arr);
  }
}

If this implementation looks good, may I proceed with enhancing the documentation and tests, and then submit a pull request?

@raon0211
Copy link
Collaborator

raon0211 commented Jul 2, 2024

Looks great! What about renaming callbackfn to callback? (It seems that it is shorter, and it does not lose a lot of meaning.)

@haejunejung
Copy link
Contributor Author

Oh, I think the code you suggested is better too.
Thanks for your help 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants