Well, I need to make an array concatenation, placed inside the Object.
So the worked solution I've made is:
const usersList = {
tester: [{ id: 1, //... }, //...],
custumers: [{ id: 1, //... }, //...],
admin: [{ id: 1, //... }, //...]
}
let allUsers = []
Object.keys(usersList).forEach(listKey => {
allUsers = [
...allUsers,
...usersList[listKey]
]
})
return allUsers
Besides, I wonder perhaps there is present a much fashionable way to deal with such a case? I tried this one, but it doesn't work:
[...Object.keys(usersList).map(listKey => usersList[listKey])]