Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
icodejs committed Feb 14, 2020
1 parent 93e1c10 commit 094c356
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/pages/Lessons/Lessons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ const getChordsInKey = ({ tonic, chordLength = CHORD_LENGTH }) => {
})
.map((name, index) => {
return {
name,
scaleDegree: index + 1,
chord: R.compose(R.take(chordLength), R.prop('notes'), chord)(name),
...chord(name),
};
});
};
Expand All @@ -85,8 +84,8 @@ const findChordMatch = ({
return;
}

return chordsInKey.find(({ chord }) => {
return chord.every(key => {
return chordsInKey.find(({ notes }) => {
return notes.every(key => {
return noteNames.includes(key);
});
});
Expand Down Expand Up @@ -155,7 +154,7 @@ class Lessons extends Component {
return;
}

return `Chord match: ${JSON.stringify(matchedChord.name)}`;
return `Chord match: ${matchedChord.name} - ${matchedChord.notes}`;
}

render() {
Expand Down

0 comments on commit 094c356

Please sign in to comment.