We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3bb6318 commit e782e4eCopy full SHA for e782e4e
src/constants/index.ts
@@ -0,0 +1,2 @@
1
+// Assuming average reading speed of 200 words per minute
2
+export const WORDS_PER_MINUTE = 200;
src/utils/estimateReadingTime.ts
@@ -1,11 +1,10 @@
+import { WORDS_PER_MINUTE } from '../constants';
+
3
/**
4
* Estimates the reading time of the text in seconds.
5
* @param {number} wordCount - The number of words in the text.
6
* @returns {number} The estimated reading time of the text in seconds.
7
*/
8
export function estimateReadingTime(wordCount: number): number {
- // Assuming average reading speed of 200 words per minute
- const wordsPerMinute = 200;
9
-
10
- return Math.ceil(wordCount / (wordsPerMinute / 60));
+ return Math.ceil(wordCount / (WORDS_PER_MINUTE / 60));
11
}
0 commit comments