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

%TypedArray% methods #20

Open
zloirock opened this issue Jul 14, 2021 · 3 comments
Open

%TypedArray% methods #20

zloirock opened this issue Jul 14, 2021 · 3 comments

Comments

@zloirock
Copy link
Contributor

Sure, methods from this proposal should have equal on %TypedArray%.

The question: how should work %TypedArray%.prototype.groupBy?

@jridgewell
Copy link
Member

Sure, methods from this proposal should have equal on %TypedArray%.

Yup. Strangely flatMap is also missing, though flat would obviously not do anything.

The question: how should work %TypedArray%.prototype.groupBy?

I think what you're hinting at is what the values would be in the return object? In a normal array.groupBy(), we'd receive { [key: string]: T[] } (arrays of the items). We might want to return the TypedArray and populate it with the items instead of a plain array?

@zloirock
Copy link
Contributor Author

I mean that since the length of typed arrays is a constant, we can't use the same logic for returning object with typed arrays.

@jridgewell
Copy link
Member

we can't use the same logic for returning object with typed arrays

Correct, but the spec text can change to support it. I wrote the spec the way I would write the JS, but it may be more appropriate to use a list of { key, list } structs internally, and transform that into the output object and array/typedarray.

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