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 sum and sumBy in compat layer #757

Closed
dayongkr opened this issue Oct 26, 2024 · 6 comments
Closed

Support for sum and sumBy in compat layer #757

dayongkr opened this issue Oct 26, 2024 · 6 comments

Comments

@dayongkr
Copy link
Contributor

It will help for solving this #742 .

@raon0211
Copy link
Collaborator

Actually, I think we should support bigints in our original library. There is no easy way to handle them in native JavaScript. What do you think?

Of course, we need compatibility layers for sum and sumBy, too...

@dayongkr
Copy link
Contributor Author

Actually, I think we should support bigints in our original library. There is no easy way to handle them in native JavaScript. What do you think?

Of course, we need compatibility layers for sum and sumBy, too...

I am not adding new functionality to Lodash.

Although handling of bigInt arrays is not explicitly mentioned in Lodash’s test cases, it is already supported due to the way its internal implementation works.

@dayongkr
Copy link
Contributor Author

dayongkr commented Oct 26, 2024

If it’s about performing calculations with a mix of number and bigInt, I also agree that it would be better to add this functionality to the original library!

@raon0211
Copy link
Collaborator

Actually, we intentionally don't mix numbers and bigints in JavaScript; for example, 0 + 1n throws. So we should exclusively handle arrays which have only numbers or only bigints.

I thought handling bigint arrays in the original sum function was needed...

@dayongkr
Copy link
Contributor Author

dayongkr commented Oct 26, 2024

It seems like I misunderstood the intention of the first question. If you’re asking whether the feature that handling an array with a single type(number or bigint) is needed in our original library, I agree.

At first, I’ll implement the compatibility version, and if no one else attempts to implement it in original version, I’ll add it to the original library tomorrow.

@dayongkr
Copy link
Contributor Author

dayongkr commented Oct 26, 2024

Actually, we intentionally don't mix numbers and bigints in JavaScript; for example, 0 + 1n throws. So we should exclusively handle arrays which have only numbers or only bigints.

I thought handling bigint arrays in the original sum function was needed...

I momentarily overlooked that it was big"int". So, I thought you were asking for a feature to perform typecasting and calculations, but I made a brief mistake.

@dayongkr dayongkr closed this as completed Nov 3, 2024
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

No branches or pull requests

2 participants