"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getChildBy = getChildBy;
exports.getChildByNode = getChildByNode;
exports.getChildByIndex = getChildByIndex;
function getChildBy(parent, f) {
    let result = null;
    parent.forEach((node, offset, index) => {
        const child = { node, offset, index };
        if (f(child)) {
            result = child;
        }
    });
    return result;
}
function getChildByNode(parent, child) {
    return getChildBy(parent, ({ node }) => node === child);
}
function getChildByIndex(parent, childIndex) {
    return getChildBy(parent, ({ index }) => index === childIndex);
}
//# sourceMappingURL=node-children.js.map
