Split an Array of Objects into two groups based on the values of a property using Lodash

preview_player
Показать описание
In this example we use Lodash's _.partition method to split an Array of user Objects into two groups, admin and normal users.

const users = [
{
description:'Simon Cork',
admin: false
},
{
description: 'Mary Jones',
admin: true
},
{
description: 'Jane Smith',
admin: false
}
]

_.partition(users,{admin:true})

Рекомендации по теме