Во-первых, подразумевается видимо массиво объектов? Потому что в объекте всегда должен быть ключ, которого у вас нет.
const myObj = [
{object_id: 2, category_id: 2},
{object_id: 3, category_id: 2},
{object_id: 4, category_id: 1},
{object_id: 4, category_id: 2},
{object_id: 5, category_id: 1},
{object_id: 5, category_id: 2},
{object_id: 12, category_id: 1},
{object_id: 11, category_id: 1},
{object_id: 13, category_id: 1},
{object_id: 10, category_id: 1},
{object_id: 7, category_id: 3},
{object_id: 6, category_id: 3},
{object_id: 8, category_id: 3},
];
Вообще решение может выглядеть так:
const myArr = [
{object_id: 2, category_id: 2},
{object_id: 3, category_id: 2},
{object_id: 4, category_id: 1},
{object_id: 4, category_id: 2},
{object_id: 5, category_id: 1},
{object_id: 5, category_id: 2},
{object_id: 12, category_id: 1},
{object_id: 11, category_id: 1},
{object_id: 13, category_id: 1},
{object_id: 10, category_id: 1},
{object_id: 7, category_id: 3},
{object_id: 6, category_id: 3},
{object_id: 8, category_id: 3},
];
var filtered = {};
function getObj (arr, cat_id) {
filtered[cat_id + ''] = [];
arr.forEach((item, i) => {
item['category_id'] == cat_id ? filtered[cat_id + ''].push(item['object_id']) : '';
})
}
getObj(myArr, 1);
console.log(filtered); // 1: [4,5,12,11,13,10]