1.0.4 • Published 1 year ago

@gladney/convert v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

:left_right_arrow: @gladney/convert

Utility library that performs commonly needed conversions.

Helpful tips

  • All methods that return numerical values can accept {float: n} as a parameter in the last method of the chain, where n is the number of float places. Example:
convertLength(2).miles().toKilometers() // 3.218688

convertLength(2).miles().toKilometers({ float: 2 }) // 3.22

convertLength(2).miles().toKilometers({ float: 0 }) // 3

Methods

convertString

String from one casing to another. Starting case is detected automatically.

Example:

convertCase("helloWorld").toPascalCase() // "HelloWorld"

convertTemperature

Temperature from/to Celsius/Fahrenheit Example:

convertTemperature(100).celsius().toFahrenheit() // 212
convertTemperature(32).fahrenheit().toCelsius() // 0

convertLength

Length from one unit to another (metric or imperial)

Example:

convertLength(2).miles().toKilometers() // 3.218688

convertTime

Length from one unit to another (metric or imperial)

Example:

convertTime(2).weeks().toMinutes() // 20160
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago