DEV Community

Lucien Bénié
Lucien Bénié

Posted on

reading-time-estimator

What I built

A small library that parses a text and estimates how long it would take to read it with i18n support. Written in TypeScript, you get typing for free!

Usage

import { readingTime } from 'reading-time-estimator';

const text = `Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.`


// default options
const result = readingTime(text, 10);

output:
{
  "minutes": 10,
  "words": 97,
  "text": "10 min read"
}


// with french locale
const result = readingTime(text, 10, 'fr');

output:
{
  "minutes": 10,
  "words": 97,
  "text": "10 min de lecture"
}
Enter fullscreen mode Exit fullscreen mode

Demo Link

Here's a demo link

Link to Code

Here's the repository link

Top comments (0)