From ed1dd3a2b625ece350fc4afaad70ba9675f6b7d9 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 26 Apr 2020 20:05:30 +0300 Subject: [PATCH] docs and cleanup... Signed-off-by: Alex A. Naanou --- object.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/object.js b/object.js index d22aa68..734d942 100755 --- a/object.js +++ b/object.js @@ -175,13 +175,19 @@ function(root, ...objects){ // // This will not call .__init__(..) // -// XXX Q: should this be a class method or a utility??? +// NOTE: as this simply an extension to the base JavaScript protocol this +// can be used to construct using any object... +// Example: +// var O = function(){} +// // new is optional... +// var o = new makeRawInstance(null, O) +// // XXX Q: should .__new__(..) be a class method??? +// ...in a prototype model I'm not sure... var makeRawInstance = module.makeRawInstance = function(context, constructor, ...args){ - var _mirror_doc = - function(func, target){ + var _mirror_doc = function(func, target){ Object.defineProperty(func, 'toString', { value: function(...args){ return target.toString(...args) }, @@ -324,7 +330,6 @@ function(context, constructor, ...args){ // // XXX Q: should the context in .__new__(..) be _constructor or .prototype??? // ...currently it's .prototype... -// XXX Q: should we add a wrapper to .makeRawInstance(..) as a class method here??? var Constructor = module.Constructor = // shorthand...