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

Some decoupling from underscore => _.each #8475

Merged
merged 5 commits into from
Jul 30, 2020

Conversation

nathanwoulfe
Copy link
Contributor

@nathanwoulfe nathanwoulfe commented Jul 24, 2020

Changes replace _.each with native .forEach in directives (components) and resources - I've sanity checked these locally, all seems to be fine. This is related to #7731 but does not yet complete the _.each removal (figured it's better to have multiple smaller PRs rather than one big one with 50 files modified).

Most are like-for-like replacements, with the exception of some like the changes in umbsearch.directive.js where the value is a dictionary not an array, so uses Object.keys().forEach() because the value is not directly iterable.

Made related syntax changes to replace some indexOf calls with includes (easier to read x.includes(y) compared to x.indexOf(y) !== -1), and converted a few functions to single-line fat-arrows where it made sense to be terser.

@nul800sebastiaan
Copy link
Member

Looks good, thanks @nathanwoulfe! 👍

@nul800sebastiaan nul800sebastiaan changed the title 7731 bye bye underscore => _.each Some decoupling from underscore => _.each Jul 31, 2020
@@ -119,7 +113,7 @@ angular.module('umbraco.services')

return entityResource.searchAll(args.term, args.canceler).then(function (data) {

_.each(data, function (resultByType) {
data.forEach(resultByType => {
Copy link
Member

Choose a reason for hiding this comment

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

@nathanwoulfe Uh oh! This one seems to have broken!

image

Little help please? 🙏

Copy link
Member

Choose a reason for hiding this comment

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

Reproduce by trying to search in the backoffice:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. I thought I'd sorted that... I'm guessing data isn't an array, but an object/dictionary. I'll grab the laptop...

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

Successfully merging this pull request may close these issues.

3 participants