Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lbenie/reading-time-estimator
A medium's like reading time estimator with internationalization support
https://github.com/lbenie/reading-time-estimator
es6 estimator i18n javascript javascript-library medium reading reading-time time typescript typescript-library
Last synced: 5 days ago
JSON representation
A medium's like reading time estimator with internationalization support
- Host: GitHub
- URL: https://github.com/lbenie/reading-time-estimator
- Owner: lbenie
- Created: 2018-07-24T15:36:37.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-01-15T05:56:48.000Z (12 days ago)
- Last Synced: 2025-01-15T06:58:35.930Z (12 days ago)
- Topics: es6, estimator, i18n, javascript, javascript-library, medium, reading, reading-time, time, typescript, typescript-library
- Language: TypeScript
- Homepage: https://lbenie.xyz
- Size: 6.97 MB
- Stars: 45
- Watchers: 4
- Forks: 13
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/funding.yml
Awesome Lists containing this project
README
# reading-time-estimator
![Test](https://github.com/lbenie/reading-time-estimator/workflows/Test/badge.svg)
![Lint](https://github.com/lbenie/reading-time-estimator/workflows/Lint/badge.svg)
![Semantic Release](https://github.com/lbenie/reading-time-estimator/workflows/Semantic%20Release/badge.svg)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![npm](https://img.shields.io/npm/l/reading-time-estimator.svg)](https://github.com/lbenie/reading-time-estimator/blob/main/LICENSE)
[![npm](https://img.shields.io/npm/dt/reading-time-estimator.svg)](https://www.npmjs.com/package/reading-time-estimator)
[![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/reading-time-estimator.svg)](https://www.npmjs.com/package/reading-time-estimator)[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-)
[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com)
[![forthebadge](https://forthebadge.com/images/badges/made-with-typescript.svg)](https://forthebadge.com)
[![forthebadge](https://forthebadge.com/images/badges/uses-badges.svg)](https://forthebadge.com)A [medium](https://medium.com/)'s like reading time estimator with
internationalization support.## Documentation
Reading Time Estimator was created to provide an estimate of how long to read an
article or blog as seen on [medium](https://medium.com/).### Installation
With NPM
```bash
npm install reading-time-estimator
```or Yarn
```bash
yarn add reading-time-estimator
```### API
The api is fairly simple. Here are the types definition for this module.
It is a simple function that takes the data as a required argument with the words per minute and locale as optional arguments.
Per default the locale is set to english `en`.
Per default the word per minute is set to `300`.
At the moment there is only 12 supported locales: `en`, `fr`, `es`, `pt-br`, `cn`, `ja`, `de`, `tr`, `ro`, `bn`, `sk` and `cs`.
### Usage
Try it live [here](https://codesandbox.io/s/condescending-rosalind-lll23r?file=/src/App.tsx)
```typescript
import { readingTime } from 'reading-time-estimator'const text = 'some text to parse'
// default options
const result = readingTime(text, 10)// output:
// {
// minutes: 4,
// words: 43,
// text: `4 min read`
// }// with french locale
const result = readingTime(text, 10, 'fr')// output:
// {
// minutes: 4,
// words: 43,
// text: `4 min de lecture`
// }
```## Why Not ...?
### reading-time
This [package](https://www.npmjs.com/package/reading-time) does not offer
internationalization support which was a must for me.## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Lucien Bénié
💻 📖
Victor Sierra
💻
ZhangC
💻
Rich11
💻 📖
Matheus Oliveira
💻
Can Güven
💻
Alexander Strutz
💻
凝结尾迹
💻
Muhammad Faisal Amin
💻
Oliver Groma
💻
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!