Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
Loop back observable in RxJS?

This is a bit of a convoluted example, but I was wondering how to do the following in RxJs: After a certain part in the pipeline, feed the value back into an earlier part of the pipeline, so it will get processed again.

of(1, 2, 3, 4, 5).pipe(
  map(x => x + 1),
  map(x => x + 1),
  filter(x => x % 2),
  // refeed after the first map but before the second
)
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Here's an example of how you might use expand to do this:

function isEven(x) {
  return x % 2 == 0
}

of(1, 2, 3, 4, 5).pipe(
  map(x => x + 1),
  expand(x => of(x).pipe(
    map(x => x + 1),
    filter(isEven)
  ))
);

Here's how you might write a recursive function to do this:

function isEven(x) {
  return x % 2 == 0
}

function loopBack(x : number) {
  return of(x).pipe(
    map(x => x + 1),
    filter(isEven),
    mergeMap(loopBack),
    startWith(x)
  );
}

of(1, 2, 3, 4, 5).pipe(
  map(x => x + 1),
  mergeMap(loopBack),
);
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda