new Farr( [arr])
constructor - create a Farr instance
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
arr |
Array | number |
<optional> |
if an Array, its elements will be used to populate the new instance. if a number, it sets the instance's length -- Array |
- Source:
- Tutorials:
Returns:
this instance (Proxy)
- Type
- Array
Extends
- Array
Members
-
<static> baseCommands
-
the default commands
-
<static> nonTerminalKeys
-
array containing the string keys of the non terminal functions
-
head
-
get head - get the first element
-
tail
-
get tail - get the last element
-
temporal
-
get temporal - get the temporal instance used by this instance
Methods
-
<static> isSafeIndex(d)
-
determine whether a number d can be used as an array index
Parameters:
Name Type Description d
Number the number to test
Returns:
true if d is a usable array index
- Type
- Boolean
-
after( [t])
-
after - schedule the next terminal command to occur after t milliseconds
- chainable
Parameters:
Name Type Argument Description t
String | Number <optional>
the millisecond delay after which the next terminal command should occur...if a non-Number object is provided, it will be cast to Number
Returns:
this instance (Proxy)
- Type
- Farr
-
<async> all( [arg])
-
async all - A unary asynchronous instance method that
- calls functions in order,
- resolves when all the functions called return, and
- accepts a parameter arg that contains
- a starting value arg.s to be passed to all functions
Parameters:
Name Type Argument Default Description arg
object <optional>
{s: undefined} argument
Returns:
result of Promise.all call on this' function elements
- Type
- Promise
-
at( [t])
-
at - schedule the next terminal command to occur at date/time t
- chainable
Parameters:
Name Type Argument Description t
String | Number | date | dayjs <optional>
the date/time at which the next terminal command should occur...if a non-dayjs object is provided, it will be cast to dayjs
Returns:
this instance (Proxy)
- Type
- Farr
-
<async> cascade( [arg])
-
async cascade - A unary asynchronous instance method that
- calls functions in order,
- accepts a parameter arg that contains
- a starting value arg.s to be passed to the first function
- mutates the given start value
Parameters:
Name Type Argument Default Description arg
object <optional>
{s: undefined} argument
Returns:
result of Promise.all call on this' function elements
- Type
- Promise
-
clearCommands()
-
reset the current this.#commands
-
commandJson()
-
get this.#commands as a JSON object]
-
halt()
-
halt current activities, including
- temporal tasks, and
- any timers
-
nCycles( [n])
-
nCycles - schedule the next terminal command to occur n times
- chainable
Parameters:
Name Type Argument Default Description n
Number <optional>
1 the number of times the next terminal command should occur...
Returns:
this instance (Proxy)
- Type
- Farr
-
<async> periodic( [arg])
-
async periodic - A unary asynchronous instance method that
- calls functions in order,
- accepts a parameter arg that contains
- a starting value arg.s to be passed to all functions
- a millisecond interval value arg.delay
Parameters:
Name Type Argument Default Description arg
object <optional>
{delay: 233, s: undefined} argument
Returns:
eventual result of call on this' function elements
- Type
- Promise
-
premap( [f])
-
premap - set a function that maps any value given to it
- chainable
Parameters:
Name Type Argument Description f
function <optional>
the mapping function. called with the value, should return something
Returns:
this instance (Proxy)
- Type
- Farr