npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@untemps/read-per-minute

v3.0.0

Published

Class to parse a string and return an estimated reading time based on a lang rate

Downloads

21

Readme

@untemps/read-per-minute

Class to parse a long text and return an estimated reading time based on a lang rate.

npm GitHub Workflow Status Codecov

Installation

yarn add @untemps/read-per-minute

Usage

Import ReadPerMinute:

import { ReadPerMinute } from '@untemps/read-per-minute'

Create an instance of ReadPerMinute:

const rpm = new ReadPerMinute()

Call the parse method with a string and a lang:

rpm.parse('Long text', 'en')

Get the parsed values:

const estimatedReadingTime = rpm.time
const numberOfWords = rpm.words
const langRate = rpm.rate

Alternative Use with Custom Rates

Override all the values

You can specify an entire custom rates object in the constructor of an instance:

const customRates = {
	default: 220,
	ar: 191,
	zh: 255,
	nl: 234,
	en: 244,
}
const rpm = new ReadPerMinute(customRates)

NOTE: Set a default property in the object if you want the parsing to fallback to a specific value.
Otherwise, the static value will be used (ReadPerMinute.rates.default).

Override the value for a one-time parsing

Simply pass the desired custom reading rate in words per minute instead of a language code:

// For very fast readers: 425 words per minute.
rpm.parse('Long text', 425)

NOTE: The custom reading rate must be greater than zero or the default value will be used.

Rates

Reading rates by lang come from "How many words do we read per minute? A review and meta-analysis of reading rate" by Marc Brysbaert - Department of Experimental Psychology Ghent University

| Lang | Rate | | ------- | ---- | | default | 200 | | ar | 181 | | zh | 260 | | nl | 228 | | en | 236 | | fi | 195 | | fr | 214 | | de | 260 | | he | 224 | | it | 285 | | ko | 226 | | es | 278 | | sv | 218 |

If the lang is not listed or is undefined, the default value will be used.