or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-4/

Configuration Manager

A utility that manages application configuration by merging multiple configuration sources with nested settings.

Capabilities

Configuration Merging

  • Given base config { db: { host: 'localhost', port: 3306 }, server: { port: 8080 } } and env config { db: { host: 'prod-db' } }, the merged result is { db: { host: 'prod-db', port: 3306 }, server: { port: 8080 } } @test
  • Given three configs: base { db: { host: 'localhost', port: 3306, timeout: 5000 } }, env { db: { host: 'prod-db', pool: 10 } }, and user { db: { timeout: 10000 } }, the result is { db: { host: 'prod-db', port: 3306, timeout: 10000, pool: 10 } } @test
  • Merging deeply nested configs with base { api: { endpoints: { users: '/api/users', posts: '/api/posts' }, retry: { attempts: 3 } } } and override { api: { endpoints: { comments: '/api/comments' }, retry: { delay: 1000 } } } produces { api: { endpoints: { users: '/api/users', posts: '/api/posts', comments: '/api/comments' }, retry: { attempts: 3, delay: 1000 } } } @test

Implementation

@generates

API

/**
 * Merges multiple configuration objects deeply, with later configs taking precedence.
 *
 * @param {Object} baseConfig - The base configuration with default values
 * @param {Object} envConfig - Environment-specific configuration
 * @param {Object} userConfig - User-provided overrides
 * @returns {Object} The merged configuration object
 */
function mergeConfigs(baseConfig, envConfig, userConfig) {
  // IMPLEMENTATION HERE
}

module.exports = { mergeConfigs };

Dependencies { .dependencies }

mixin-deep { .dependency }

Provides deep object merging capabilities.

@satisfied-by