Skip to content

Instantly share code, notes, and snippets.

@shangyilim
Last active January 15, 2019 13:18
Show Gist options
  • Save shangyilim/cb60daa0b22287229d6e0468ab1a288f to your computer and use it in GitHub Desktop.
Save shangyilim/cb60daa0b22287229d6e0468ab1a288f to your computer and use it in GitHub Desktop.
import { combineLatest } from 'rxjs';
var californiaOrColorado$ = combineLatest(california$, colorado$)
.pipe(
map((cities) => {
// Destructure the values to combine a single array.
var [californiaCities, coloradoCities] = cities;
return [
//spread the arrays out to combine as one array
...californiaCities,
...coloradoCities
];
}));
californiaOrColorado$.subscribe(cities => console.log(cities));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment