(args)
| 76 | cnt-- |
| 77 | } |
| 78 | function ensureIndexWithinBounds(args) { |
| 79 | for (let i = arguments.length - 1; i >= 0; i--) { |
| 80 | const p = arguments[i] |
| 81 | if (p >= length) |
| 82 | throw new Error( |
| 83 | 'Index out of bounds. The maximum index can be length-1' |
| 84 | ) |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | export { UnionFind } |