Skip to content

Instantly share code, notes, and snippets.

@ispoljari
Created June 6, 2020 12:07
Show Gist options
  • Select an option

  • Save ispoljari/b7c116bdfa09afa62221c0ddd97e9630 to your computer and use it in GitHub Desktop.

Select an option

Save ispoljari/b7c116bdfa09afa62221c0ddd97e9630 to your computer and use it in GitHub Desktop.
bad take on a match making algorithm
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