Skip to content
This repository has been archived by the owner. It is now read-only.

Commit ad7d9b1

Browse files
author
Lauren McCarthy
authored
Merge pull request #245 from mattdesl/debug-console-fix
Small change to ensure styling is only applied to logs with strings
2 parents 2ea8dcc + e6b828c commit ad7d9b1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

public/js/debug-console.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
window.console[func] = function(msg) {
99
var style = null;
1010
var messages = Array.prototype.slice.call(arguments);
11-
if (arguments[0].indexOf('%c') > -1 && arguments.length > 1) {
11+
12+
// e.g. console.log('%cHello', 'background: red', 'foobar');
13+
if (arguments.length > 1 &&
14+
typeof arguments[0] === 'string' &&
15+
typeof arguments[1] === 'string' &&
16+
arguments[0].indexOf('%c') > -1) {
1217
style = arguments[1];
1318
messages.splice(1, 1); // remove style string from console output
1419
}

0 commit comments

Comments
 (0)