// A log level object with "weighted" values
const level = {
debug: 5,
error: 0,
http: 3,
info: 2,
silly: 6,
verbose: 4,
warn: 1
}
// The numeric levelEnum we want
const expectedLevelsEnum = {
0: 'error',
1: 'warn',
2: 'info',
3: 'http',
4: 'verbose',
5: 'debug',
6: 'silly',
debug: 5,
error: 0,
http: 3,
info: 2,
silly: 6,
verbose: 4,
warn: 1
}
// Create the new enum
const logLevelEnum = enumFactory.create(level)
assert.deepEqual(logLevelEnum, expectedLevelsEnum)
console.log(`${s(logLevelEnum)} == ${s(expectedLevelsEnum)}`)
var levelList = [
"error",
"warn",
"info",
"http",
"verbose",
"debug",
"silly"
]
console.log(`${s(enumFactory.create(levelList))}`)