1.0.0 • Published 7 years ago

reading_time v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Reading Time

Inspired by Medium, Reading Time is a simple, javascript snippet used to display an estimated time to read some text.

Rewrite of https://github.com/michael-lynch/reading-time (removes jquery and DOM manipulation, usable in Nodejs as well)

##Usage##

var $element = document.querySelector('.eta');
var text = 'Some text here';
var options = {}; // see available options below

var timing = readingTime(text, options);

//
// readingTime returns an object with:
//
//  readingTime (the estimated time it will take to read the article)
//  wordCount   (count of all words)
//

$element.text = timing.readingTime;

##Options##

  • wordsPerMinute: WPM as part of the calculation (defaults: 270)
  • round: round up
  • lang: en/fr/de/es/nl/sk/cz