本文整理匯總了TypeScript中rxjs/operators.map函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript map函數的具體用法?TypeScript map怎麽用?TypeScript map使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了map函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
const computed = origin.filterx(number$ => number$.pipe(map(n => n % 2 === 0)));
示例2: createLabel
createLabel(label: LabelModel, url: string): Observable<LabelModel> {
return this.http.post<{data: LabelModel}>(url, {data: label})
.pipe(map(r => r.data));
}
示例3: addOrUpdate
public addOrUpdate(faq: Faq): Observable<Faq> {
let contentItem: ContentItem = faq.ToContentItem();
return this.contentItemService.addOrUpdate(contentItem).pipe(
map(contentItem => new Faq(contentItem)),
catchError(this.handleError));
}
示例4: discover
discover(query: string) : Observable<Feed[]> {
return this.api.get<FeedsResponse>(`feed/discover?query=${query}`).pipe(
map(response => response.feeds)
);
}
示例5: deleteFeed
deleteFeed(id: number) : Observable<boolean> {
return this.api.delete<Status>(`feed/${id}`).pipe(
map(response => response.success)
);
}
示例6: concatMap
concatMap(tree => this._engine.transformOptions(this, options).pipe(
map(o => [tree, o]),
)),
示例7: switchMap
switchMap(run => run.output.pipe(map(output => ({ run, output })))),
示例8: getStorage
getStorage(storageId: string): Observable<StorageEntity> {
return this.http
.get(`/api/configuration/strongbox/storages/${storageId}`)
.pipe(map((r: any) => plainToClass(StorageEntity, r) as any));
}
示例9: getRepository
getRepository(storageId: string, repositoryId: string): Observable<Repository> {
return this.http
.get(`/api/configuration/strongbox/storages/${storageId}/${repositoryId}`)
.pipe(map((r: any) => plainToClass(Repository, r) as any));
}
示例10: map
({ project, repoName, prID }) =>
get<PRResponse>(buildURL(project, repoName, `/pull-requests/${prID}`)).pipe(
map(({ fromRef, toRef }) => ({ baseCommitID: toRef.latestCommit, headCommitID: fromRef.latestCommit }))
),