1.0.4 • Published 3 years ago

@yehonadav/timeunit v1.0.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

timeunit

install

npm i @yehonadav/timeunit

stop using syntax const wait = 24 * 60 * 60 * 1000 to represent time units.
use a time unit instead:

usage

import {seconds} from "@yehonadav/timeunit"

function sleep(milliseconds) {
  return new Promise(resolve => setTimeout(resolve, milliseconds))
    .then(() => {
      console.log(`waited ${milliseconds/second} seconds`)
    })
}

sleep(60 * seconds)

enjoy =)