Added Interface.isInterface()
parent
81d03cb984
commit
85e687e29c
|
@ -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
|
||||
*
|
||||
|
|
|
@ -105,6 +105,12 @@ for ( var i = 0; i < base_types.length; i++ )
|
|||
"Interface contains defined abstract methods"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
Interface.isInterface( BaseType ),
|
||||
true,
|
||||
"Interface is considered to be an interface"
|
||||
);
|
||||
|
||||
|
||||
var SubType = Interface.extend( BaseType,
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue