<!DOCTYPE html>
<html>
<head>
<script data-require="ramda@*" data-semver="0.22.1" src="https://unpkg.com/ramda@0.22.1/dist/ramda.min.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="output"></div>
<script src="script.js"></script>
</body>
</html>
// make console.log write to the page for better in-browser experience
(function () {
var body = document.querySelector('body');
body.style['fontFamily'] = 'monospace';
body.style['fontSize'] = '2em';
console.log = function (x) { body.innerText += JSON.stringify(x) + '\n'; };
}());
// const R = require('ramda')
const {find, propEq, useWith, identity} = R
const countries = [
{cc: 'GB', flag: 'π¬π§'},
{cc: 'US', flag: 'πΊπΈ'},
{cc: 'CA', flag: 'π¨π¦'},
{cc: 'FR', flag: 'π«π·'}
]
// const getCountry = (cc, list) => find(propEq('cc', cc), list)
const getCountry = useWith(find, [propEq('cc'), identity])
const result = getCountry('FR', countries)
console.log(result)
/* Styles go here */