Skip to content

Rxjs documentation for 'find' operator is wrong #319

Description

@cmaart

The documentation at http://reactivex.io/documentation/operators/first.html is slightly wrong for the find operator, in rxjs at least. Documentation says that find emits undefined when no element matches. This is not correct, actually it just completes the observable.
The sample given:

var array = [1,2,3,4];

var source = Rx.Observable.fromArray(array)
    .find(function (x, i, obs) {
        return x === 5;
    });

var subscription = source.subscribe(
    function (x) { console.log('Next: ' + x); },
    function (err) { console.log('Error: ' + err); },
    function () { console.log('Completed'); });

outputs accordin to the documentation:

Next: undefined
Completed

but actually outputs:
Completed

Also see rxjs documentation for find: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/find.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions