File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments