const obj = {
115: [26, 27, 10],
116: [26, 28, 27],
117: [26, 27, 28],
118: [10, 26, 27, 28],
119: [10, 26, 27, 28]
};
const keys = Object.keys(obj);
const newObj = keys.reduce((acc, item, index) => {
const ids = obj[item];
ids.forEach(id => {
if (acc[id]) {
acc[id] = [...acc[id], keys[index]];
} else {
acc[id] = [keys[index]];
}
});
return acc;
}, {});
console.log(newObj);