@37bytes/units-helper
v1.0.0
Published
A package for easier usage and conversion of different units
Downloads
6
Readme
@37bytes/units-helper
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.
Installation
To install the package, run the following command:
npm install @37bytes/units-helper
Usage
SizeUnit
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.
TimeUnit
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.