Specification
This module exports a single class, LinkedFuncList.
Instance Properties:
1. next
- a. is
nullby default - b. can only have a value of
null, or- an instance of
LinkedFuncList, self-inclusive
2. func
- a. is
nullby default - b. can only have a value of
null, or- an
objectof typefunction
3. [Symbol.iterator]
- a. returns a
generator functionthat produces the ordered unique set ofnextproperties- A. starting with this
LinkedFuncListinstance, - B. continuing with all
LinkedFuncListinstances linked vianext, and - C. terminating before any
nextwhose value is- i.
null, or - j. this (starting)
LinkedFuncListinstance.
- i.
- A. starting with this
4. chainCall
- a. is an
asynchronous functionthat accepts anystartargument, anyendargument - b. returns a
Promisecorresponding to the ordered set of chained calls to uniquefuncproperties of thenextproperties of theLinkedFuncListwhere- A. the starting function recieves the
startargument - B. each function called in the
Promiserecieves the result of the previous function in the chain - C. the functions are called with their
thisvalues set to thisLinkedFuncListinstance (the initiator of the traversal - D. errors thrown in the functions cause the
Promiseto reject - E. the order of the calls to the functions corresponds to the order of iteration produced by
this[Symbol.iterator]even if the functions are asynchronous - F. any
funcproperties having non-function values will be replaced with a passthrough function that preserves the recieved value supplied to it
- A. the starting function recieves the
- c. if the
endargument is afunction, it is called at the end of the chain's execution with the chain's result
5. callAll
- a. is an
asynchronous functionthat accepts anystartargument, - b. returns a
Promisecorresponding to the ordered set of calls to uniquefuncproperties of thenextproperties of theLinkedFuncListwhere- A. all functions recieve the
startargument - B. the functions are called with their
thisvalues set to thisLinkedFuncListinstance (the initiator of the traversal - C. errors thrown in the functions cause the
Promiseto reject - D. any
funcproperties having non-function values will be replaced with a passthrough function that preserves the recieved value supplied to it
- A. all functions recieve the
6. link
- a. is a
functionthat accepts any number of arguments - b. substitutes passthrough functions for arguments that are not
functionobjects, orLinkedFuncListinstances
- c. creates a chained list of
LinkedFuncListinstances where- A. the first element in the chain is this instance (the caller)
- B. the order of the elements in the chain correspond to the order of arguments supplied to the
linkfunction - C.
function-valued arguments are replaced with newLinkedFuncListinstances whosefuncproperties correspond to the argument being replaced
7. length
- a. is a
numberalways greater than 0 - b. reveals the number of
LinkedFuncListinstances in this list, including this current instance
