function gridDiskDistances(h3Index, ringSize) {
    const [lower, upper] = h3IndexToSplitLong(h3Index);
    const countPtr = C._malloc(SZ_INT64);
    try {
        throwIfError(H3.maxGridDiskSize(ringSize, countPtr));
        const count = validateArrayLength(readInt64AsDoubleFromPointer(countPtr));
        const kRings = C._calloc(count, SZ_H3INDEX);
        const distances = C._calloc(count, SZ_INT);
        try {
            throwIfError(H3.gridDiskDistances(lower, upper, ringSize, kRings, distances));
            /**
             * An array of empty arrays to hold the output
             * @type {string[][]}
             * @private
             */
            const out = [];
            for (let i = 0; i < ringSize + 1; i++) {
                out.push([]);
            }
            // Read the array of hexagons, putting them into the appropriate rings
            for (let i = 0; i < count; i++) {
                const cell = readH3IndexFromPointer(kRings, i);
                const index = C.getValue(distances + SZ_INT * i, 'i32');
                // eslint-disable-next-line max-depth
                if (cell !== null) {
                    out[index].push(cell);
                }
            }
            return out;
        } finally {
            C._free(kRings);
            C._free(distances);
        }
    } finally {
        C._free(countPtr);
    }
}
Get all hexagons in a k-ring around a given center, in an array of arrays
ordered by distance from the origin. The order of the hexagons within each ring is undefined.
@static
@param  {H3IndexInput} h3Index  H3 index of center hexagon
@param  {number} ringSize  Radius of k-ring
@return {H3Index[][]}      Array of arrays with H3 indexes for all hexagons each ring
@throws {H3Error}          If input is invalid or output is too large for JS