Skip to content

Latest commit

 

History

History
14 lines (12 loc) · 309 Bytes

filterFirst.md

File metadata and controls

14 lines (12 loc) · 309 Bytes

The filterFirst Operator

filterFirst(n) ignores/filters the first n emissions from the source stream.

function filterFirst<T>(n: number = 1): MonoTypeOperatorFunction<T>{
  return s => defer(() => {
    let count = 0;
    return s.pipe(
      filter(_ => n <= count++)
    )
  });
}