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


TypeScript ramda.uniq函數代碼示例

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


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

示例1: deps

 function deps(file: string, exists: string[]): string[] {
     let _deps = requires(fs.readFileSync(file, "utf-8"))
                 .map(dep => path.resolve(path.dirname(file), `${dep}.js`))
                 .filter(fs.existsSync)
                 .filter(dep => exists.indexOf(dep) == -1);
     return _.uniq(_deps.concat(_.flatten(_deps.map(d => deps(d, exists.concat(_deps))))));
 }
開發者ID:leon740727,項目名稱:wcp,代碼行數:7,代碼來源:type-js.ts

示例2: subscribe

 /**
  * Subscribes to some paths in state. Allows the user to track a subset of
  * data within the state that will be sent to them every time it changes.
  *
  * @param command The command received from the reactotron app.
  */
 function subscribe(command: any) {
   const trackedNode = trackedNodes[command.mstNodeName || "default"]
   const paths: string[] = (command && command.payload && command.payload.paths) || []
   if (trackedNode && trackedNode.node && paths) {
     subscriptions = uniq(flatten(paths))
     const state = getSnapshot(trackedNode.node)
     sendSubscriptions(state)
   }
 }
開發者ID:nick121212,項目名稱:reactotron,代碼行數:15,代碼來源:reactotron-mst.ts

示例3: deepMerge

function deepMerge(v1, v2) {
  if (Array.isArray(v1) && Array.isArray(v2)) {
    return R.uniq(R.concat(v1, v2));
  }
  else if (typeof v1 === 'object' && typeof v2 === 'object') {
    return R.mergeWith(deepMerge, v1, v2);
  }
  else {
    return v2;
  }
}
開發者ID:repositive,項目名稱:hapi-path-generator,代碼行數:11,代碼來源:index.ts

示例4:

const getVocabularyRecursive = (node: AbstractNode): string[] => {
  if (node instanceof Leaf) {
    return node.getNewVocabulary();
  }
  const internalNode = node as InternalNode;

  return R.uniq([
    ...internalNode.getNewVocabulary(),
    ...R.flatten<string>(
      R.map(getVocabularyRecursive, internalNode.getChildren())
    )
  ]);
};
開發者ID:serlo-org,項目名稱:serlo-abc,代碼行數:13,代碼來源:check-assets.ts

示例5:

			.map(res => R.uniq(res))
開發者ID:simbiosis-group,項目名稱:ion2-claim,代碼行數:1,代碼來源:receipt-form.ts

示例6: generateOrBranch

function generateOrBranch(modules: PrereqTree[]) {
  const children = R.uniq(modules);
  return { or: children };
}
開發者ID:nusmodifications,項目名稱:nusmods,代碼行數:4,代碼來源:parseString.ts


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