Download Reactive-Resume/libs/utils/src/namespaces/number.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 274 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Reactive-Resume/libs/utils/src/namespaces/number.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Reactive-Resume/libs/utils/src/namespaces/number.ts
-
curl -L -o number.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Reactive-Resume/libs/utils/src/namespaces/number.ts
274 Bytes
| export const linearTransform = ( | |
| value: number, | |
| inMin: number, | |
| inMax: number, | |
| outMin: number, | |
| outMax: number, | |
| ) => { | |
| if (inMax === inMin) return value === inMax ? outMin : Number.NaN; | |
| return ((value - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin; | |
| }; | |