I have an object that looks like
var foundUser = {
charData: []
}
which then I load an object from a database using mysql and then I ca
Have you ever tried lodash/fp? It comes with all the same functions, but they are curried and none of them mutates the input.
Because of that, you can compose them in a really nice way.
Example:
import moment from 'moment'
import { compose, filter, groupBy, size, sortBy } from 'lodash/fp'
const fromAdmin = filter({ type: 'admin' })
const groupedByDate = groupBy(message => moment(message.createdAt).format('YYYYMMDD'))
const sorted = sortBy('createdAt')
const unreadByUser = filter({ isReadByUser: false })
const groupedMessages = compose(
groupedByDate,
sorted,
unreadByUser,
fromAdmin,
)(messages)