Class: Farr

Farr


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

Source:

<static> nonTerminalKeys

array containing the string keys of the non terminal functions

Source:

get head - get the first element

Source:

tail

get tail - get the last element

Source:

temporal

get temporal - get the temporal instance used by this instance

Source:

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

Source:
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

Source:
Tutorials:
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
    1. a starting value arg.s to be passed to all functions
Parameters:
Name Type Argument Default Description
arg object <optional>
{s: undefined}

argument

Source:
Tutorials:
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

Source:
Tutorials:
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
    1. 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

Source:
Tutorials:
Returns:

result of Promise.all call on this' function elements

Type
Promise

clearCommands()

reset the current this.#commands

Source:

commandJson()

get this.#commands as a JSON object]

Source:

halt()

halt current activities, including

  1. temporal tasks, and
  2. any timers
Source:

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...

Source:
Tutorials:
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
    1. a starting value arg.s to be passed to all functions
    2. a millisecond interval value arg.delay
Parameters:
Name Type Argument Default Description
arg object <optional>
{delay: 233, s: undefined}

argument

Source:
Tutorials:
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

Source:
Tutorials:
Returns:

this instance (Proxy)

Type
Farr