Skip to content

Instantly share code, notes, and snippets.

View Flyrell's full-sized avatar
🧠
Busy brain...

Dawid Zbiński Flyrell

🧠
Busy brain...
View GitHub Profile
@Flyrell
Flyrell / ifCondition.ts
Last active November 29, 2019 18:35
RxJS: Simple If condition for Observables in TypeScript
// Simple if condition that stops Observable from continuing passed condition function returns false.
// There's also an option to run else callback if needed.
/*
* USAGE
*
* of(events).pipe(
* ifCondition(event => event.name.endsWith('anything'), () => console.log('Not the anything event'))
* )
*/