Update custom operator example
Airblader opened this issue · comments
Ingo Bürk commented
I think the custom operator example should be rewritten to use pipeable operators instead of mutating the prototype:
const sqrt = source$ => Rx.Observable.create(observer =>
source$.subscribe(
value => {
const result = Math.sqrt(value);
if (typeof value !== 'number' || isNaN(result)) {
observer.error(`Square root of ${value} doesn't exist`);
} else {
observer.next(result);
}
},
err => observer.error(err),
() => observer.complete()
)
);
Rx.Observable
.interval(1000)
.pipe(sqrt)
Misha Moroshko commented
Sounds good!
Could you submit a PR, please?
Misha Moroshko commented
Merged #10 and deployed.