mirror of
https://github.com/flynx/object.js.git
synced 2025-10-30 02:50:10 +00:00
another bugfix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a96a1fb803
commit
59f78fb7d4
@ -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 }
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-object",
|
||||
"version": "5.2.1",
|
||||
"version": "5.2.2",
|
||||
"description": "",
|
||||
"main": "object.js",
|
||||
"scripts": {
|
||||
|
||||
18
test.js
18
test.js
@ -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)
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user