@javish/lib 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changes.md +8 -0
- package/index.js +12 -2
- package/package.json +1 -1
package/changes.md
CHANGED
package/index.js
CHANGED
|
@@ -46,7 +46,7 @@ var ImplFactory = function (Base, methods) {
|
|
|
46
46
|
* @template {Record<string,*>} C
|
|
47
47
|
*/
|
|
48
48
|
module.exports.FnImplFactory = (Base, Impl) => {
|
|
49
|
-
var target = function (__fm, I,
|
|
49
|
+
var target = function (__fm, I, ...args) {
|
|
50
50
|
// var __fm = base.__fm.call(newTarget) // invoke
|
|
51
51
|
// console.log('> 💡 functional #' + I) // if calling .test on this, might want to access base???
|
|
52
52
|
return __fm.apply(this, args)
|
|
@@ -56,13 +56,14 @@ module.exports.FnImplFactory = (Base, Impl) => {
|
|
|
56
56
|
apply:target,
|
|
57
57
|
construct(fn, args, Target) {
|
|
58
58
|
// var I=++i
|
|
59
|
+
|
|
59
60
|
var __fm=Base.prototype.__fm.call(Target.prototype)
|
|
60
61
|
if(!__fm) {
|
|
61
62
|
__fm=Base.prototype.__fm.call(Impl)
|
|
62
63
|
}
|
|
63
64
|
var base=new Base
|
|
64
65
|
// var target=new (Target.prototype.constructor)
|
|
65
|
-
var descs=
|
|
66
|
+
var descs=Object.create(null)
|
|
66
67
|
if(!$fields) {
|
|
67
68
|
$fields = new Set
|
|
68
69
|
var _$fields=Object.entries(Object.getOwnPropertyDescriptors(base))
|
|
@@ -78,6 +79,15 @@ module.exports.FnImplFactory = (Base, Impl) => {
|
|
|
78
79
|
// descs[k]=Object.getOwnPropertyDescriptor(target,k)
|
|
79
80
|
} // what about private fields though
|
|
80
81
|
}
|
|
82
|
+
|
|
83
|
+
for(var cc of args) {
|
|
84
|
+
// in args,there are some kind of options, which could be like come first.
|
|
85
|
+
if(typeof cc == 'object') {
|
|
86
|
+
Object.assign(descs,Object.getOwnPropertyDescriptors(cc))
|
|
87
|
+
}
|
|
88
|
+
// or last as at the moment...
|
|
89
|
+
}
|
|
90
|
+
|
|
81
91
|
var STATE=Object.create(Target.prototype,descs)
|
|
82
92
|
|
|
83
93
|
// if(typeof Target.prototype.constructor=='function') {
|