These are chat archives for ramda/ramda

23rd
Jul 2016
Rob Halff
@rhalff
Jul 23 2016 14:52
How to do something like this: assocPath(['context', 'start_time'], Date.now)
Rob Halff
@rhalff
Jul 23 2016 15:01

This works:

const setStartTime = (now) => {
    return assocPath(['context', 'start_time'],  now)
};

setStartTime(Date.now())({})

Is it possible using only ramda functions?

err....
wakes up
λ • Geovani de Souza
@geovanisouza92
Jul 23 2016 15:09
@rhalff
const setStartTime = it => (now => R.assocPath(['context', 'start_time'], now(), it))(Date.now)
setStartTime({context:{}})
Rob Halff
@rhalff
Jul 23 2016 15:11
@geovanisouza92 Just found out this also works:
const setStartTime = chain(Date.now, assocPath(['context', 'start_time']))
setStartTime({})
λ • Geovani de Souza
@geovanisouza92
Jul 23 2016 15:11
@rhalff nice :)
Rob Halff
@rhalff
Jul 23 2016 15:12
no idea if that's considered a hack or the proper way though.