Create an object from an array with multiple ids, using the id as a key and knowing how many identical ids each have
function createOrder(organization: TreeOrganization, valueId: number): number {
return organization.values
.map(o => o.parentId)
.reduce((a, c) => {
return a[`${c}`] === undefined
? { ...a, [`${c}`]: 1 }
: { ...a, ...{ [`${c}`]: a[`${c}`] + 1 } }
}, {} as { [ind: string]: number })
}