Skip to content

Instantly share code, notes, and snippets.

@fkei
Created March 4, 2011 01:47
Show Gist options
  • Save fkei/854019 to your computer and use it in GitHub Desktop.
Save fkei/854019 to your computer and use it in GitHub Desktop.
Array type check
--- lib/log4js.js.orig 2011-03-04 10:32:06.000000000 +0900
+++ lib/log4js.js 2011-03-04 10:42:24.000000000 +0900
@@ -134,8 +134,8 @@
args = [ ALL_CATEGORIES ];
}
//argument may already be an array
- if (args[0].forEach) {
- args = args[0];
+ if (args[0].constructor.name === 'Array') {
+ args = args[0];
}
args.forEach(function(category) {
@fkei
Copy link
Author

fkei commented Mar 4, 2011

I learned a better check on Twitter.

if (Array.isArray(args[0]) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment