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

Perhaps just mimic Array.from()? #4

Open
getify opened this issue Oct 7, 2019 · 2 comments

Comments

@getify
Copy link

commented Oct 7, 2019

Two options... could Object.fromEntries() just add an optional second param function that's called for each entry?

Or just add Object.from() which shallow-iterates a whole object (like Object.assign() does) but then has the optional second param function?

@ljharb

This comment has been minimized.

Copy link
Member

commented Oct 7, 2019

See tc39/proposal-object-from-entries#13 - it's not a clear-cut choice for what the second argument should be.

For the latter, would Object.from just be function (o, fn) { return Object.fromEntries(Object.entries(o).map(fn)); }?

@getify

This comment has been minimized.

Copy link
Author

commented Oct 7, 2019

For the latter, would Object.from just be...

Yep, that makes sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.