From 58ee52ad4a0ebf51f9add9b99188968268ed6f8e Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Sat, 29 Mar 2014 00:59:42 -0400 Subject: [PATCH] Removed unnecessary try/catch from isInstanceOf Was just being lazy. --- lib/ClassBuilder.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/ClassBuilder.js b/lib/ClassBuilder.js index 07048e0..caae2a8 100644 --- a/lib/ClassBuilder.js +++ b/lib/ClassBuilder.js @@ -244,16 +244,14 @@ exports.isInstanceOf = function( type, instance ) return false; } - try + // check prototype chain (will throw an error if type is not a + // constructor (function) + if ( ( typeof type === 'function' ) + && ( instance instanceof type ) + ) { - // check prototype chain (will throw an error if type is not a - // constructor (function) - if ( instance instanceof type ) - { - return true; - } + return true; } - catch ( e ) {} // if no metadata is available, then our remaining checks cannot be // performed