1
0
Fork 0

Added Interface.isInterface()

closure/master
Mike Gerwitz 2011-03-03 23:59:37 -05:00
parent 81d03cb984
commit 85e687e29c
2 changed files with 26 additions and 0 deletions

View File

@ -75,6 +75,26 @@ module.exports.extend = function()
}; };
/**
* Determines whether the provided object is an interface created through
* ease.js
*
* @param {Object} obj object to test
*
* @return {boolean} true if interface (created through ease.js), otherwise
* false
*/
module.exports.isInterface = function( obj )
{
obj = obj || {};
return ( obj.prototype instanceof Interface )
? true
: false
;
};
/** /**
* Default interface implementation * Default interface implementation
* *

View File

@ -105,6 +105,12 @@ for ( var i = 0; i < base_types.length; i++ )
"Interface contains defined abstract methods" "Interface contains defined abstract methods"
); );
assert.equal(
Interface.isInterface( BaseType ),
true,
"Interface is considered to be an interface"
);
var SubType = Interface.extend( BaseType, var SubType = Interface.extend( BaseType,
{ {