JSFiddle - React, Tailwind, and code Playground

by Dmitri Ganenco

HTML

<pre id='pre'></pre>

JavaScript

const data = {1: {
	name: "a",
	type: "aa"
},
2:{
	name: "b",
	type: "a"
}};

const res = Object.values(data).filter(i => i.type === 'self')[0];

$('#pre').text(JSON.stringify(res));