function blockIsType(block, typeId) {
    return block && block.permutation.matches(typeId);
}
// eslint-disable-next-line import/prefer-default-export
export function* findNeighboringBlocks(block, neighbourId) {
    let neighbor;
    neighbor = block.above();
    if (blockIsType(neighbor, neighbourId))
        yield neighbor;
    neighbor = block.north();
    if (blockIsType(neighbor, neighbourId))
        yield neighbor;
    neighbor = block.east();
    if (blockIsType(neighbor, neighbourId))
        yield neighbor;
    neighbor = block.south();
    if (blockIsType(neighbor, neighbourId))
        yield neighbor;
    neighbor = block.west();
    if (blockIsType(neighbor, neighbourId))
        yield neighbor;
    neighbor = block.below();
    if (blockIsType(neighbor, neighbourId))
        yield neighbor;
}
