Last active
October 9, 2023 04:34
-
-
Save jebarjonet/0f761a5dfd0dd4a5ba0ff9a3d011ac11 to your computer and use it in GitHub Desktop.
Time needed for a human to read a text (in ms)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { max, words } from 'lodash' | |
export const readingTime = (text) => { | |
const wordsPerMinute = 280 | |
const computedTime = (words(text).length * 60000) / wordsPerMinute | |
return max([2000, computedTime]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment