code: function orderByDependencies(packages) {
    const packageDependencyGraph = pkg =>
      R.pipe(
        allDeps,
        R.map(dependencyName => [dependencyName, pkg.name]),
      )(pkg)
  
    // :: Array<Package> -> Array<Array<string, string>>
    const dependencyGraph = R.chain(packageDependencyGraph)
  
    // :: Package -> bool
    const hasNoDependencies = ({ dependencies }) => dependencies.length === 0
  
    // :: Array<Package>
    const packagesWithNoDependencies = R.pipe(
      R.filter(hasNoDependencies),
      R.map(R.prop('name')),
    )(packages)
  
    // :: string -> Package
    const findPackageByName = R.map(name =>
      R.find(R.propEq('name', name), packages),
    )
  
    return R.pipe(
      dependencyGraph,
      toposort,
      R.without(packagesWithNoDependencies),
      R.concat(packagesWithNoDependencies),
      findPackageByName,
    )(packages)
  }
docs: :: Array<Package> -> Array<Package>