or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-7/

Configuration Settings Merger

Build a utility that merges configuration settings into an existing configuration object. The utility should modify the configuration object in-place rather than creating a new copy, allowing for efficient updates to deeply nested configuration structures.

Capabilities

Merges configuration updates into existing config

  • Given a config object { server: { port: 3000 } } and an update { server: { host: 'localhost' } }, calling updateConfig(config, update) modifies the config in-place to become { server: { port: 3000, host: 'localhost' } } @test

Returns the modified config object

  • Given a config object { timeout: 1000 } and an update { retries: 3 }, calling updateConfig(config, update) returns a reference to the same config object that now contains both properties @test

Handles multiple levels of nested configuration

  • Given a config with deeply nested properties and updates at multiple levels, the function correctly merges all nested properties while maintaining the existing structure @test

Overwrites existing values with new ones

  • Given a config { database: { poolSize: 10 } } and an update { database: { poolSize: 20 } }, the original config's poolSize is updated to 20 @test

Implementation

@generates

API

/**
 * Merges configuration updates into an existing configuration object in-place.
 * The original config object is modified directly and returned.
 *
 * @param {Object} config - The configuration object to update (will be modified)
 * @param {Object} updates - The configuration updates to merge in
 * @returns {Object} The modified config object (same reference as input)
 */
function updateConfig(config, updates) {
  // Implementation here
}

module.exports = { updateConfig };

Dependencies { .dependencies }

mixin-deep { .dependency }

Provides deep object merging capabilities.

@satisfied-by