當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript fp.flow函數代碼示例

本文整理匯總了TypeScript中lodash/fp.flow函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript flow函數的具體用法?TypeScript flow怎麽用?TypeScript flow使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了flow函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: productSelector

 (page: IRecommendationsPage): IStoreAdditionalPage => ({
     tagPrimary: {
         title: `${page.primary.tag} games`,
         description: `Due to your recent playtime in other ${page.primary.tag} games`,
         href: `https://store.steampowered.com/tag/en/${page.primary.tag}/`,
         items: page.primary.items.map(flow(
             productSelector,
             getTagItemProps,
         ))
     },
     tagSecondary: {
         title: `${page.secondary.tag} games`,
         description: `Due to your recent playtime in other ${page.secondary.tag} games`,
         href: `https://store.steampowered.com/tag/en/${page.secondary.tag}/`,
         items: page.secondary.items.map(flow(
             productSelector,
             getTagItemProps,
         ))
     },
     similar: page.similar.map(flow(
         (x: ISimilarProduct) => [
             productSelector(x.id),
             productSelector(x.similarTo)
         ],
         ([product, similarProduct]) =>
             product != null && similarProduct != null
                 ? getSimilarItemProps(product, similarProduct)
                 : false,
     )).filter((x => Boolean(x)) as isNotFalse)
 })
開發者ID:steam-react,項目名稱:steam,代碼行數:30,代碼來源:StoreAdditionalRecommendations.ts

示例2:

    (spotlightIds, normalIds, productSelector) => ({
        items: [
            ...spotlightIds
                .map(flow(productSelector, formatSpotlightItem))
                .filter(Boolean as any as isNotFalse),

            ...normalIds
                .map(flow(productSelector, formatNormalItem))
                .filter(Boolean as any as isNotFalse),
        ]
    } as IStoreSpecialOffersProps)
開發者ID:steam-react,項目名稱:steam,代碼行數:11,代碼來源:StoreSpecialOffers.ts

示例3: getSld

/**
 * Extracts second level domain from url.
 */
function getSld(url: string) {
    return flow(
        getDomain,
        split('.'),
        takeRight(2),
        join('.')
    )(url);
}
開發者ID:,項目名稱:,代碼行數:11,代碼來源:

示例4: flow

export const prepareFiles = (files: IFile[]) => {
  return flow([
    map((file: IFile) => ({
      name: file.name,
      content: file.content
    })),
    keyBy('name')
  ])(files);
};
開發者ID:Gisto,項目名稱:Gisto,代碼行數:9,代碼來源:snippets.ts

示例5: preparePiceInfo

 (featuredItems, productSelector): IStoreFeaturedProps => ({
     items: featuredItems
         .map(flow(
             productSelector,
             product => product
                 ? {
                     name: product.name,
                     href: product.detailsUrl,
                     pictures: product.pictures.slice(0, 5),
                     reason: {
                         type: 'by_tags' as 'by_tags',
                         tags: ['Action', 'FPS'],
                     },
                     priceInfo: preparePiceInfo(product.priceInfo),
                     platforms: product.platforms,
                 }
                 : false
         ))
         .filter((x => Boolean(x)) as isNotFalse)
 })
開發者ID:steam-react,項目名稱:steam,代碼行數:20,代碼來源:StoreFeatured.ts

示例6: flow

const prepareLanguages = (snippet: Partial<ISnippet>) =>
  flow([fileTypesList, uniq, compact])(snippet.files);
開發者ID:Gisto,項目名稱:Gisto,代碼行數:2,代碼來源:prepareSnippet.ts


注:本文中的lodash/fp.flow函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。