Giter Site home page Giter Site logo

emoji-reading-time's Introduction

reading-time-emoji Build Status gzip size

Format article reading time into emoji

Install

npm install reading-time-emoji

Usage

const formatReadingTime = require('reading-time-emoji');

formatReadingTime(10);
//=> ☕☕ 10 min read

formatReadingTime(50);
//=> 🍱🍱🍱🍱🍱 50 min read

formatReadingTime(10, { short: '🍰', long: '🎂' });
//=> 🍰🍰 10 min read

formatReadingTime(50, { short: '🍰', long: '🎂' });
//=> 🎂🎂🎂🎂🎂 50 min read

API

formatReadingTime(minutes, [options])

Format article reading time into emoji.

minutes

Type: number

Accepts an article's reading time in minutes.

options

Type: object

Default: { short: '☕', long: '🍱', base: 5 }

short

Type: string

Default: '☕'

Represents a unit of emoji equivalent to 5 minutes of reading time.

'☕' emoji = 5 minutes
long

Type: string

Default: '🍱'

For long articles with reading time greater than base(Default: 5) units of emoji, long unit of emoji is equivalent to 10 minutes of reading time.

'🍱' emoji = 10 minutes
base

Type: number

Default: 5

A default base value for a unit of emoji.

Inspiration

Heavily inspired by Dan Abramov's Overreacted blog articles reading time format.

License

MIT © Dutiyesh Salunkhe

emoji-reading-time's People

Contributors

dutiyesh avatar

Stargazers

Nikola Hristov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.