minutes-to-read
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published


Read time is based on the average reading speed of an adult (roughly 265 Words per minutes according to a Medium's article.

Install

$ npm install minutes-to-read

Usage

const m2r = require('minutes-to-read');
 
m2r('Lorem ipsum');
// => less than a min to read
 
m2r('Lorem ipsum', 'minute');
// => less than a minute
 
const longText = 'Lorem ipsum dolor sit am...' // 500 words 
 
m2r(longText, 'minutes to finish');
// => 2 minutes to finish
 
m2r(longText, 'minutes to read if your reading rate is 2 wpm', 2);
// => 250 minutes to read if your reading rate is 2 wpm

API

m2r(text)

  • text (string): A paragraph, easy or sentence
Example:
m2r('Lorem ipsum');
// => less than a minute
 
 
m2r('Lorem ipsum dolor sit am...'); // 500 words 
// => 2 minutes to finish

m2r(text, customText)

  • text (string): A paragraph, easy or sentence
  • customText (string): A custom text you want to add
Example:
m2r('Lorem ipsum', 'minute to finish');
// => less than a minute to finish

m2r(text, customText, wpm)

  • text (string): A paragraph, easy or sentence
  • customText (string): A custom text you want to add
  • wpm (number): Custom words per minutes
Example:

For a 250 text at 2 words per minutes it will take 250 minutes.

m2r('Lorem ipsum dolor sit am...', 'minutes to finish', 2); // 500 words 
// => 250 minutes to finish

m2r(text,wpm)

  • text (string): A paragraph, easy or sentence
  • wpm (number): Custom words per minutes
Example:

For a 2 words text reading a word per minute it will take 2 minutes.

m2r('Lorem ipsum', 1);
// => 2 min to read

Team

Carlos Araham

License

MIT License © Carlos Abraham

Package Sidebar

Install

npm i minutes-to-read

Weekly Downloads

9

Version

1.1.0

License

MIT

Unpacked Size

6.29 kB

Total Files

6

Last publish

Collaborators

  • abranhe