Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

human-format

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

human-format - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

21

index.js

@@ -280,3 +280,8 @@ // UMD: https://github.com/umdjs/umd/blob/master/returnExports.js

var power
var decimals = opts.decimals
if (decimals !== undefined) {
power = Math.pow(10, decimals)
}
var prefix = opts.prefix

@@ -290,15 +295,8 @@ var factor

factor = scale._prefixes[prefix]
value /= factor
if (decimals !== undefined) {
var p = Math.pow(10, decimals)
value = Math.round(value * p) / p
}
} else {
var _ref = scale.findPrefix(value)
factor = _ref.factor
if (decimals !== undefined) {
if (power !== undefined) {
do {
factor = _ref.factor
var r = Math.pow(10, decimals) / factor
var r = power / factor
value = Math.round(value * r) / r

@@ -310,3 +308,2 @@ } while ((_ref = scale.findPrefix(value)).factor !== factor)

value /= factor
prefix = _ref.prefix

@@ -317,3 +314,5 @@ }

prefix: prefix,
value: value
value: power === undefined
? value / factor
: Math.round(value * power / factor) / power
}

@@ -320,0 +319,0 @@ }

{
"name": "human-format",
"version": "0.9.0",
"version": "0.9.1",
"license": "ISC",

@@ -5,0 +5,0 @@ "description": "Converts a number to/from a human readable string: `1337` ↔ `1.34kB`",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc