Skip to content

Instantly share code, notes, and snippets.

@koss-lebedev koss-lebedev/clamp.ts
Last active Oct 11, 2019

Embed
What would you like to do?
const clamp = (value: number, clampAt: number = 30) => {
if (value > 0) {
return value > clampAt ? clampAt : value;
} else {
return value < -clampAt ? -clampAt : value;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.