I need to order an array of objects, composed by a name and a dependencies list (made out of names).

An example of this array could be:

```
[
  { name: 'a', requires: ['b', 'c'] },
  { name: 'b', requires: ['c'] },
  { name: 'c', requires: [] },
]

```

I'd like this array to be sorted so that the items which require a specific set of dependencies will be positioned after its required dependencies.  

The array could actually contain more items, I'm okay if the sorting function throws an error in case of circular dependencies.

Example output:

```
[
  { name: 'c', requires: [] }, // first, no dependencies, and required by both the others
  { name: 'b', requires: ['c'] }, // second, because it needs `c` first
  { name: 'a', requires: ['b', 'c'] }, // last, because requires both the others
]

```

What's the most concise way to do it?