mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
move getAverage to util
This commit is contained in:
parent
60d3bf1718
commit
85b8050cc5
2 changed files with 8 additions and 5 deletions
|
@ -386,6 +386,11 @@ export const formatTime = (mseconds: number): string => {
|
|||
? `${mseconds} ms`
|
||||
: `${(mseconds / 1000).toFixed(1)} s`;
|
||||
};
|
||||
|
||||
export const getAverage = (arr: Array<number>): number => {
|
||||
return arr.reduce((sum, currentVal) => sum + currentVal) / arr.length;
|
||||
};
|
||||
|
||||
// Adapted from https://github.com/Modernizr/Modernizr/blob/master/feature-detects/emoji.js
|
||||
export const supportsEmoji = () => {
|
||||
const canvas = document.createElement("canvas");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue