Function inScope

  • Check if a given value is within a defined scope (inclusive of the scope's boundaries).

    Parameters

    • value: number

      The value to check.

    • scopeValue: number[] = ...

      An array defining the range [min, max] where value should be compared against.

    Returns boolean

    Example

    inScope(0, [0, 1]); // => true
    inScope(1, [0, 1]); // => true
    inScope(2, [0, 1]); // => false
    inScope(-1, [0, 1]); // => false