All functions are now camelCase
parent
004ccfa05b
commit
789f2390af
22
lib/class.js
22
lib/class.js
|
@ -168,10 +168,10 @@ var extend = ( function( extending )
|
||||||
prototype.parent = base.prototype;
|
prototype.parent = base.prototype;
|
||||||
|
|
||||||
// set up the new class
|
// set up the new class
|
||||||
var new_class = create_ctor( abstract_methods );
|
var new_class = createCtor( abstract_methods );
|
||||||
|
|
||||||
setup_props( new_class, abstract_methods );
|
setupProps( new_class, abstract_methods );
|
||||||
attach_prop_init( prototype, properties );
|
attachPropInit( prototype, properties );
|
||||||
|
|
||||||
new_class.prototype = prototype;
|
new_class.prototype = prototype;
|
||||||
new_class.constructor = new_class;
|
new_class.constructor = new_class;
|
||||||
|
@ -197,7 +197,7 @@ var extend = ( function( extending )
|
||||||
*
|
*
|
||||||
* @return {Function} constructor
|
* @return {Function} constructor
|
||||||
*/
|
*/
|
||||||
function create_ctor( abstract_methods )
|
function createCtor( abstract_methods )
|
||||||
{
|
{
|
||||||
// concrete class
|
// concrete class
|
||||||
if ( abstract_methods.length === 0 )
|
if ( abstract_methods.length === 0 )
|
||||||
|
@ -229,7 +229,7 @@ var extend = ( function( extending )
|
||||||
// abstract class
|
// abstract class
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return function ()
|
return function()
|
||||||
{
|
{
|
||||||
if ( !extending )
|
if ( !extending )
|
||||||
{
|
{
|
||||||
|
@ -249,10 +249,10 @@ var extend = ( function( extending )
|
||||||
*
|
*
|
||||||
* @return {undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
function setup_props( func, abstract_methods )
|
function setupProps( func, abstract_methods )
|
||||||
{
|
{
|
||||||
attach_abstract( func, abstract_methods );
|
attachAbstract( func, abstract_methods );
|
||||||
attach_extend( func );
|
attachExtend( func );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ function setup_props( func, abstract_methods )
|
||||||
*
|
*
|
||||||
* @return {undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
function attach_prop_init( prototype, properties )
|
function attachPropInit( prototype, properties )
|
||||||
{
|
{
|
||||||
util.defineSecureProp( prototype, '__initProps', function()
|
util.defineSecureProp( prototype, '__initProps', function()
|
||||||
{
|
{
|
||||||
|
@ -304,7 +304,7 @@ function attach_prop_init( prototype, properties )
|
||||||
*
|
*
|
||||||
* @return {undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
function attach_abstract( func, methods )
|
function attachAbstract( func, methods )
|
||||||
{
|
{
|
||||||
var is_abstract = ( methods.length > 0 ) ? true: false;
|
var is_abstract = ( methods.length > 0 ) ? true: false;
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ function attach_abstract( func, methods )
|
||||||
*
|
*
|
||||||
* @return {undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
function attach_extend( func )
|
function attachExtend( func )
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Shorthand for extending classes
|
* Shorthand for extending classes
|
||||||
|
|
|
@ -70,7 +70,7 @@ function extend()
|
||||||
},
|
},
|
||||||
} );
|
} );
|
||||||
|
|
||||||
attach_extend( new_interface );
|
attachExtend( new_interface );
|
||||||
new_interface.prototype = prototype;
|
new_interface.prototype = prototype;
|
||||||
new_interface.constructor = new_interface;
|
new_interface.constructor = new_interface;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ function inheritCheck( prototype )
|
||||||
*
|
*
|
||||||
* @return {undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
function attach_extend( func )
|
function attachExtend( func )
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Shorthand for extending interfaces
|
* Shorthand for extending interfaces
|
||||||
|
|
46
lib/util.js
46
lib/util.js
|
@ -151,12 +151,12 @@ exports.clone = function( data )
|
||||||
exports.propParse = function( data, options )
|
exports.propParse = function( data, options )
|
||||||
{
|
{
|
||||||
var fvoid = function() {},
|
var fvoid = function() {},
|
||||||
callback_each = options.each || undefined,
|
callbackEach = options.each || undefined,
|
||||||
callback_prop = options.property || fvoid,
|
callbackProp = options.property || fvoid,
|
||||||
callback_method = options.method || fvoid,
|
callbackMethod = options.method || fvoid,
|
||||||
callback_getter = options.getter || fvoid,
|
callbackGetter = options.getter || fvoid,
|
||||||
callback_setter = options.setter || fvoid,
|
callbackSetter = options.setter || fvoid,
|
||||||
keyword_parser = options.keywordParser || propParseKeywords,
|
keywordParser = options.keywordParser || propParseKeywords,
|
||||||
|
|
||||||
hasOwn = Object.prototype.hasOwnProperty,
|
hasOwn = Object.prototype.hasOwnProperty,
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ exports.propParse = function( data, options )
|
||||||
getter = ( ( getset ) ? data.__lookupGetter__( prop ) : null );
|
getter = ( ( getset ) ? data.__lookupGetter__( prop ) : null );
|
||||||
setter = ( ( getset ) ? data.__lookupSetter__( prop ) : null );
|
setter = ( ( getset ) ? data.__lookupSetter__( prop ) : null );
|
||||||
|
|
||||||
parse_data = keyword_parser( prop ) || {};
|
parse_data = keywordParser( prop ) || {};
|
||||||
name = parse_data.name || prop;
|
name = parse_data.name || prop;
|
||||||
keywords = parse_data.keywords || {};
|
keywords = parse_data.keywords || {};
|
||||||
|
|
||||||
|
@ -198,22 +198,22 @@ exports.propParse = function( data, options )
|
||||||
}
|
}
|
||||||
|
|
||||||
// if an 'each' callback was provided, pass the data before parsing it
|
// if an 'each' callback was provided, pass the data before parsing it
|
||||||
if ( callback_each )
|
if ( callbackEach )
|
||||||
{
|
{
|
||||||
callback_each.call( callback_each, name, value );
|
callbackEach.call( callbackEach, name, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
// getter/setter
|
// getter/setter
|
||||||
if ( getter || setter )
|
if ( getter || setter )
|
||||||
{
|
{
|
||||||
callback_getter.call( callback_getter, name, getter );
|
callbackGetter.call( callbackGetter, name, getter );
|
||||||
callback_setter.call( callback_setter, name, setter );
|
callbackSetter.call( callbackSetter, name, setter );
|
||||||
}
|
}
|
||||||
// method
|
// method
|
||||||
else if ( value instanceof Function )
|
else if ( value instanceof Function )
|
||||||
{
|
{
|
||||||
callback_method.call(
|
callbackMethod.call(
|
||||||
callback_method,
|
callbackMethod,
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
exports.isAbstractMethod( value )
|
exports.isAbstractMethod( value )
|
||||||
|
@ -222,7 +222,7 @@ exports.propParse = function( data, options )
|
||||||
// simple property
|
// simple property
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
callback_prop.call( callback_prop, name, value );
|
callbackProp.call( callbackProp, name, value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ exports.propCopy = function( props, dest, actions )
|
||||||
{
|
{
|
||||||
actions = actions || {};
|
actions = actions || {};
|
||||||
|
|
||||||
var use_or = function( use, or )
|
var useOr = function( use, or )
|
||||||
{
|
{
|
||||||
if ( use instanceof Function )
|
if ( use instanceof Function )
|
||||||
{
|
{
|
||||||
|
@ -264,7 +264,7 @@ exports.propCopy = function( props, dest, actions )
|
||||||
|
|
||||||
// substitute default functionality if needed
|
// substitute default functionality if needed
|
||||||
var parse_actions = {
|
var parse_actions = {
|
||||||
each: use_or( actions.each, function( name, value )
|
each: useOr( actions.each, function( name, value )
|
||||||
{
|
{
|
||||||
// methods can only be overridden with methods
|
// methods can only be overridden with methods
|
||||||
if ( ( dest[ name ] instanceof Function )
|
if ( ( dest[ name ] instanceof Function )
|
||||||
|
@ -275,22 +275,22 @@ exports.propCopy = function( props, dest, actions )
|
||||||
}
|
}
|
||||||
} ),
|
} ),
|
||||||
|
|
||||||
property: use_or( actions.property, function( name, value )
|
property: useOr( actions.property, function( name, value )
|
||||||
{
|
{
|
||||||
dest[ name ] = value;
|
dest[ name ] = value;
|
||||||
} ),
|
} ),
|
||||||
|
|
||||||
getter: use_or( actions.getter, function( name, func )
|
getter: useOr( actions.getter, function( name, func )
|
||||||
{
|
{
|
||||||
dest.__defineGetter__( name, func );
|
dest.__defineGetter__( name, func );
|
||||||
} ),
|
} ),
|
||||||
|
|
||||||
setter: use_or( actions.setter, function( name, func )
|
setter: useOr( actions.setter, function( name, func )
|
||||||
{
|
{
|
||||||
dest.__defineSetter__( name, func );
|
dest.__defineSetter__( name, func );
|
||||||
} ),
|
} ),
|
||||||
|
|
||||||
method: use_or( actions.method, function( name, func, is_abstract )
|
method: useOr( actions.method, function( name, func, is_abstract )
|
||||||
{
|
{
|
||||||
var pre = dest[ name ];
|
var pre = dest[ name ];
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ exports.propCopy = function( props, dest, actions )
|
||||||
{
|
{
|
||||||
// use provided method override action, or fall back to
|
// use provided method override action, or fall back to
|
||||||
// generic override
|
// generic override
|
||||||
var override_func = use_or( actions.methodOverride,
|
var overrideFunc = useOr( actions.methodOverride,
|
||||||
function( name, pre, func )
|
function( name, pre, func )
|
||||||
{
|
{
|
||||||
return exports.overrideMethod( name, pre, func );
|
return exports.overrideMethod( name, pre, func );
|
||||||
|
@ -310,8 +310,8 @@ exports.propCopy = function( props, dest, actions )
|
||||||
|
|
||||||
// use call(), passing self in as context, to ensure 'this'
|
// use call(), passing self in as context, to ensure 'this'
|
||||||
// will reference the function itself
|
// will reference the function itself
|
||||||
dest[ name ] = override_func.call(
|
dest[ name ] = overrideFunc.call(
|
||||||
override_func, name, pre, func
|
overrideFunc, name, pre, func
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue