ts-data-forge
    Preparing search index...
    • Creates a new array of the specified length, filled with the initial value.

      Type Parameters

      • const V
      • N extends ArgArr

      Parameters

      • len: N
      • init: V

      Returns N extends | 0
      | 1
      | 2
      | 3
      | 4
      | 5
      | 6
      | 7
      | 8
      | 9
      | 10
      | 11
      | 12
      | 13
      | 14
      | 15
      | 16
      | 17
      | 18
      | 19
      | 20
      | 21
      | 22
      | 23
      | 24
      | 25
      | 26
      | 27
      | 28
      | 29
      | 30
      | 31
      | 32
      | 33
      | 34
      | 35
      | 36
      | 37
      | 38
      | 39
          ? MakeTupleImpl<V, `${N<N>}`, []>
          : N extends ArgArrPositive ? readonly [V, V] : readonly V[]

      const threeOnes = Arr.create(3, 1);
      const emptyStrings = Arr.create(0, 'Ada');

      assert.deepStrictEqual(threeOnes, [1, 1, 1]);
      assert.deepStrictEqual(emptyStrings, []);