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


TypeScript lodash.cloneDeepWith函數代碼示例

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


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

示例1: function

_.omitDeep = function(collection: Array<any>, excludeKeys: Array<string>) {
  function omitFn(value: any) {
    if (value && typeof value === 'object') {
      excludeKeys.forEach(key => {
        delete value[key];
      });
    }
  }

  return _.cloneDeepWith(collection, omitFn);
};
開發者ID:agneta,項目名稱:platform,代碼行數:11,代碼來源:start.ts

示例2: write

  write (eligibility: Eligibility, req: express.Request, res: express.Response): void {
    const excludeDisplayValue = (value: any): any | undefined => {
      const property = 'displayValue'

      if (value && typeof value === 'object' && Object.getOwnPropertyDescriptor(value, property)) {
        return _.omit(value, property)
      }
      return undefined
    }
    res.cookie(cookieName, _.cloneDeepWith(eligibility, excludeDisplayValue), { httpOnly: true, secure: true, maxAge: cookieTimeToLiveInMinutes })
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:11,代碼來源:store.ts

示例3:

  public $onInit(): void {
    const copy = cloneDeepWith<IPipeline>(this.pipeline, (value: any) => {
      if (value && value.$$hashKey) {
        delete value.$$hashKey;
      }
      return undefined; // required for clone operation and typescript happiness
    });
    this.removeImmutableFields(copy);

    this.isStrategy = this.pipeline.strategy || false;
    this.command = {
      pipelineJSON: this.jsonUtilityService.makeSortedStringFromObject(copy),
      locked: copy.locked
    };
  }
開發者ID:brujoand,項目名稱:deck,代碼行數:15,代碼來源:editPipelineJsonModal.controller.ts

示例4: patchNLS

export function patchNLS(manifest: Manifest, translations: ITranslations): Manifest {
	return cloneDeepWith(manifest, patcher(translations)) as Manifest;
}
開發者ID:rlugojr,項目名稱:vscode-vsce,代碼行數:3,代碼來源:nls.ts


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