updated ts definition for v2.4.0 of 'bytes' package with missing options

This commit is contained in:
Laurens Rietveld
2016-07-01 14:19:31 +02:00
parent b2d754f53f
commit 56300b34b4
2 changed files with 13 additions and 6 deletions
+4 -2
View File
@@ -8,9 +8,11 @@ console.log(bytes(104857, { thousandsSeparator: ' ' }));
console.log(bytes.format(104857));
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('1024kb'));
console.log(bytes(1024));
console.log(bytes.parse('1024kb'));
console.log(bytes.parse(1024));
console.log(bytes.parse(1024));
+9 -4
View File
@@ -1,10 +1,15 @@
// Type definitions for bytes v2.1.0
// Type definitions for bytes v2.4.0
// Project: https://github.com/visionmedia/bytes.js
// Definitions by: Zhiyuan Wang <https://github.com/danny8002/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'bytes' {
interface BytesOptions {
decimalPlaces?: number,
thousandsSeparator?: string,
unitSeparator?: string,
fixedDecimals?: boolean
}
/**
*Convert the given value in bytes into a string.
*
@@ -15,7 +20,7 @@ declare module 'bytes' {
*
* @returns {string}
*/
function bytes(value: number, options?: { thousandsSeparator: string }): string;
function bytes(value: number, options?: BytesOptions): string;
/**
*Parse string to an integer in bytes.
@@ -37,7 +42,7 @@ declare module 'bytes' {
* @param {BytesFormatOptions} [options]
*/
function format(value: number, options?: { thousandsSeparator: string }): string;
function format(value: number, options?: BytesOptions): string;
/**
* Just return the input number value.