Getting Started
Writing content
API Documentation
Customization
Recipes
API References Develop
@ng-doc/builder / Function

mergeFactory

Generic types:TCacheData A T M

This function merges multiple observables and applies a project function when all observables are done. It returns an Observable that emits either the value of type A[number] or a BuilderState.

Presentation

function mergeFactory(
  tag: string,
  sources: [...ObservableInputTuple<A>],
  project: (...args_0: BuilderStateTuple<A>) => Promise<T>,
  cacheStrategy: CacheStrategy<TCacheData, T>,
  mapper: (source: [...BuilderStateTuple<A>][number]) => M,
): Observable<BuilderState<T | M>>;

Returns

Observable<BuilderState<T | M>> -

An Observable that emits either the value of type A[number] or a BuilderState.

Parameters

NameTypeDescription
tag
string

A string representing the tag.

sources
[...ObservableInputTuple<A>]

An array of Observables.

project
(...args_0: BuilderStateTuple<A>) => Promise<T>

A function that takes an array of BuilderState and returns a Promise.

cacheStrategy
CacheStrategy<TCacheData, T>

An optional parameter that defines the cache strategy.

mapper
(source: [...BuilderStateTuple<A>][number]) => M

Overloads

Overload #1

This function merges multiple observables and applies a project function when all observables are done. It returns an Observable that emits either the value of type A[number] or a BuilderState.

Presentation
mergeFactory(tag: string, sources: [...ObservableInputTuple<A>], project: (...args_0: BuilderStateTuple<A>) => Promise<T>, cacheStrategy: CacheStrategy<TCacheData, T>, mapper: (source: [...BuilderStateTuple<A>][number]) => M): Observable<BuilderState<T | M>>;
Parameters
NameTypeDescription
tag
string

A string representing the tag.

sources
[...ObservableInputTuple<A>]

An array of Observables.

project
(...args_0: BuilderStateTuple<A>) => Promise<T>

A function that takes an array of BuilderState and returns a Promise.

cacheStrategy
CacheStrategy<TCacheData, T>

An optional parameter that defines the cache strategy.

mapper
(source: [...BuilderStateTuple<A>][number]) => M
Returns
Observable<BuilderState<T | M>> -

An Observable that emits either the value of type A[number] or a BuilderState.

Overload #2

No documentation has been provided.

Presentation
mergeFactory(tag: string, sources: [...ObservableInputTuple<A>], project: (...args_0: BuilderStateTuple<A>) => Promise<T>, cacheStrategy?: CacheStrategy<TCacheData, T> | undefined): Observable<A[number] | BuilderState<T>>;
Parameters
NameTypeDescription
tag
string
sources
[...ObservableInputTuple<A>]
project
(...args_0: BuilderStateTuple<A>) => Promise<T>
cacheStrategy
CacheStrategy<TCacheData, T> | undefined
Returns
Observable<A[number] | BuilderState<T>>