Socket
Socket
Sign inDemoInstall

pretty-bytes

Package Overview
Dependencies
0
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0 to 5.1.0

9

index.js

@@ -39,3 +39,8 @@ 'use strict';

if (options.signed && number === 0) {
return ' 0 B';
}
const isNegative = number < 0;
const prefix = isNegative ? '-' : (options.signed ? '+' : '');

@@ -48,3 +53,3 @@ if (isNegative) {

const numberString = toLocaleString(number, options.locale);
return (isNegative ? '-' : '') + numberString + ' B';
return prefix + numberString + ' B';
}

@@ -58,3 +63,3 @@

return (isNegative ? '-' : '') + numberString + ' ' + unit;
return prefix + numberString + ' ' + unit;
};
{
"name": "pretty-bytes",
"version": "5.0.0",
"version": "5.1.0",
"description": "Convert bytes to a human readable string: 1337 → 1.34 kB",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -29,2 +29,6 @@ # pretty-bytes [![Build Status](https://travis-ci.org/sindresorhus/pretty-bytes.svg?branch=master)](https://travis-ci.org/sindresorhus/pretty-bytes)

// Display file size differences
prettyBytes(42, {signed: true});
//=> '+42 B'
// Localized output using German locale

@@ -50,2 +54,10 @@ prettyBytes(1337, {locale: 'de'});

##### signed
Type: `boolean`<br>
Default: `false`
Include plus sign for positive numbers. If the difference is exactly zero a space character will be prepended instead for better alignment.
##### locale

@@ -52,0 +64,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc