Skip to content

Commit

Permalink
feat(🧮): avg() (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Oct 22, 2020
1 parent 346074f commit 2b84eb5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 2b84eb5

Please sign in to comment.