Configuration utilities
Collection of utilities for configuration management.
Functions
resolvePaths(paths, [opts])
Resolve paths in a configuration object. The path
configuration object is expected to be configured as follows:
paths = {
myFolder1: '.',
myFolder2: '/home',
specialFile: '$myFolder2/special.txt'
}
The output of resolvePaths()
for this input would be:
resolvePaths(paths) = {
myFolder1: '/my/current/working/directory/full/path',
myFolder2: '/home',
specialFile: '/home/special.txt'
}
The following rules apply:
- Dollar substitution only applies to the first entry of the path
- Behaviour for path names containing forward slashes is undefined
- Regardless of the operating system, input paths must be all forward-slash-separated
Options
- baseDir: Base folder path for relative entries resolution (defaults to current directory)
- iterationLimit: Iteration limit to avoid circular dependencies (defaults to 1000; only needed for huge configuration objects)
License
This package and all of its contents are published under the MIT license. See the enclosed LICENSE file.