JSFiddle - React, Tailwind, and code Playground
by jrab227
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
JavaScript
let data = [
[{'foo': 1, 'bar': 2}, 0],
[{'foo': 1, 'bar': 2}, 0],
[{'foo': 1, 'bar': 2}, 0],
[{'cat': 1}, 0],
];
let d = _.chain(data)
.map(item => _.keys(item[0]).slice())
.uniqBy((arr) => _.reduce(arr, (agg, next) => agg + next, ''))
.value()
console.log(d)