export function gridPathCells()

in lib/h3core.js [1438:1455]


export function gridPathCells(origin, destination) {
    const [oLower, oUpper] = h3IndexToSplitLong(origin);
    const [dLower, dUpper] = h3IndexToSplitLong(destination);
    const countPtr = C._malloc(SZ_INT64);
    try {
        throwIfError(H3.gridPathCellsSize(oLower, oUpper, dLower, dUpper, countPtr));
        const count = validateArrayLength(readInt64AsDoubleFromPointer(countPtr));
        const hexagons = C._calloc(count, SZ_H3INDEX);
        try {
            H3.gridPathCells(oLower, oUpper, dLower, dUpper, hexagons);
            return readArrayOfH3Indexes(hexagons, count);
        } finally {
            C._free(hexagons);
        }
    } finally {
        C._free(countPtr);
    }
}