persona-community-5/.pnpm-store/v3/files/77/727516e2dc4239119f6a04dc320131732c7bee42b511d49a4fa2a6c244dca3c6faac70bc6fefb2372f020df0a90b3ff88cc1029fddb378497354a249cb10fb
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

33 lines
1.2 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyDefault = applyDefault;
const deepMerge_1 = require("./deepMerge");
/**
* Pure function - doesn't mutate either parameter!
* Uses the default options and overrides with the options provided by the user
* @param defaultOptions the defaults
* @param userOptions the user opts
* @returns the options with defaults
*/
function applyDefault(defaultOptions, userOptions) {
// clone defaults
const options = JSON.parse(JSON.stringify(defaultOptions));
if (userOptions == null) {
return options;
}
// For avoiding the type error
// `This expression is not callable. Type 'unknown' has no call signatures.ts(2349)`
options.forEach((opt, i) => {
if (userOptions[i] !== undefined) {
const userOpt = userOptions[i];
if ((0, deepMerge_1.isObjectNotArray)(userOpt) && (0, deepMerge_1.isObjectNotArray)(opt)) {
options[i] = (0, deepMerge_1.deepMerge)(opt, userOpt);
}
else {
options[i] = userOpt;
}
}
});
return options;
}
//# sourceMappingURL=applyDefault.js.map