From aea235552021062e78e3756eaba6403442f72a2a Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 30 Apr 2020 02:10:01 +0300 Subject: [PATCH] more cleanup... Signed-off-by: Alex A. Naanou --- README.md | 2 +- object.js | 18 ++++++------------ package.json | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 4498963..6dc952f 100755 --- a/README.md +++ b/README.md @@ -214,8 +214,8 @@ parent(, ) Get parent method and call it ``` -parentCall(, ) parentCall(, , ) +parentCall(, ) -> -> undefined ``` diff --git a/object.js b/object.js index dd56018..5f3273c 100755 --- a/object.js +++ b/object.js @@ -132,7 +132,7 @@ function(obj, name, callback){ // the first .method value visible from 'this', i.e. the top most // value and not the value visible from that particular level... // -// XXX need to add a way to work with props... +// XXX need to add a way to work with props... (???) var parent = module.parent = function(proto, name){ @@ -155,8 +155,8 @@ function(proto, name){ // Find the next parent method and call it... // -// parentCall(meth, this, ...) // parentCall(proto, name, this, ...) +// parentCall(meth, this, ...) // -> res // -> undefined // @@ -170,20 +170,14 @@ function(proto, name){ // or: // parent(method, this).call(this, ...) // NOTE: for more docs see parent(..) -// -// XXX should we rename this to parent.call(..) ??? -// ...this does not care about context so there is no reason to keep -// the default call, but this lowers discoverability and might be -// confusing... var parentCall = module.parentCall = function(proto, name, that, ...args){ - var [p, c] = typeof(name) == typeof('str') ? - [ [proto, name, that], [...arguments].slice(2)] - : [ [proto, name], [...arguments].slice(1)] - var meth = parent(...p) + var meth = parent(proto, name) return meth instanceof Function ? - meth.call(...c) + meth.call(...( typeof(name) == typeof('str') ? + [...arguments].slice(2) + : [...arguments].slice(1) )) : undefined } diff --git a/package.json b/package.json index b69e643..ccf4f28 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-object", - "version": "2.5.0", + "version": "2.5.1", "description": "", "main": "object.js", "scripts": {