A zero-dependency alternative to cosmiconfig for loading configuration files
89
A utility that extracts configuration values from package.json files using property paths. The utility must properly handle edge cases where property paths reference null or undefined values.
Build a configuration extractor that:
{"config": {"tool": "value"}}, extracting path ["config", "tool"] returns "value" @test{"app": {"settings": {"theme": "dark"}}}, extracting path ["app", "settings", "theme"] returns "dark" @test@generates
/**
* Extracts a configuration value from a package.json file using a property path.
*
* @param {string} packageJsonPath - Path to the package.json file
* @param {string|string[]} propertyPath - Property path as dot-notation string or array
* @returns {any|null} The configuration value, or null if path doesn't exist
* @throws {Error} When a property in the path is explicitly null
*/
function extractConfig(packageJsonPath, propertyPath) {
// Implementation here
}
module.exports = { extractConfig };Provides configuration file loading and property path extraction with proper null/undefined handling.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-lilconfigdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10