[bytes] Add unit to BytesOptions (#16630)

* add unit to BytesOptions

* update version number
This commit is contained in:
kyo_ago
2017-06-02 02:22:35 +09:00
committed by Mohamed Hegazy
parent c85fe6ae3f
commit a923ebce98
2 changed files with 5 additions and 3 deletions

View File

@@ -9,8 +9,9 @@ console.log(bytes.format(104857, { thousandsSeparator: ' ' }));
console.log(bytes.format(104857, { decimalPlaces: 2 }));
console.log(bytes.format(104857, { fixedDecimals: true }));
console.log(bytes.format(104857, { unitSeparator: '-' }));
console.log(bytes.format(104857, { unit: 'GB' }));
console.log(bytes('1024kb'));
console.log(bytes(1024));
console.log(bytes.parse('1024kb'));
console.log(bytes.parse(1024));
console.log(bytes.parse(1024));

View File

@@ -1,4 +1,4 @@
// Type definitions for bytes v2.4.0
// Type definitions for bytes v2.5.0
// Project: https://github.com/visionmedia/bytes.js
// Definitions by: Zhiyuan Wang <https://github.com/danny8002/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -7,7 +7,8 @@ interface BytesOptions {
decimalPlaces?: number,
thousandsSeparator?: string,
unitSeparator?: string,
fixedDecimals?: boolean
fixedDecimals?: boolean,
unit?: string
}
/**
*Convert the given value in bytes into a string.