configuru
Version:
Manage the configuration of your Nodejs application with multiple environments and custom preferences, utilizing Configuru in CI and development as well!
29 lines • 967 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.maskedValues = exports.values = void 0;
var helpers_1 = require("./helpers");
var isLoadedValue = function (x) {
return Object.keys(x || {}).includes('__CONFIGURU_LEAF');
};
var mapConfig = function (fn) {
return function (val) {
if (isLoadedValue(val)) {
return mapConfig(fn)(fn(val));
}
if (Array.isArray(val)) {
return val.map(mapConfig(fn));
}
if ((0, helpers_1.isObject)(val)) {
return Object.keys(val).reduce(function (res, key) {
res[key] = mapConfig(fn)(val[key]);
return res;
}, {});
}
return val;
};
};
exports.values = mapConfig(function (x) { return x.value; });
exports.maskedValues = mapConfig(function (x) {
return x.hidden ? (0, helpers_1.anonymize)(x.rawValue) : x.value;
});
//# sourceMappingURL=polishers.js.map