Altered toString() defaults to be more consistent with v8
parent
9a135a064c
commit
7b766c1b14
12
lib/class.js
12
lib/class.js
|
@ -635,11 +635,11 @@ var extend = ( function( extending )
|
||||||
|| ( ( cname )
|
|| ( ( cname )
|
||||||
? function()
|
? function()
|
||||||
{
|
{
|
||||||
return '[object #<' + cname + '>]';
|
return '#<' + cname + '>';
|
||||||
}
|
}
|
||||||
: function()
|
: function()
|
||||||
{
|
{
|
||||||
return '[object #<anonymous>]';
|
return '#<anonymous>';
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
@ -648,8 +648,8 @@ var extend = ( function( extending )
|
||||||
|
|
||||||
// provide a more intuitive string representation
|
// provide a more intuitive string representation
|
||||||
__self.toString = ( cname )
|
__self.toString = ( cname )
|
||||||
? function() { return '[object Class <' + cname + '>]'; }
|
? function() { return cname; }
|
||||||
: function() { return '[object Class]'; }
|
: function() { return '(Class)'; }
|
||||||
;
|
;
|
||||||
|
|
||||||
return __self;
|
return __self;
|
||||||
|
@ -671,11 +671,11 @@ var extend = ( function( extending )
|
||||||
__abstract_self.toString = ( cname )
|
__abstract_self.toString = ( cname )
|
||||||
? function()
|
? function()
|
||||||
{
|
{
|
||||||
return '[object AbstractClass <' + cname + '>]';
|
return cname;
|
||||||
}
|
}
|
||||||
: function()
|
: function()
|
||||||
{
|
{
|
||||||
return '[object AbstractClass]';
|
return '(AbstractClass)';
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -122,14 +122,14 @@ var common = require( './common' ),
|
||||||
// concrete
|
// concrete
|
||||||
assert.equal(
|
assert.equal(
|
||||||
Class( {} ).toString(),
|
Class( {} ).toString(),
|
||||||
'[object Class]',
|
'(Class)',
|
||||||
"Converting anonymous class to string yields class string"
|
"Converting anonymous class to string yields class string"
|
||||||
);
|
);
|
||||||
|
|
||||||
// abstract
|
// abstract
|
||||||
assert.equal(
|
assert.equal(
|
||||||
Class( { 'abstract foo': [] } ).toString(),
|
Class( { 'abstract foo': [] } ).toString(),
|
||||||
'[object AbstractClass]',
|
'(AbstractClass)',
|
||||||
"Converting abstract anonymous class to string yields class string"
|
"Converting abstract anonymous class to string yields class string"
|
||||||
);
|
);
|
||||||
} )();
|
} )();
|
||||||
|
@ -146,14 +146,14 @@ var common = require( './common' ),
|
||||||
// concrete
|
// concrete
|
||||||
assert.equal(
|
assert.equal(
|
||||||
Class( name, {} ).toString(),
|
Class( name, {} ).toString(),
|
||||||
'[object Class <' + name + '>]',
|
name,
|
||||||
"Converting named class to string yields string with name of class"
|
"Converting named class to string yields string with name of class"
|
||||||
);
|
);
|
||||||
|
|
||||||
// abstract
|
// abstract
|
||||||
assert.equal(
|
assert.equal(
|
||||||
Class( name, { 'abstract foo': [] } ).toString(),
|
Class( name, { 'abstract foo': [] } ).toString(),
|
||||||
'[object AbstractClass <' + name + '>]',
|
name,
|
||||||
"Converting abstract named class to string yields string with name " +
|
"Converting abstract named class to string yields string with name " +
|
||||||
"of class"
|
"of class"
|
||||||
);
|
);
|
||||||
|
@ -175,7 +175,7 @@ var common = require( './common' ),
|
||||||
// anonymous
|
// anonymous
|
||||||
assert.equal(
|
assert.equal(
|
||||||
anon.toString(),
|
anon.toString(),
|
||||||
'[object #<anonymous>]',
|
'#<anonymous>',
|
||||||
"Converting anonymous class instance to string yields string " +
|
"Converting anonymous class instance to string yields string " +
|
||||||
"indiciating that the class is anonymous"
|
"indiciating that the class is anonymous"
|
||||||
);
|
);
|
||||||
|
@ -183,7 +183,7 @@ var common = require( './common' ),
|
||||||
// named
|
// named
|
||||||
assert.equal(
|
assert.equal(
|
||||||
named.toString(),
|
named.toString(),
|
||||||
'[object #<' + name + '>]',
|
'#<' + name + '>',
|
||||||
"Converting named class instance to string yields string with name " +
|
"Converting named class instance to string yields string with name " +
|
||||||
"of class"
|
"of class"
|
||||||
);
|
);
|
||||||
|
@ -214,7 +214,7 @@ var common = require( './common' ),
|
||||||
// was the name set?
|
// was the name set?
|
||||||
assert.equal(
|
assert.equal(
|
||||||
named.toString(),
|
named.toString(),
|
||||||
'[object Class <' + name + '>]',
|
name,
|
||||||
"Name is set on named clas via staging method"
|
"Name is set on named clas via staging method"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ var common = require( './common' ),
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
namedi.toString(),
|
namedi.toString(),
|
||||||
'[object Class <' + name + '>]',
|
name,
|
||||||
"Name is set on named class via staging method when implementing"
|
"Name is set on named class via staging method when implementing"
|
||||||
);
|
);
|
||||||
} )();
|
} )();
|
||||||
|
|
Loading…
Reference in New Issue