or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-2/

Configuration Merger

A utility for merging configuration objects from multiple sources while preserving special object types like custom class instances.

Capabilities

Merge Plain Objects

  • Given objects { database: { host: 'localhost' } } and { database: { port: 5432 } }, merging them produces { database: { host: 'localhost', port: 5432 } } @test

Preserve Custom Class Instances

  • Given an object containing a custom class instance (e.g., a DatabaseConnection instance), merging should preserve the instance without attempting to merge its properties @test

Handle Mixed Objects

  • Given an object with both plain objects and custom class instances (e.g., { config: { timeout: 30 }, connection: new DatabaseConnection() }), merging with another object should deeply merge plain objects while preserving custom instances @test

Implementation

@generates

API

/**
 * Merges multiple configuration objects deeply.
 * Plain objects are merged recursively.
 * Custom class instances are preserved as-is.
 *
 * @param {...Object} sources - Configuration objects to merge
 * @returns {Object} Merged configuration object
 */
function mergeConfig(...sources) {
  // IMPLEMENTATION HERE
}

module.exports = { mergeConfig };

Dependencies { .dependencies }

mixin-deep { .dependency }

Provides deep object merging capabilities with support for custom object handling.

@satisfied-by