Skip to content

fix: fix wrong func result order in readme#51

Closed
dword-design wants to merge 1 commit intosindresorhus:mainfrom
dword-design:func-result-order-readme
Closed

fix: fix wrong func result order in readme#51
dword-design wants to merge 1 commit intosindresorhus:mainfrom
dword-design:func-result-order-readme

Conversation

@dword-design
Copy link
Copy Markdown

No description provided.

@sindresorhus
Copy link
Copy Markdown
Owner

The existing code is correct.

@dword-design
Copy link
Copy Markdown
Author

dword-design commented Jun 1, 2025

@sindresorhus Ummh are you sure? I mean how can it be that below we have the reverse order?

const newObject = mapObject({FOO: true, bAr: {bAz: true}}, (key, value) => [key.toLowerCase(), value]);

Also, [key, value] is the order of Object.entries. I just added it to a lib with tests running on it and [key, value] is the order. I cannot say more. Maybe I'm missing something.

@sindresorhus
Copy link
Copy Markdown
Owner

The example is showing that you can invert key and value. I have already clarified this in the readme now.

@dword-design
Copy link
Copy Markdown
Author

dword-design commented Jun 1, 2025

Ah my bad. Thx. Swapping keys and values is a weird, probably non-existing (first-mentioned) use case ^^.

@dword-design dword-design deleted the func-result-order-readme branch June 1, 2025 14:47
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 this pull request may close these issues.

2 participants