This package is a utility for working with various units of measurement in JavaScript/TypeScript. It includes two modules: SizeUnit
and TimeUnit
, which provide functions for converting values between different units of size and time, respectively.
To install the package, run the following command:
npm install @37bytes/units-helper
The SizeUnit
module contains the following functions:
-
getKilobytes(value: number)
: Returns the value in kilobytes for the given number. -
getMegabytes(value: number)
: Returns the value in megabytes for the given number. -
getGigabytes(value: number)
: Returns the value in gigabytes for the given number.
The TimeUnit
module contains the following functions:
-
getSeconds(value: number)
: Returns the value in seconds for the given number. -
getMinutes(value: number)
: Returns the value in minutes for the given number. -
getHours(value: number)
: Returns the value in hours for the given number. -
getDays(value: number)
: Returns the value in days for the given number. -
getWeeks(value: number)
: Returns the value in weeks for the given number.