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

Bug1413156 - lodash to ES6: replace _.without _.values _.last usage #3338

Merged
merged 1 commit into from Mar 16, 2018

Conversation

Dottori
Copy link
Contributor

@Dottori Dottori commented Mar 13, 2018

Bug1413156 - lodash to ES6: replace _.without _.values _.last usage

@Dottori
Copy link
Contributor Author

Dottori commented Mar 14, 2018

@camd @edmorley : Hello, this PR is ready for review. Please let me know if any further changes are required =).

@edmorley edmorley requested a review from camd March 15, 2018 12:27
@edmorley
Copy link
Contributor

Many thanks for the PRs! I've requested review from Cameron :-)

Copy link
Contributor

@camd camd left a comment

Choose a reason for hiding this comment

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

Just a few syntactic things to fix up here. Nice work! Thanks for the PR. :)

@@ -165,7 +165,7 @@ export default class PushList extends React.Component {
// since we fetched more pushes, we need to persist the
// push state in the URL.
const rsArray = this.ThResultSetStore.getPushArray();
const updatedLastRevision = _.last(rsArray).revision;
const updatedLastRevision = rsArray.slice(-1)[0].revision;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer to just use ``rsArray[rsArray.length -1] for this

@@ -212,7 +212,9 @@ treeherderApp.controller('MainCtrl', [
*/

$scope.isSingleTierSelected = function () {
return _.without(_.values($scope.tiers), false).length === 1;
return Object.values($scope.tiers).filter(function (value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use the more terse ES6 syntax like:

return Object.values($scope.tiers).filter(value => (value !== false)).length === 1;

@@ -278,7 +278,7 @@ treeherder.factory('ThRepositoryModel', [

// To get the current repo to display first, we must
// ensure it's added to the array last, as per normal user interaction
storedWatched = _.without(storedWatched, options.name);
storedWatched = storedWatched.filter(function (value) { return value !== options.name; });
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, this could be:

storedWatched.filter(value => (value !== options.name));

@@ -364,7 +364,7 @@ treeherder.factory('ThResultSetStore', [
}

repoData.pushes.sort(rsCompare);
repoData.rsMapOldestTimestamp = _.last(repoData.pushes).push_timestamp;
repoData.rsMapOldestTimestamp = repoData.pushes.slice(-1)[0].push_timestamp;
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use repoData.pushes.length - 1 again here as above.

@@ -296,7 +296,9 @@ treeherder.factory('thJobFilters', [
if (value) {
const oldQsVal = _getFiltersOrDefaults(field);
if (oldQsVal && oldQsVal.length) {
newQsVal = _.without(oldQsVal, value);
newQsVal = oldQsVal.filter(function (filterValue) {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use ES6 syntax here again, as above

Bug1413156 - lodash to ES6: replace _.without _.values _.last usage

Bug1413156 - lodash to ES6: replace _.without _.values _.last usage
@Dottori Dottori force-pushed the bug1413156-without-values-last branch from b6e26c3 to 8bacd73 Compare March 16, 2018 04:49
Copy link
Contributor

@camd camd left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for the changes!

@camd camd merged commit 5f68792 into mozilla:master Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants