in lib/h3core.js [1176:1193]
export function compactCells(h3Set) {
if (!h3Set || !h3Set.length) {
return [];
}
// Set up input set
const count = h3Set.length;
const set = C._calloc(count, SZ_H3INDEX);
storeArrayOfH3Indexes(set, h3Set);
// Allocate memory for compacted hexagons, worst-case is no compaction
const compactedSet = C._calloc(count, SZ_H3INDEX);
try {
throwIfError(H3.compactCells(set, compactedSet, count, UNUSED_UPPER_32_BITS));
return readArrayOfH3Indexes(compactedSet, count);
} finally {
C._free(set);
C._free(compactedSet);
}
}