本文整理匯總了TypeScript中vs/base/common/objects.cloneAndChange函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript cloneAndChange函數的具體用法?TypeScript cloneAndChange怎麽用?TypeScript cloneAndChange使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了cloneAndChange函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: localizeManifest
export function localizeManifest(manifest: IExtensionManifest, translations: ITranslations): IExtensionManifest {
const patcher = (value: string) => {
if (typeof value !== 'string') {
return undefined;
}
const match = nlsRegex.exec(value);
if (!match) {
return undefined;
}
return translations[match[1]] || value;
};
return cloneAndChange(manifest, patcher);
}
示例2: function
const _uriMassage = function (part: string): string {
let data: any;
try {
data = parse(decodeURIComponent(part));
} catch (e) {
// ignore
}
if (!data) {
return part;
}
data = cloneAndChange(data, value => {
if (markdown.uris && markdown.uris[value]) {
return URI.revive(markdown.uris[value]);
} else {
return undefined;
}
});
return encodeURIComponent(JSON.stringify(data));
};
示例3: transformOutgoingExtension
function transformOutgoingExtension(extension: ILocalExtension, transformer: IURITransformer | null): ILocalExtension {
return transformer ? cloneAndChange(extension, value => value instanceof URI ? transformer.transformOutgoingURI(value) : undefined) : extension;
}