From a64e6f050068bbd336d59a919d14d2fbf8cd0469 Mon Sep 17 00:00:00 2001 From: Tushar Mathur Date: Sat, 27 Dec 2014 11:30:44 +0530 Subject: [PATCH] fix: check prototype first to conclude if its a class After minifying your javascript it is possible that the class names get changed, such that they are no more adhering to the standard of starting a class name with a capital letter. Thus the isClass util fun returns false in such cases, even though the class has some fields set in the prototype object. The solution is to first check the prototype object for keys and then check for class name. Fixes #92 --- src/util.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util.js b/src/util.js index 29cfaf8..6b6c9b2 100644 --- a/src/util.js +++ b/src/util.js @@ -7,11 +7,12 @@ function isUpperCase(char) { function isClass(clsOrFunction) { - if (clsOrFunction.name) { + if (Object.keys(clsOrFunction.prototype).length > 0){ + return true; + }else if (clsOrFunction.name) { return isUpperCase(clsOrFunction.name.charAt(0)); } - - return Object.keys(clsOrFunction.prototype).length > 0; + return false; }