Files
pnpm/deps/graph-sequencer/README.md
阿豪 4246f41bed feat(graph-sequencer): add package @pnpm/graph-sequencer (#7168)
---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2023-10-15 22:28:05 +03:00

406 B

@pnpm/deps.graph-sequencer

Sort items in a graph using a topological sort

Install

pnpm add @pnpm/deps.graph-sequencer

Usage

  expect(graphSequencer(new Map([
    [0, [1]],
    [1, [2]],
    [2, [3]],
    [3, [0]],
  ]), [0, 1, 2, 3])).toStrictEqual(
    {
      safe: false,
      chunks: [[0, 1, 2, 3]],
      cycles: [[0, 1, 2, 3]],
    }
  )

License

MIT