ts-data-forge
    Preparing search index...
    • Checks if an array's length is within a specific inclusive range.

      Type Parameters

      Parameters

      • min: Min
      • max: Max
      • array: readonly E[]

      Returns array is BoundedLengthTuple<Min, Max, E>

      const pair: readonly number[] = [1, 2] as const;

      const quad: readonly number[] = [1, 2, 3, 4] as const;

      assert.isTrue(Arr.isBoundedLengthTuple(1, 3, pair));

      assert.isFalse(Arr.isBoundedLengthTuple(1, 3, quad));

      if (Arr.isBoundedLengthTuple(1, 3, pair)) {
      assert.isTrue(pair.length >= 1 && pair.length <= 3);
      }
    • Checks if an array's length is within a specific inclusive range.

      Type Parameters

      Parameters

      Returns <E>(array: readonly E[]) => array is BoundedLengthTuple<Min, Max, E>

      const pair: readonly number[] = [1, 2] as const;

      const quad: readonly number[] = [1, 2, 3, 4] as const;

      assert.isTrue(Arr.isBoundedLengthTuple(1, 3, pair));

      assert.isFalse(Arr.isBoundedLengthTuple(1, 3, quad));

      if (Arr.isBoundedLengthTuple(1, 3, pair)) {
      assert.isTrue(pair.length >= 1 && pair.length <= 3);
      }