map(array => array.map(...)) is an extremely common pattern in RxJS, this operator abtracts that away, letting the user directly map the values in emitted arrays. This operator will function as a simple map for emitted values that arn't arrays.
function arrayMap<T, R>(fn: (val: T) => R): OperatorFunction<T|T[], R|R[]> {
return pipe(
map(x => Array.isArray(x)? x.map(fn) : fn(x))
);
}
This is the same as above, only it will only accept arrays as emitted values
function mapArrayMap<T, R>(fn: (val: T) => R): OperatorFunction<T[], R[]> {
return pipe(
map(x => x.map(fn))
);
}