Skip to content

Instantly share code, notes, and snippets.

@jebarjonet
Last active October 9, 2023 04:34
Show Gist options
  • Save jebarjonet/0f761a5dfd0dd4a5ba0ff9a3d011ac11 to your computer and use it in GitHub Desktop.
Save jebarjonet/0f761a5dfd0dd4a5ba0ff9a3d011ac11 to your computer and use it in GitHub Desktop.
Time needed for a human to read a text (in ms)
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