🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@ericgio/distance-utils

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ericgio/distance-utils

A set of utilities for converting and formatting distances.

0.1.1
latest
Source
npm
Version published
Maintainers
1
Created
Source

distance-utils

A set of utilities for converting and formatting distances.

npm version npm downloads build status Coveralls github MIT License

Installation

npm install --save @ericgio/distance-utils

or

yarn add @ericgio/distance-utils

Functions

formatDistance

Formats distance measurements, by stripping trailing zeroes and restricting floats to at most 2 decimal places.

formatDistance(1.3333) // => '1.33'
formatDistance(1.00)   // => '1'

round

Rounds a number to a specified level of precision. Similar to Lodash's round function.

round(4.006)    // => 4
round(4.006, 2) // => 4.01
round(4060, -2) // => 4100

milesToKm

Converts miles to kilometers.

milesToKm(6.21)     // => 10
milesToKm(6.21, 1)  // => 10.0

metersToMiles

Converts meters to miles.

metersToMiles(10000)    // => 6.21
metersToMiles(10000, 1) // => 6.2

metersToFeet

Converts meters to feet.

metersToFeet(1582)  // => 5190
metersToFeet(1, 2)  // => 3.28

License

MIT

FAQs

Package last updated on 09 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts