bugfix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-08-09 17:19:17 +03:00
parent 00c17b3ce8
commit a96a1fb803
3 changed files with 23 additions and 4 deletions

View File

@ -1083,7 +1083,10 @@ function Constructor(name, a, b, c){
.forEach(function(n){ .forEach(function(n){
proto[n] proto[n]
|| Object.defineProperty(proto, n, || Object.defineProperty(proto, n,
Object.getOwnPropertyDescriptor(Function.prototype, n)) }) Object.assign(
Object.getOwnPropertyDescriptor(Function.prototype, n),
{ value: function(){
return this.__call__[n](...arguments) }, })) })
return _constructor } return _constructor }

View File

@ -1,6 +1,6 @@
{ {
"name": "ig-object", "name": "ig-object",
"version": "5.2.0", "version": "5.2.1",
"description": "", "description": "",
"main": "object.js", "main": "object.js",
"scripts": { "scripts": {
@ -26,7 +26,7 @@
}, },
"homepage": "https://github.com/flynx/object.js#readme", "homepage": "https://github.com/flynx/object.js#readme",
"devDependencies": { "devDependencies": {
"c8": "^7.2.1", "c8": "^7.3.0",
"colors": "^1.4.0", "colors": "^1.4.0",
"ig-argv": "^2.11.2" "ig-argv": "^2.11.2"
} }

18
test.js
View File

@ -690,7 +690,23 @@ module.cases = {
assert.array(object.deepKeys(c, b), ['c', 'b'], 'partial chain') assert.array(object.deepKeys(c, b), ['c', 'b'], 'partial chain')
assert.array(object.deepKeys(c, c), ['c'], 'partial chain') assert.array(object.deepKeys(c, c), ['c'], 'partial chain')
} },
funcMethods: function(assert){
var X = object.C('X', {
__call__: function(){
return true },
})
var x = new X()
assert(x(), 'x()')
assert(x.call(null), 'x.call(null)')
var xx = Object.create(x)
assert(typeof(xx.call) == 'function', 'xx.call is a function')
assert(xx.call(null), 'xx.call(null)')
},
} }