Skip to content

Commit c0a9f1c

Browse files
committed
update readtime speed
1 parent 0fbdfc6 commit c0a9f1c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/utils/readtime.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ const stripHtml = async (text: string) => {
1717
*
1818
* Calculates the reading time of a ReactNode in minutes
1919
*/
20-
export const calculateReadtime = async (node: ReactNode, wpm: number = 200): Promise<number> => {
21-
if (isBrowser) throw Error("calculateReadtime can only be used on the server")
20+
export const calculateReadtime = async (node: ReactNode, wpm: number = 160): Promise<number> => {
21+
if (isBrowser) throw Error("calculateReadtime can only be used on the server");
2222
const { reactNodeToString } = await import("./react");
2323

2424
const content = await stripHtml(await reactNodeToString(node));
2525
const words = content.split(/[\s]+/);
26+
2627
return Math.round(words.length / wpm);
2728
};
2829

0 commit comments

Comments
 (0)