forked from meteor/meteor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsole.js
27 lines (25 loc) · 836 Bytes
/
console.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var hasOwn = Object.prototype.hasOwnProperty;
function wrap(method) {
var original = console[method];
if (original && typeof original === "object") {
// Turn callable console method objects into actual functions.
console[method] = function () {
return Function.prototype.apply.call(
original, console, arguments
);
};
}
}
if (typeof console === "object" &&
// In older Internet Explorers, methods like console.log are actually
// callable objects rather than functions.
typeof console.log === "object") {
for (var method in console) {
// In most browsers, this hasOwn check will fail for all console
// methods anyway, but fortunately in IE8 the method objects we care
// about are own properties.
if (hasOwn.call(console, method)) {
wrap(method);
}
}
}