Checks if the given value is in the rectangular range of [0, width] and [0, height]

Type signature

(width: number, height: number) => ((x: number, y: number) => boolean)

Examples

inRectangleRange(50, 100)(25, 50);
// ⇒ true
Try in REPL
inRectangleRange(50, 100)(-25, 50);
// ⇒ false
Try in REPL

Questions

  • How to check if a point is inside a rectangle defined by width and height?

TypeScript sourceJavaScript source