Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2774f8d

Browse files
author
Paul Schoenfelder
committed
Move logging functions into their own distinct section
1 parent 9fb33d7 commit 2774f8d

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

src/keys.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
}
7070

7171
/**
72-
* Polyfills and Logging
72+
* Polyfills
7373
*/
7474
if (!Function.prototype.bind) {
7575
Function.prototype.bind = function(context) {
@@ -82,25 +82,6 @@
8282
}
8383
var bind = Function.prototype.bind;
8484

85-
var log = (function() {
86-
// We call bind from the Function prototype like this because IE doesn't support console.log.bind
87-
var _log = console ? bind.call(console.log, console) : Function.prototype.valueOf();
88-
return function() {
89-
if (exports.debug) {
90-
var args = Array.prototype.slice.call(arguments);
91-
_log.apply(null, args);
92-
}
93-
};
94-
})();
95-
var warn = (function() {
96-
// We call bind from the Function prototype like this because IE doesn't support console.warn.bind
97-
var _warn = console ? bind.call(console.warn, console) : Function.prototype.valueOf();
98-
return function() {
99-
var args = Array.prototype.slice.call(arguments);
100-
_warn.apply(null, args);
101-
};
102-
})();
103-
10485
if (!Array.prototype.forEach) {
10586
Array.prototype.forEach = function (iterator, context) {
10687
if (!this)
@@ -174,6 +155,28 @@
174155
};
175156
}
176157

158+
/**
159+
* Logging Functions
160+
*/
161+
var log = (function() {
162+
// We call bind from the Function prototype like this because IE doesn't support console.log.bind
163+
var _log = console ? bind.call(console.log, console) : Function.prototype.valueOf();
164+
return function() {
165+
if (exports.debug) {
166+
var args = Array.prototype.slice.call(arguments);
167+
_log.apply(null, args);
168+
}
169+
};
170+
})();
171+
var warn = (function() {
172+
// We call bind from the Function prototype like this because IE doesn't support console.warn.bind
173+
var _warn = console ? bind.call(console.warn, console) : Function.prototype.valueOf();
174+
return function() {
175+
var args = Array.prototype.slice.call(arguments);
176+
_warn.apply(null, args);
177+
};
178+
})();
179+
177180
/**
178181
* Allows you to tap into the current set of elements without affecting them
179182
* in any way, additionally allowing you to chain calls together with this

0 commit comments

Comments
 (0)