Skip to content

Instantly share code, notes, and snippets.

@beardedtim
Last active May 11, 2022 02:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beardedtim/21a0d52533b3916495603e2f20978776 to your computer and use it in GitHub Desktop.
Save beardedtim/21a0d52533b3916495603e2f20978776 to your computer and use it in GitHub Desktop.
import R from 'ramda'
import { account } from 'store/lenses'
export default {
ids: R.view(account.ids),
recentActivity: R.memoize(
state => R.compose(
ids => {
const hash = R.view(account.data, state)
const createDataObj = id => R.compose(
R.merge({ id }),
R.flip(R.prop)(hash)
)(id)
return ids.map(createDataObj)
.map(({ text, ...data }) => ({
...data,
content: text,
}))
},
R.take(5),
R.view(account.ids)
)(state)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment