Skip to content

Instantly share code, notes, and snippets.

View RubyTuesdayDONO's full-sized avatar
🏳️‍🌈
you are worthy. you are loved. you belong.

Reuben Garrett RubyTuesdayDONO

🏳️‍🌈
you are worthy. you are loved. you belong.
View GitHub Profile

Keybase proof

I hereby claim:

  • I am rubytuesdaydono on github.
  • I am rubytuesdaydono (https://keybase.io/rubytuesdaydono) on keybase.
  • I have a public key ASDxNJB0YFG-7jwYPUaZJHI70v0KS6KdlOB24svt0eWFfAo

To claim this, I am signing this object:

@RubyTuesdayDONO
RubyTuesdayDONO / gist:5006455
Last active March 11, 2022 18:11 — forked from six8/gist:1732686
logic revisions to pass test case
// Dependency resolution, adapted from https://gist.github.com/1232505/f16308bc14966c8d003c2686b1c258ec41303c1f
function resolve(graph) {
var sorted = [], // sorted list of IDs ( returned value )
visited = {}; // hash: id of already visited node => true
// 2. topological sort
Object.keys(graph).forEach(function visit(name, ancestors) {
if (!Array.isArray(ancestors)) ancestors = [];
ancestors.push(name);
visited[name] = true;