Advertisement
mrkmg

Untitled

Nov 29th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Simple
  2.  
  3. function inRange(x, min, max)
  4. {
  5.     return x >= min && x <= max;
  6. }
  7.  
  8. image.width = 10;
  9. image.height = 10;
  10. limits.minWidth = 5;
  11. limits.maxWidth = 5;
  12. limits.minHeight = 5;
  13. limits.maxHeight = 5;
  14.  
  15. if (!inRange(image.width, limits.minWidth, limits.maxWidth) ||
  16.     !inRange(image.height, limits.minHeight, limits.maxHeight)) {
  17.     throw new Error("Image incorrect size");
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement