Adonis has collection like Laravel Collection

We want some array operations like merged, find by key, value, groupBy

1 Like

Hey @ashishnimrot! :wave:

Use a library like lodash or collectjs.

3 Likes

Yea, lodash is fantastic… and you can even restrict what you load to only specific modules, so instead of loading all of lodash, you could load just it’s take module, for example.

const _take = use('lodash/take')
// or
const _ = use('lodash')

// then
_take()
// is the same as
_.take()

That’s usually more an issue for client-side stuff, but worth knowing that you can load just explicit pieces of lodash. :slight_smile:

2 Likes