ts-data-forge
    Preparing search index...

    Function isInRangeInclusive

    • Creates a function that checks if a number x is within the range lowerBound <= x <= upperBound.

      Parameters

      • lowerBound: number

        The lower bound (inclusive).

      • upperBound: number

        The upper bound (inclusive).

      Returns (x: number) => boolean

      A function that takes a number x and returns true if x is in the range, false otherwise.

      const isPercentage = Num.isInRangeInclusive(0, 100);

      assert.ok(isPercentage(100));
      assert.notOk(isPercentage(-1));