Skip to content

Instantly share code, notes, and snippets.

@slavafomin
Created June 23, 2023 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slavafomin/81518735540563413b50763cfbf7ef39 to your computer and use it in GitHub Desktop.
Save slavafomin/81518735540563413b50763cfbf7ef39 to your computer and use it in GitHub Desktop.
const isValid$ = (
merge(
value$.pipe(
distinctUntilChanged(),
map(() => undefined),
),
value$.pipe(
debounceTime(500),
withLatestFrom(isComplete$),
filter(([_, isComplete]) => isComplete),
switchMap(([value]) => (
validateValue(value).pipe(
takeUntil(value$),
)
)),
),
);
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment