another bugfix...

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

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "ig-object",
"version": "5.2.1",
"version": "5.2.2",
"description": "",
"main": "object.js",
"scripts": {

18
test.js
View File

@ -441,6 +441,14 @@ module.modifiers = {
gen3: function(assert, setup){
return this.gen2(assert, this.gen2(assert, setup), '3') },
// create instance clones via Object.create(..)
//
clones: function(assert, setup){
return instances(setup)
.reduce(function(res, [k, o]){
res[k] = Object.create(o)
return res }, {}) },
// generate instances...
//
// NOTE: these are re-used as tests too...
@ -618,13 +626,19 @@ module.tests = {
instances(setup)
.filter(function([_, o]){
// NOTE: not all callables are instances of Function...
return typeof(o) == 'function' })
return typeof(o) == 'function'
|| !!o.__call__ })
.forEach(function([k, o]){
o.__non_function ?
assert(!(o instanceof Function), 'non-instanceof Function', k)
: assert(o instanceof Function, 'instanceof Function', k)
assert(o(), 'call', k)
typeof(o) == 'function'
&& assert(o(), 'call', k)
assert(o.call(), '.call(..)', k)
assert(o.apply(), 'apply(..)', k)
assert(o.bind(null)(), '.bind(..)(..)', k)
test(o, k)
})