0.4.2 • Published 7 years ago

mr-time v0.4.2

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

Build Status Coverage Status npm

Mr. Time 👨🏻🕑

Description

Mr. Time provides better code readibility than random numbers representing amounts of time scattered through your code.

Ever needed to provide a timeout to a function call and had to google 'How many milliseconds in 24 hours'. Your options are:

Bad

setTimeout(myMethod, 86400000); // Nobody will have any idea how long this is

Better

const TWENTY_FOUR_HOURS_IN_MILLISECONDS = 86400000; // I still had to google to get this number first...

setTimeout(myMethod, TWENTY_FOUR_HOURS_IN_MILLISECONDS);

⭐ Best⭐

let T = require('mr-time');

setTimeout(myMethod, T(24).hours.in.milliseconds); // No googling, easy to read, everyones happy

Installation

npm install mr-time

yarn add mr-time

Usage

let T = require('mr-time');
  
let oneDayInMilliseconds = T(1).days.in.milliseconds; // returns 86400000
let twoWeeksInSeconds = T(2).weeks.in.seconds; // returns 1210000

Upcoming

  • Add month, year, decade, century, nanoseconds etc
0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago