Skip to content

Instantly share code, notes, and snippets.

@xantiagoma
Created October 23, 2018 00:14
Show Gist options
  • Save xantiagoma/a1a3e90db1f87d349d3470ca754aa1e2 to your computer and use it in GitHub Desktop.
Save xantiagoma/a1a3e90db1f87d349d3470ca754aa1e2 to your computer and use it in GitHub Desktop.
(async () => {
const { ajax: ajaxp, operators, from } = rxjs;
const { ajax } = ajaxp;
const { getJSON } = ajax;
const { map, flatMap, toArray } = operators;
const promise =
getJSON(
"https://pokeapi.co/api/v2/pokemon/"
)
.pipe(
map(d => d.results),
flatMap(d => d),
map(d => d.url),
flatMap(d => getJSON(d)),
toArray()
).toPromise();
console.log(await promise);
}) ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment