class Observable {
...
filter(predicate: (value) => boolean) {
return new Observable(observer => {
return this.subscribe({
next(value) {
if (predicate(value)) {
observer.next(value);
}
},
...
});
});
}
}