Skip to content

Instantly share code, notes, and snippets.

@js2me
Created December 22, 2021 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save js2me/05d60e9d65719c995fdb855deed5a7ba to your computer and use it in GitHub Desktop.
Save js2me/05d60e9d65719c995fdb855deed5a7ba to your computer and use it in GitHub Desktop.
clamp algorithm on typescript
export const clamp = (num: number, min: number, max: number): number =>
Math.max(min, Math.min(max, num))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment