ixfx
    Preparing search index...

    Type Alias SingleFromArrayOptions<V>

    type SingleFromArrayOptions<V> = {
        at: number;
        order: "default" | "random" | ((a: V, b: V) => number);
        predicate: (value: V) => boolean;
    }

    Type Parameters

    • V
    Index

    Properties

    Properties

    at: number

    Selects an index from array. 0 being first, 1 being second. Reverse indexing also works: -1 being last, -2 being second last...

    If index exceeds length of array, undefined is returned

    order: "default" | "random" | ((a: V, b: V) => number)

    default: leave array in same order (default option) random: shuffles array before further processing function: function that sorts values

    predicate: (value: V) => boolean

    Function to select a single value from array

    Type declaration

      • (value: V): boolean
      • Parameters

        • value: V

        Returns boolean