@mikuroxina/mini-fn
    Preparing search index...

    Function findIndices

    • Finds the positions of element which satisfies pred in the list. If the list is infinite, this will hang forever.

      Type Parameters

      • T

      Parameters

      • pred: (value: T) => boolean

        The match condition of element to find.

      Returns (list: List.List<T>) => number[]

      The found positions.

      Examples

      const list = fromArray([1, 4, 2, 3, 5]);

      expect(findIndices((x: number) => 4 <= x)(list)).toStrictEqual([1, 4]);
      expect(findIndices((x: number) => 0 <= x)(list)).toStrictEqual([0, 1, 2, 3, 4]);
      expect(findIndices((x: number) => 8 <= x)(list)).toStrictEqual([]);