Challenge now display console.log in output window

This commit is contained in:
Berkeley Martinez
2016-05-27 17:11:25 -07:00
parent 256182836a
commit 2466d66eb1
10 changed files with 127 additions and 55 deletions

View File

@@ -64,3 +64,16 @@ export function createTests({ tests = [] }) {
testString: test
}));
}
export function loggerToStr(args) {
args = Array.isArray(args) ? args : [args];
return args
.map(arg => typeof arg === 'undefined' ? 'undefined' : arg)
.map(arg => {
if (typeof arg !== 'string') {
return JSON.stringify(arg);
}
return arg;
})
.reduce((str, arg) => str + arg + '\n', '');
}