mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 06:50:19 +00:00
updated ts definition for v2.4.0 of 'bytes' package with missing options
This commit is contained in:
@@ -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));
|
||||
|
||||
Vendored
+9
-4
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user