pluck
RxJS 5 pluck
HTML
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.8/dist/global/Rx.umd.js"></script>
JavaScript
const wikiSearch = (search) => fetch(`https://en.wikipedia.org/w/api.php?
action=query&format=json&list=search&utf8=1&srsearch=${search}`)
const requestQuote$ = searchTerm => {
return Rx.Observable.of(searchTerm)
.mergeMap((searchTerm) => wikiSearch(searchTerm).then(response => response.json()))
.retry(3)
.flatMap(function(res) { return res.query.search })
.map((data) => data.title)
}
requestQuote$('lol')
.subscribe((data) => console.log(data))