Skip to content

Commit bd3c0c0

Browse files
committed
Use Array#find in a less misleading way
It takes a predicate.
1 parent acd6c8e commit bd3c0c0

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

app/routes/crate/version.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ export default Route.extend({
4545
.then(versions => {
4646
const latestStableVersion = versions.find(version => {
4747
// Find the latest version that is stable AND not-yanked.
48-
if (!isUnstableVersion(version.get('num')) && !version.get('yanked')) {
49-
return version;
50-
}
48+
return !isUnstableVersion(version.get('num')) && !version.get('yanked');
5149
});
5250

5351
if (latestStableVersion == null) {
@@ -56,9 +54,7 @@ export default Route.extend({
5654
// we have to fall back to the latest one that is unstable....
5755
const latestUnyankedVersion = versions.find(version => {
5856
// Find the latest version that is not-yanked.
59-
if (!version.get('yanked')) {
60-
return version;
61-
}
57+
return !version.get('yanked');
6258
});
6359

6460
if (latestUnyankedVersion == null) {

0 commit comments

Comments
 (0)