New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

qselector

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qselector

A medium's like reading time estimator with internationalization support

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-78.95%
Maintainers
1
Weekly downloads
 
Created
Source

reading-time-estimator

Build Status Mutation testing badge

A medium's like reading time estimator with internationalization support.

Installation

with npm

npm install reading-time-estimator --save

or with Yarn

yarn install reading-time-estimator

API

The api is fairly simple. Here are the types definition for this module.

interface IOptions {
  wordsPerMinute?: number | null;
  locale?: string | null;
}

interface IReadingTime {
  text: string;
  minutes: number;
  time: number;
  words: number;
}

declare const readingTime: (
  data: string | null | undefined,
  opts?: IOptions | undefined,
) => IReadingTime;

export { readingTime, IOptions, IReadingTime };

If data, is null or undefined an error is thrown.

If either locale or wordsPerMinute is null an error is thrown.

Options are optional, if not defined they will fallback to their default value :

const defaultOpts: IOptions = {
  wordsPerMinute: 200,
  locale: 'en',
};

At the moment there is only 3 supported locales: en, fr and es. If a locale does not exist, it will fallback to en.

Usage

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

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

// result: {
//    text: '409 min. read',
//    minutes: 408.615,
//    time: 24516900,
//    words: 81723
//  }

// with french locale
const result = readingTime(text, { locale: 'fr' });
// result: {
//    text: '409 min. de lecture',
//    minutes: 408.615,
//    time: 24516900,
//    words: 81723
//  }

TODOs

  • add more languages

Keywords

FAQs

Package last updated on 27 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc