From fdf630458a94cfc4b4e61cc9d5645bdb46848fa2 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 3 Nov 2011 21:56:15 -0400 Subject: [PATCH] [#25] instanceof => typeof for functions; lib/ --- lib/ClassBuilder.js | 4 ++-- lib/util.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ClassBuilder.js b/lib/ClassBuilder.js index 164fd86..fb657c8 100644 --- a/lib/ClassBuilder.js +++ b/lib/ClassBuilder.js @@ -623,7 +623,7 @@ exports.prototype.createConcreteCtor = function( cname, members ) attachInstanceId( this, ++_self._instanceId ); // call the constructor, if one was provided - if ( this.__construct instanceof Function ) + if ( typeof this.__construct === 'function' ) { // note that since 'this' refers to the new class (even // subtypes), and since we're using apply with 'this', the @@ -747,7 +747,7 @@ exports.prototype._attachPropInit = function( // first initialize the parent's properties, so that ours will overwrite // them var parent_init = prototype.___$$parent$$.__initProps; - if ( parent_init instanceof Function ) + if ( typeof parent_init === 'function' ) { // call the parent prop_init, letting it know that it's been // inherited so that it does not initialize private members or diff --git a/lib/util.js b/lib/util.js index 5d69505..eb5e738 100644 --- a/lib/util.js +++ b/lib/util.js @@ -323,7 +323,7 @@ exports.propParse = function( data, options ) ); } // method - else if ( value instanceof Function ) + else if ( typeof value === 'function' ) { callbackMethod.call( callbackMethod, @@ -381,7 +381,7 @@ exports.createAbstractMethod = function() */ exports.isAbstractMethod = function( func ) { - return ( ( func instanceof Function ) && ( func.abstractFlag === true ) ) + return ( ( typeof func === 'function') && ( func.abstractFlag === true ) ) ? true : false ;