@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.
Files changed (3) hide show
  1. package/changes.md +8 -0
  2. package/index.js +12 -2
  3. package/package.json +1 -1
package/changes.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 30 jan 2026
2
+
3
+ ### version 0.3.0
4
+
5
+ - accept options to the factory (new call) and install them as descriptors on
6
+ the context.
7
+ - fix: handle passed args properly.
8
+
1
9
  ## 28 jan 2026
2
10
 
3
11
  ### version 0.2.2
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, fn, thisArg, args) {
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') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@javish/lib",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "author": {
5
5
  "name": "British Software",
6
6
  "email": "packages+javish@british.software"