mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 02:20:08 +00:00
minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b2741f958f
commit
d1e443fd8c
11
object.js
11
object.js
@ -701,7 +701,7 @@ var __toStringProxy =
|
||||
//module.__toStringProxy =
|
||||
function(func){
|
||||
Object.defineProperty(func, 'toString', {
|
||||
value: function(...args){
|
||||
value: function toString(...args){
|
||||
var f = (
|
||||
// explicitly defined .toString(..)
|
||||
this.__proto__.toString !== Function.prototype.toString
|
||||
@ -712,11 +712,6 @@ function(func){
|
||||
this.__call__
|
||||
: this.__proto__)
|
||||
return module.normalizeIndent(f.toString(...args)) },
|
||||
/*/
|
||||
return typeof(f) == 'function' ?
|
||||
module.normalizeIndent(f.toString(...args))
|
||||
: undefined },
|
||||
//*/
|
||||
enumerable: false,
|
||||
})
|
||||
return func }
|
||||
@ -1058,7 +1053,7 @@ function Constructor(name, a, b, c){
|
||||
;((constructor_mixin || {}).toString === Function.prototype.toString
|
||||
|| (constructor_mixin || {}).toString === Object.prototype.toString)
|
||||
&& Object.defineProperty(_constructor, 'toString', {
|
||||
value: function(){
|
||||
value: function toString(){
|
||||
var args = proto.__init__ ?
|
||||
proto.__init__
|
||||
.toString()
|
||||
@ -1076,7 +1071,7 @@ function Constructor(name, a, b, c){
|
||||
// set generic raw instance constructor...
|
||||
_constructor.__rawinstance__ instanceof Function
|
||||
|| Object.defineProperty(_constructor, '__rawinstance__', {
|
||||
value: function(context, ...args){
|
||||
value: function __rawinstance__(context, ...args){
|
||||
return RawInstance(context, this, ...args) },
|
||||
enumerable: false,
|
||||
})
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-object",
|
||||
"version": "5.5.6",
|
||||
"version": "5.5.7",
|
||||
"description": "",
|
||||
"main": "object.js",
|
||||
"scripts": {
|
||||
|
||||
16
test.js
16
test.js
@ -829,13 +829,6 @@ var cases = test.Cases({
|
||||
{ toString: function(){
|
||||
return 'func_w_tostring(){ .. }' } })
|
||||
|
||||
assert(
|
||||
object.create(func).toString() == object.normalizeIndent(func.toString()),
|
||||
'create(..): function .toString() proxy (builtin).')
|
||||
assert(
|
||||
object.create(func_w_tostring).toString() == func_w_tostring.toString(),
|
||||
'create(..): function .toString() proxy (custom).')
|
||||
|
||||
var callable_a =
|
||||
object.Constructor('callable_a',
|
||||
function(){
|
||||
@ -853,6 +846,7 @@ var cases = test.Cases({
|
||||
return this.constructor.name + '.toString()' },
|
||||
})()
|
||||
|
||||
// .toString(..)
|
||||
assert(
|
||||
callable_b.toString() == object.normalizeIndent(callable_b.__call__.toString()),
|
||||
'toString(..) proxy to .__call__(..)')
|
||||
@ -863,6 +857,14 @@ var cases = test.Cases({
|
||||
callable_c.toString() == callable_c.__proto__.toString(),
|
||||
'toString(..) proxy to .toString(..)')
|
||||
|
||||
// create(..)...
|
||||
assert(
|
||||
object.create(func).toString() == object.normalizeIndent(func.toString()),
|
||||
'create(..): function .toString() proxy (builtin).')
|
||||
assert(
|
||||
object.create(func_w_tostring).toString() == func_w_tostring.toString(),
|
||||
'create(..): function .toString() proxy (custom).')
|
||||
|
||||
assert(
|
||||
object.create(callable_a).toString() == callable_a.toString(),
|
||||
'create(..): callable .toString() proxy (func).')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user