-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Some decoupling from underscore => _.each #8475
Conversation
Looks good, thanks @nathanwoulfe! 👍 |
@@ -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 => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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...
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 tox.indexOf(y) !== -1
), and converted a few functions to single-line fat-arrows where it made sense to be terser.