export function getChildBy(parent, f) {
    let result = null;
    parent.forEach((node, offset, index) => {
        const child = { node, offset, index };
        if (f(child)) {
            result = child;
        }
    });
    return result;
}
export function getChildByNode(parent, child) {
    return getChildBy(parent, ({ node }) => node === child);
}
export function getChildByIndex(parent, childIndex) {
    return getChildBy(parent, ({ index }) => index === childIndex);
}
//# sourceMappingURL=node-children.js.map
