Topological sort (Kahn's algorithm) in 25 lines

This is a fairly concise ES6 implementation of Kahn's algorithm for topological sorting. It's commonly used for scheduling tasks — e.g. loading a sequence of interdependent JavaScript modules. I wrote it to be as functional as possible with some cost in terms of performance (unnecessary iteration).