tessl install tessl/npm-lodash-unescape@4.0.0Converts HTML entities to their corresponding characters in a string
Agent Success
Agent success rate when using this tile
85%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.39x
Baseline
Agent success rate without this tile
61%
Build a configuration management system that safely handles deeply nested configuration objects with default values and validation.
Implement a configuration manager that:
The system should handle cases where intermediate paths don't exist and provide graceful fallbacks.
/**
* Gets a configuration value at the specified path.
* Returns the default value if the path doesn't exist.
*
* @param {Object} config - The configuration object
* @param {string} path - The path to the value (e.g., "database.host")
* @param {*} defaultValue - Value to return if path doesn't exist
* @returns {*} The value at the path or the default value
*/
function getConfig(config, path, defaultValue) {}
/**
* Sets a configuration value at the specified path.
* Creates intermediate objects as needed.
* Returns the modified configuration object.
*
* @param {Object} config - The configuration object
* @param {string} path - The path where to set the value
* @param {*} value - The value to set
* @returns {Object} The modified configuration object
*/
function setConfig(config, path, value) {}
/**
* Checks if a configuration value exists at the specified path.
*
* @param {Object} config - The configuration object
* @param {string} path - The path to check
* @returns {boolean} True if the path exists, false otherwise
*/
function hasConfig(config, path) {}
module.exports = { getConfig, setConfig, hasConfig };{database: {host: "localhost"}}, getConfig(config, "database.host", "default") returns "localhost" @test{database: {}}, getConfig(config, "database.port", 5432) returns 5432 @test{}, setConfig(config, "api.timeout", 3000) creates the nested structure and sets the value @test{api: {url: "http://api.com"}}, hasConfig(config, "api.url") returns true @test{api: {}}, hasConfig(config, "api.key") returns false @test@generates
Provides utility functions for safe object property access and manipulation.