Skip to content

Instantly share code, notes, and snippets.

@cartant
Last active May 12, 2018 01:53
Show Gist options
  • Select an option

  • Save cartant/91168fbf66df923f4788995e626f18dc to your computer and use it in GitHub Desktop.

Select an option

Save cartant/91168fbf66df923f4788995e626f18dc to your computer and use it in GitHub Desktop.
import { pipe } from "rxjs";
import { ajax } from "rxjs/ajax"
import { concatMap, filter, ignoreElements } from "rxjs/operators";
/* ... */
collection.traverse(pipe(
filter(shouldPut),
concatMap(doc => ajax.put(
`${uri}/docs/${doc.id}`,
doc.toJSON(),
{ "Content-Type": "application/json" }
)),
ignoreElements()
)).subscribe({
complete: () => console.log("Finished.")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment