more cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-04-30 02:10:01 +03:00
parent 9fed68370b
commit aea2355520
3 changed files with 8 additions and 14 deletions

View File

@ -214,8 +214,8 @@ parent(<method>, <this>)
Get parent method and call it
```
parentCall(<method>, <this>)
parentCall(<prototype>, <name>, <this>)
parentCall(<method>, <this>)
-> <result>
-> undefined
```

View File

@ -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 }

View File

@ -1,6 +1,6 @@
{
"name": "ig-object",
"version": "2.5.0",
"version": "2.5.1",
"description": "",
"main": "object.js",
"scripts": {