@rushstack/heft-config-file
Version:
Configuration file loader for @rushstack/heft
33 lines • 1.14 kB
JavaScript
;
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.stripAnnotations = void 0;
const ConfigurationFileBase_1 = require("./ConfigurationFileBase");
/**
* Returns an object with investigative annotations stripped, useful for snapshot testing.
*
* @beta
*/
function stripAnnotations(obj) {
if (typeof obj !== 'object' || obj === null) {
return obj;
}
else if (Array.isArray(obj)) {
const result = [];
for (const value of obj) {
result.push(stripAnnotations(value));
}
return result;
}
else {
const clonedObj = Object.assign({}, obj);
delete clonedObj[ConfigurationFileBase_1.CONFIGURATION_FILE_FIELD_ANNOTATION];
for (const [name, value] of Object.entries(clonedObj)) {
clonedObj[name] = stripAnnotations(value);
}
return clonedObj;
}
}
exports.stripAnnotations = stripAnnotations;
//# sourceMappingURL=TestUtilities.js.map