all files / prolific.monitor/ configure.js

100% Statements 14/14
100% Branches 10/10
100% Functions 1/1
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21              
function configure (env, configuration) {
    if (configuration == null) {
        configuration = { processors: [] }
    } else if (/^\s*{/.test(configuration)) {
        configuration = JSON.parse(configuration)
    } else if (configuration == 'inherit') {
        configuration = 'PROLIFIC_CONFIGURATION'
    } else {
        configuration = env[configuration]
    }
    if (typeof configuration == 'object') {
        if (configuration.processors == null) {
            configuration.processors = []
        }
        return configuration
    }
    return configure(env, configuration)
}
 
module.exports = configure