Like RxJS forkJoin operator, but deep traversal of the source.
npm i --save fork-join-deep
1. Support primitive values. (codesandbox)
forkJoin({
a: 0,
}).subscribe((result) => {
console.log(result);
// ↓↓↓ output ↓↓↓
// Error: You provided '0' where a stream was expected.
// You can provide an Observable, Promise, Array, or Iterable.
});
forkJoinDeep({
a: 0,
}).subscribe((result) => {
console.log(result);
// ↓↓↓ output ↓↓↓
// {a: 0}
});
2. Support nested objects. (codesandbox)
forkJoin({
a: {
a1: of(0),
},
}).subscribe((result) => {
console.log(result);
// ↓↓↓ output ↓↓↓
// Error: You provided '0' where a stream was expected.
// You can provide an Observable, Promise, Array, or Iterable.
});
forkJoinDeep({
a: {
a1: of(0),
},
}).subscribe((result) => {
console.log(result);
// ↓↓↓ output ↓↓↓
// {a: a1: {0}}
});
3. Support Higher-order Observables. (codesandbox)
forkJoin({
a: of(of(0)),
}).subscribe((result) => {
console.log(result);
// ↓↓↓ output ↓↓↓
// {a: Observable}
});
forkJoinDeep({
a: of(of(0)),
}).subscribe((result) => {
console.log(result);
// ↓↓↓ output ↓↓↓
// {a: 0}
});
MIT