Function act

  • An abstract function that can combine any set of operations. Can be used in scenarios where the operations are not similar enough for the other more specialised functions: call, set or del.

    The functions to call may be specified statically or generated dynamically from Lazy instances. Similar arrays may be nested within the outermost one to any depth.

    Parameters

    Returns void | any[]

    Example

    import { act } from 'apption'
    let count = 0;
    const actions = [
    (a1, a2) => count += a1,
    (a1, a2) => count += a2,
    (a1, a2) => count += a2 + 1
    ]
    act(actions, 20, 21);
    console.log(count); // 63

    actions.pop();

    act(actions, 10, 20);
    console.log(count); // 93