diff --git a/src/Math.ts b/src/Math.ts index 65d061df..71b9a6cc 100644 --- a/src/Math.ts +++ b/src/Math.ts @@ -30,6 +30,15 @@ export const toRad = (deg: number) => { return (deg * Math.PI) / 180; }; +/** + * + * @summary Returns the average value + */ +export const avg = (values: number[]) => { + "worklet"; + return values.reduce((a, v) => a + v, 0) / values.length; +}; + /** * @summary Returns true if node is within lowerBound and upperBound. */