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 26bac28 commit fc4dc68Copy full SHA for fc4dc68
src/lib/utils/reading-time.ts
@@ -0,0 +1,9 @@
1
+export const readingTime = (text: string): { time: string; words: number } => {
2
+ const wordsPerMinute = 200;
3
+ const words = text.split(/\s+/g).length;
4
+ const minutes = Math.ceil(words / wordsPerMinute);
5
+ return {
6
+ time: `${minutes} min read`,
7
+ words,
8
+ };
9
+};
0 commit comments