Created
June 6, 2020 12:07
-
-
Save ispoljari/b7c116bdfa09afa62221c0ddd97e9630 to your computer and use it in GitHub Desktop.
bad take on a match making algorithm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { Map } = require('immutable'); | |
| const mike = Map({ | |
| name: 'Mike', | |
| age: 28, | |
| hobby: 'running', | |
| favouriteFood: 'pizza' | |
| }); | |
| const jane = Map({ | |
| name: 'Jane', | |
| age: 26, | |
| hobby: 'running', | |
| favouriteFood: 'lasagne' | |
| }); | |
| const generateMessage = (nameA, nameB) => `Congratulations ${nameA} and ${nameB}`; | |
| const areCompatibleMatch = (personA, personB) => ( | |
| personA.get('hobby') ==== personB.get('hobby') || | |
| personA.get('favouriteFood') ==== personB.get('favouriteFood') ? | |
| generateMessage(personA.name, personB.name) : | |
| false; | |
| ); | |
| areCompatibleMatch(mike, jane); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment