fix(config): changed to work in node v4,v5

This commit is contained in:
Gareth Jones 2017-07-03 08:00:17 +10:00
parent c1f1cea5a5
commit b65aef9faf

View File

@ -5,6 +5,12 @@ const levels = require('./levels');
const layouts = require('./layouts');
const debug = require('debug')('log4js:configuration');
const validColours = [
'white', 'grey', 'black',
'blue', 'cyan', 'green',
'magenta', 'red', 'yellow'
];
function not(thing) {
return !thing;
}
@ -164,10 +170,8 @@ class Configuration {
this.throwExceptionIf(not(anInteger(levelConfig[l].value)), `level "${l}".value must have an integer value`);
this.throwExceptionIf(not(levelConfig[l].colour), `level "${l}" must have a 'colour' property`);
this.throwExceptionIf(
not([
'white', 'grey', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'
].includes(levelConfig[l].colour)),
`level "${l}".colour must be one of white, grey, black, blue, cyan, green, magenta, red, yellow`
not(validColours.indexOf(levelConfig[l].colour) > -1),
`level "${l}".colour must be one of ${validColours.join(', ')}`
);
});
}