Skip to content

Instantly share code, notes, and snippets.

@imkrish
Created September 2, 2017 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imkrish/8e4aa5870194b8e8e4c6b803d8eeed87 to your computer and use it in GitHub Desktop.
Save imkrish/8e4aa5870194b8e8e4c6b803d8eeed87 to your computer and use it in GitHub Desktop.
05-lens-over.js
const R = require('ramda')
const products = [...]
const unitCostLens = R.lensProp('unit_cost')
const dollarToNumber = R.pipe(R.tail, Number)
const unitCostDollarToNumber = R.over(unitCostLens, dollarToNumber)
const mapUnitCostDollarToNumber = R.map(unitCostDollarToNumber)
const result = mapUnitCostDollarToNumber(products)
cconsole.log(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment