UNPKG

nhz.lib

Version:
12 lines (11 loc) 428 B
module.exports = function(rectangle, point) { var px, py, rh, rw, rx, ry; if (((rectangle != null ? rectangle.length : void 0) === 4) && ((point != null ? point.length : void 0) === 2)) { rx = rectangle[0], ry = rectangle[1], rw = rectangle[2], rh = rectangle[3]; px = point[0], py = point[1]; if ((px >= rx) && (px <= rx + rw) && (py >= ry) && (py <= ry + rh)) { return true; } } return false; };