in lib/h3core.js [832:847]
export function cellToChildren(h3Index, res) {
// Bad input in this case can potentially result in high computation volume
// using the current C algorithm. Validate and return an empty array on failure.
if (!isValidCell(h3Index)) {
return [];
}
const [lower, upper] = h3IndexToSplitLong(h3Index);
const count = validateArrayLength(cellToChildrenSize(h3Index, res));
const hexagons = C._calloc(count, SZ_H3INDEX);
try {
throwIfError(H3.cellToChildren(lower, upper, res, hexagons));
return readArrayOfH3Indexes(hexagons, count);
} finally {
C._free(hexagons);
}
}