Naming things is hard and arguments in generic utility functions are no exception. Making functions "tacit" or "point free" removes the need for the extra parameter names and can make your code cleaner and more succinct. In this lesson, we'll create a normal, "pointed" function and then use ramda's useWith
function to refactor our way to point-free bliss.
const R = require('ramda'); const { find, useWith, identity, propEq } = R; const countries = [ {flag: 'GB', cc: 'GB'}, {flag: 'US', cc: 'US'}, {flag: 'CA', cc: 'CA'}, {flag: 'FR', cc: 'FR'} ]; // Normally when you see there are multi args, you can think to use 'R.useWith' // to make it point free style //const getCountry = (cc, list) => find(propEq('cc'), list); /* * Refactor the getCountry function to make it as point-free function * */ const getCountry = useWith( find, [ propEq('cc'), identity ] ); const result = getCountry('US', countries); console.log(result);