1
0
Fork 0

[#25] instanceof => typeof for functions; lib/

closure/master
Mike Gerwitz 2011-11-03 21:56:15 -04:00
parent 705e228842
commit fdf630458a
2 changed files with 4 additions and 4 deletions

View File

@ -623,7 +623,7 @@ exports.prototype.createConcreteCtor = function( cname, members )
attachInstanceId( this, ++_self._instanceId ); attachInstanceId( this, ++_self._instanceId );
// call the constructor, if one was provided // 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 // note that since 'this' refers to the new class (even
// subtypes), and since we're using apply with 'this', the // 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 // first initialize the parent's properties, so that ours will overwrite
// them // them
var parent_init = prototype.___$$parent$$.__initProps; 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 // call the parent prop_init, letting it know that it's been
// inherited so that it does not initialize private members or // inherited so that it does not initialize private members or

View File

@ -323,7 +323,7 @@ exports.propParse = function( data, options )
); );
} }
// method // method
else if ( value instanceof Function ) else if ( typeof value === 'function' )
{ {
callbackMethod.call( callbackMethod.call(
callbackMethod, callbackMethod,
@ -381,7 +381,7 @@ exports.createAbstractMethod = function()
*/ */
exports.isAbstractMethod = function( func ) exports.isAbstractMethod = function( func )
{ {
return ( ( func instanceof Function ) && ( func.abstractFlag === true ) ) return ( ( typeof func === 'function') && ( func.abstractFlag === true ) )
? true ? true
: false : false
; ;