docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
A utility that intelligently merges configuration objects with support for various data types.
Build a configuration merger that combines multiple configuration sources into a single configuration object. The merger should handle different data types appropriately, preserving arrays, merging nested objects, and properly handling edge cases like null values and functions.
{ server: { port: 8080 } } and { server: { host: 'localhost' } } produces { server: { port: 8080, host: 'localhost' } } @test{ items: [1, 2] } with { items: [3, 4] } produces { items: [3, 4] } @test{ config: { timeout: 5000 } } merged with { config: null } produces { config: null } @test{ value: { nested: true } } with { value: 'string' } produces { value: 'string' } @test/**
* Merges multiple configuration objects into a single object.
* The first object is modified in-place and returned.
*
* @param {Object} target - The target object that will receive merged properties
* @param {...Object} sources - One or more source objects to merge
* @returns {Object} The merged target object
*/
function mergeConfig(target, ...sources) {
// IMPLEMENTATION HERE
}
module.exports = { mergeConfig };Provides deep object merging capabilities.