mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 18:40:08 +00:00
tweaking....
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f2e063ca21
commit
2772e29d92
10
object.js
10
object.js
@ -382,9 +382,9 @@ function(context, constructor, ...args){
|
||||
return constructor.prototype.__call__
|
||||
.call(obj, this, ...arguments) },
|
||||
constructor.prototype.__call__)
|
||||
// use parent's constructor...
|
||||
// XXX EXPERIMENTAL...
|
||||
// XXX do a better test...
|
||||
// use parent's constructor...
|
||||
: (constructor.__proto__ instanceof Function
|
||||
&& constructor.__proto__ !== (function(){}).__proto__) ?
|
||||
Reflect.construct(constructor.__proto__, [], constructor)
|
||||
@ -528,6 +528,8 @@ function(context, constructor, ...args){
|
||||
// clone it via. Object.create(..) or copy it...
|
||||
// NOTE: to disable .__rawinstance__(..) handling set it to false in the
|
||||
// class prototype...
|
||||
//
|
||||
// XXX revise .toString(..) definition test...
|
||||
var Constructor =
|
||||
module.Constructor =
|
||||
// shorthand...
|
||||
@ -559,7 +561,7 @@ function Constructor(name, a, b){
|
||||
.replace(/Constructor/g, name))
|
||||
// set .toString(..)...
|
||||
// NOTE: do this only if .toString(..) is not defined by user...
|
||||
// XXX revise this...
|
||||
// XXX revise this test...
|
||||
;((cls_proto || {}).toString === Function.toString
|
||||
|| (cls_proto || {}).toString === ({}).toString)
|
||||
&& Object.defineProperty(_constructor, 'toString', {
|
||||
@ -578,7 +580,9 @@ function Constructor(name, a, b){
|
||||
return `${this.name}(${args})${normalizeIndent(code)}` },
|
||||
enumerable: false,
|
||||
})
|
||||
_constructor.__proto__ = cls_proto
|
||||
_constructor.__proto__ = cls_proto === undefined ?
|
||||
_constructor.__proto__
|
||||
: cls_proto
|
||||
_constructor.prototype = proto
|
||||
// generic raw instance constructor...
|
||||
_constructor.__rawinstance__ instanceof Function
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-object",
|
||||
"version": "2.7.0",
|
||||
"version": "2.7.1",
|
||||
"description": "",
|
||||
"main": "object.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user