I don't have one in mind but if you need to create one you can use the mapChildren function (which is used internally) as a template :
d3.hierarchy(group, function mapChildren(d) { return Array.isArray(d) ? d[1] : null; })
Thanks! I can't see one either and I'm wondering if it's an unnecessary vulnerability. If the accessor returns an iterable it appears to crash (try d => d or d => "anything"). I can open an issue if you think it's warranted. Feel free to remove these comments 🙃
if the children accessor always returns children then you get an infinite loop, which crashes the browser as expected ;) At some point you need to stop the chain.
Here's a fun example:
d3.hierarchy("root", d => {
const n = d3.randomBinomial(30, 1 / d.length)();
if (n) return new Array(n).fill(`child of ${d}`);
})