ts-data-forge
    Preparing search index...
    • Returns a new array with elements in the specified range replaced by the specified value.

      Type Parameters

      • const Ar extends readonly unknown[]
      • const V

      Parameters

      • array: Ar
      • value: V
      • fillRange: readonly [ArgArrayIndexWithNegative<Ar>, ArgArrayIndexWithNegative<Ar>]

      Returns IsFixedLengthList<Ar> extends true
          ? MakeTupleImpl<V | Ar[number], `${Ar["length"]}`, []>
          : Ar extends readonly [unknown, unknown]
              ? readonly [V | Ar<Ar>[number], V | Ar<Ar>[number]]
              : readonly (V | Ar[number])[]

      const base = [0, 1, 2, 3, 4];

      const filledMiddle = Arr.toRangeFilled(base, 9, [1, 4]);
      const filledPrefix = Arr.toRangeFilled(8, [0, 2])(base);

      assert.deepStrictEqual(filledMiddle, [0, 9, 9, 9, 4]);
      assert.deepStrictEqual(filledPrefix, [8, 8, 2, 3, 4]);
    • Returns a new array with elements in the specified range replaced by the specified value.

      Type Parameters

      • const V

      Parameters

      • value: V
      • fillRange: readonly [ArgArrWithNegative, ArgArrWithNegative]

      Returns <const Ar extends readonly unknown[]>(
          array: Ar,
      ) => IsFixedLengthList<Ar> extends true
          ? MakeTupleImpl<V | Ar[number], `${Ar["length"]}`, []>
          : Ar extends readonly [unknown, unknown]
              ? readonly [V | Ar<Ar>[number], V | Ar<Ar>[number]]
              : readonly (V | Ar[number])[]

      const base = [0, 1, 2, 3, 4];

      const filledMiddle = Arr.toRangeFilled(base, 9, [1, 4]);
      const filledPrefix = Arr.toRangeFilled(8, [0, 2])(base);

      assert.deepStrictEqual(filledMiddle, [0, 9, 9, 9, 4]);
      assert.deepStrictEqual(filledPrefix, [8, 8, 2, 3, 4]);