This is an implementation of the union-find data structure in Node.js