Skip to content

Instantly share code, notes, and snippets.

@elpddev
Created November 15, 2022 08:01
Show Gist options
  • Select an option

  • Save elpddev/9b6b20828abcefaacdde368758841b9f to your computer and use it in GitHub Desktop.

Select an option

Save elpddev/9b6b20828abcefaacdde368758841b9f to your computer and use it in GitHub Desktop.

Revisions

  1. elpddev created this gist Nov 15, 2022.
    2 changes: 2 additions & 0 deletions clamp.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    const clamp = (min: number, max: number, val: number) =>
    Math.max(min, Math.min(val, max));