tasks/combine_harvester.js
function toposort(dependencies) {
    var sorted=[], visited={};

    function visit(key) {
      if(!visited[key]) {
        visited[key] = true;
        if(!dependencies[key]) {
          throw new Error('A dependency is given which is not defined' + key);
        }
        dependencies[key].dependencies.forEach(visit);
        sorted.push(key);
      }
    }

    for(var key in dependencies) { visit(key); }
    return sorted;
  }
function toposort(dependencies) {
    var sorted=[], visited={};

    function visit(key) {
      if(!visited[key]) {
        visited[key] = true;
        if(!dependencies[key]) {
          throw new Error('A dependency is given which is not defined' + key);
        }
        dependencies[key].dependencies.forEach(visit);
        sorted.push(key);
      }
    }

    for(var key in dependencies) { visit(key); }
    return sorted;
  }
/*
Define a relaxed toposort which does not check for (or worry about) cyclic dependencies.