Skip to content

yocontra/pretty-imperial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pretty-imperial Build Status

Parse, convert, and humanize imperial sizes

Install

$ npm install pretty-imperial

Usage

const prettyImperial = require('pretty-imperial')

prettyImperial(15000).humanize()
// => 2.84mi

prettyImperial(.5).humanize()
// => 6in

// Using input types
prettyImperial(120).input('in').humanize()
// => 10ft

Functions

.mi(), .ft(), .in()

Converts the input measurement to the corresponding output

Default input measurement type is foot. It can be changed with .input()

prettyImperial(1).in()
// => 0.12ft

humanize()

Converts the input value to a more human recognizable size

prettyImperial(120).humanize()
// => 120ft

input()

Sets the input value to a particular imperial type

This can be chained with humanize()

prettyImperial(1500).input('in').ft()
// => 125ft

Supported sizes

mi: mile  - 5280ft
ft: foot - 12in
in: inch - 1/12ft

License (MIT)

About

Parse, convert, and humanize imperial sizes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published