These are chat archives for ramda/ramda

Oct 2018
Miguel Dorta
Oct 23 2018 14:11
export const createAddresses = addresses => {
  const created_at = isoDateNow();
  return map((address_hex: string) => ({
Im trying to write this function using ramda
how can I improve this code?
Miguel Dorta
Oct 23 2018 14:26
my biggest problem here is that I need to create the date before mapping the array
Ben Briggs
Oct 23 2018 17:49
@ellipticaldoor I find it readable enough to be honest - though I would probably make createAddresses take two params where one of them is the date:
const createAddresses = created_at => map(address_hex => ({ address_hex, created_at }))
Then you can call it with createAddresses(isoDateNow())(['x'])

My other attempt was a pointfree version but it loses a lot of readability:

converge(compose(map(zipObj(['address_hex', 'created_at'])), xprod), [
  compose(of, isoDateNow),
])(['x', 'y'])

And is not quite the same if isoDateNow is affected by passing in some params