The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Filtering operators: take, first, skip

Filtering operators: take, first, skip

2:51
There are more operators in the filtering category besides filter(). This lesson will teach how take(), first(), and skip() are simply operators to ignore or pass a certain amount of events from the source Observable.
Watch this lesson now
Avatar
egghead.io

There are more operators in the filtering category besides filter(). This lesson will teach how take(), first(), and skip() are simply operators to ignore or pass a certain amount of events from the source Observable.

Avatar
Andrew

foo.first() and foo.take(1), are not equivalent, at least on an edge case.

If foo is an empty observable, foo.first() throws an EmptyError, while foo.skip(1) returns an observable equivalent to Observable.empty(). The former requires that you either provide a defaultIfEmpty or a .catch.

Avatar
Andre

Correct, Andrew. Thanks for pointing it out!

In reply to Andrew
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?