Skip to content

Prevent localize returning undefined + cleanup#57

Merged
bearfriend merged 1 commit into
mainfrom
dgleckler/no-undefined
Mar 28, 2024
Merged

Prevent localize returning undefined + cleanup#57
bearfriend merged 1 commit into
mainfrom
dgleckler/no-undefined

Conversation

@bearfriend
Copy link
Copy Markdown
Contributor

Currently, localize can return undefined if the resources are not ready yet, which can throw errors if consumers always expect a string.

Also eliminated arguments and bind.

@bearfriend bearfriend requested a review from a team as a code owner March 28, 2024 18:50
@bearfriend bearfriend force-pushed the dgleckler/no-undefined branch from 201dd8b to d5a0ae9 Compare March 28, 2024 19:02
Comment thread app-localize-behavior.js
args[arguments[i]] = arguments[i + 1];
}

const replacements = args.reduce((acc, a, idx) => idx % 2 ? acc : { ...acc, [a]: args[idx + 1] }, {});
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not opposed to putting this back to a for if this is too unreadable. I just like things like this being isolated as much as possible.

Copy link
Copy Markdown
Member

@dlockhart dlockhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@bearfriend bearfriend merged commit d1cccca into main Mar 28, 2024
@bearfriend bearfriend deleted the dgleckler/no-undefined branch March 28, 2024 20:26
@d2l-github-release-tokens
Copy link
Copy Markdown

🎉 This PR is included in version 2.10.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants