本文整理匯總了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);
};
示例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 })
}
示例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
};
}
示例4: patchNLS
export function patchNLS(manifest: Manifest, translations: ITranslations): Manifest {
return cloneDeepWith(manifest, patcher(translations)) as Manifest;
}