Skip to content

betweenThan

The betweenThan() method checks whether a number is inside an exclusive interval. It can be used in a curried way to ease functional composition.

Interactive example

Syntax

Classic signature

typescript
function betweenThan<
	GenericInput extends number
>(
	input: GenericInput,
	greaterThan: number,
	lessThan: number
): boolean

Curried signature

typescript
function betweenThan<
	GenericInput extends number
>(
	greaterThan: number,
	lessThan: number
): (input: GenericInput) => boolean

Parameters

  • input: The number to evaluate (classic signature only).
  • greaterThan: The exclusive lower bound.
  • lessThan: The exclusive upper bound.

Return value

returns true if input is within the interval ]greaterThan, lessThan[, false otherwise.

See also

  • between - Checks whether a number is inside an inclusive interval
  • greaterThan - Checks whether a number is strictly greater (>)
  • lessThan - Checks whether a number is strictly less (<)

Released under the MIT license.