refactor: monorepo+pnpm (removed husky)

This commit is contained in:
Andrew Bastin
2021-09-10 00:28:28 +05:30
parent 917550ff4d
commit b28f82a881
445 changed files with 81301 additions and 63752 deletions

View File

@@ -0,0 +1,24 @@
import { combineLatest, Observable } from "rxjs"
import { map } from "rxjs/operators"
/**
* Constructs a stream of a object from a collection of other observables
*
* @param streamObj The object containing key of observables to assemble from
*
* @returns The constructed object observable
*/
export function constructFromStreams<T>(
streamObj: { [key in keyof T]: Observable<T[key]> }
): Observable<T> {
return combineLatest(Object.values<Observable<T[keyof T]>>(streamObj)).pipe(
map((streams) => {
const keys = Object.keys(streamObj) as (keyof T)[]
return keys.reduce(
(acc, s, i) => Object.assign(acc, { [s]: streams[i] }),
{}
) as T
})
)
}