本文整理汇总了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;
}