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


TypeScript fp.map函數代碼示例

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


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

示例1: flow

 (snippets) => flow([
     map('files'),
     flattenDeep,
     groupBy('language'),
     map((language: string[]) => ({
       language: get('language', head(language)),
       size: size(language)
     })),
     sortBy('size'),
     reverse
   ])(snippets)
開發者ID:Gisto,項目名稱:Gisto,代碼行數:11,代碼來源:snippets.ts

示例2: buildReport

function buildReport (errors) {
  const errorLines = _.compose(_.map(buildLine), _.get('details'))(errors)
  return {
    desc: `檢查 Taro 配置 (${PROJECT_CONF_PATH})`,
    lines: errorLines
  }
}
開發者ID:YangShaoQun,項目名稱:taro,代碼行數:7,代碼來源:configValidator.ts

示例3: pkgsNotInstalled

function pkgsNotInstalled (pkgs) {
  const uninstalledPkgs = _.filter(isPkgNotInstalled, pkgs)
  const lines = _.map(pkg => Object({
    desc: `使用到的依賴 ${pkg.moduleName} 還沒有安裝`,
    valid: false
  }), uninstalledPkgs)
  return lines
}
開發者ID:YangShaoQun,項目名稱:taro,代碼行數:8,代碼來源:packageValidator.ts

示例4: taroCliVersionNotMatch

function taroCliVersionNotMatch (pkgs) {
  const pkgsNotMatch = _.filter(pkg => isPkgInstalled(pkg) && isCliVersionNotMatch(pkg), pkgs)
  const lines = _.map(pkg => Object({
    desc: `${pkg.moduleName} (${pkg.installed}) 與當前使用的 @tarojs/cli (${pkgVersion}) 版本不一致, 請更新為統一的版本`,
    valid: false
  }), pkgsNotMatch)
  return lines
}
開發者ID:YangShaoQun,項目名稱:taro,代碼行數:8,代碼來源:packageValidator.ts

示例5: pipe

const getDllReferencePlugins = ({ dllEntry, outputRoot, dllDirectory }) => {
  return pipe(
    toPairs,
    map(([key]) => {
      return [`dll${key}`, getDllReferencePlugin(outputRoot, dllDirectory, key)]
    }),
    fromPairs
  )(dllEntry)
}
開發者ID:topud,項目名稱:taro,代碼行數:9,代碼來源:chain.ts

示例6: map

const prepareFiles = (snippet: Partial<ISnippet>) => {
  return map(
    (file: IFile) => ({
      ...file,
      collapsed: false,
      viewed: toUnixTimeStamp(new Date().getTime()),
      language: getFileLanguage(file)
    }),
    snippet.files
  );
};
開發者ID:Gisto,項目名稱:Gisto,代碼行數:11,代碼來源:prepareSnippet.ts

示例7: loadGraphs

 async loadGraphs() {
   return this.serverClient
     .query({
       query: gql`
         {
           __schema {
             queryType {
               fields {
                 name
               }
             }
           }
         }
       `,
     })
     .then(fp.get('data.__schema.queryType.fields'))
     .then(fp.map(fp.get('name')));
 }
開發者ID:danielwii,項目名稱:asuna-admin,代碼行數:18,代碼來源:graphql.ts

示例8: map

                const groupedEntitiesFinal = groupedEntities.map(function(
                  groupedEntity
                ) {
                  if (isPvjsonEdge(groupedEntity)) {
                    groupedEntity.points = map(function(point) {
                      point.x -= x;
                      point.y -= y;
                      return point;
                    }, groupedEntity.points);
                  } else if (isPvjsonSingleFreeNode(groupedEntity)) {
                    groupedEntity.height;
                    groupedEntity.x -= x;
                    groupedEntity.y -= y;
                  } else {
                    return hl.fromError(
                      new Error(
                        `
			Encountered unexpected entity
			${JSON.stringify(groupedEntity, null, "  ")}
			in Group
			${JSON.stringify(pvjsonGroup, null, "  ")}
			`
                      )
                    );
                  }
                  // NOTE: this is needed for GPML2013a, because GPML2013a uses both
                  // GroupId/GroupRef and GraphId/GraphRef. GPML2017 uses a single
                  // identifier per entity. That identifier can be referenced by
                  // GroupRef and/or GraphRef. Pvjson follows GPML2017 in this, so
                  // we convert from GPML2013a format:
                  //   GroupRef="GROUP_ID_VALUE"
                  // to pvjson format:
                  //   {isPartOf: "GRAPH_ID_VALUE"}
                  groupedEntity.isPartOf = id;
                  return omit(["groupRef"], groupedEntity);
                });
開發者ID:wikipathways,項目名稱:gpml2pvjson-js,代碼行數:36,代碼來源:toPvjson.ts


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