Red black trees in JS