dazscript-framework
Version:
The **DazScript Framework** is a TypeScript-based framework for writing Daz Studio scripts. It provides all the advantages of a typed language such as autocompletion, error checking, and method parameter documentation and hinting. The framework also inclu
11 lines (10 loc) • 382 B
text/typescript
export const tryParse = (input: string): { valid: boolean, value: number } => {
const parsedValue = Number(input);
if (isNaN(parsedValue)) {
return { valid: false, value: 0 }
}
return { valid: true, value: parsedValue }
}
export const clamp = (value: number, min: number, max: number): number => {
return Math.min(Math.max(value, min), max);
}