Skip to content

number

Utilities in the number category.

  • clamp — Constrains a numeric value between specified minimum and maximum boundaries.
  • getAspectRatio — Computes the aspect ratio from given dimensions.
  • getRandomNumber — Returns a random integer within the given inclusive range.
  • scaleByAspectRatio — Scales dimensions while preserving aspect ratio to a target width or height.
  • toPercentage — Converts a numeric value to a percentage relative to a given base.