mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-17 22:44:18 +08:00
Upgrade pretty-bytes to v5 (#27076)
This commit is contained in:
committed by
Mohamed Hegazy
parent
fc2591bc1e
commit
4ba531eaf9
14
types/pretty-bytes/index.d.ts
vendored
14
types/pretty-bytes/index.d.ts
vendored
@@ -1,8 +1,14 @@
|
||||
// Type definitions for pretty-bytes 4.0
|
||||
// Type definitions for pretty-bytes 5.1
|
||||
// Project: https://github.com/sindresorhus/pretty-bytes
|
||||
// Definitions by: York Yao <https://github.com/plantain-00>
|
||||
// Daniela Yassuda <https://github.com/danielasy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function prettyBytes(bytes: number): string;
|
||||
export = prettyBytes;
|
||||
declare namespace prettyBytes { }
|
||||
declare function PrettyBytes(number: number, options?: PrettyBytes.PrettyBytesOptions): string;
|
||||
export = PrettyBytes;
|
||||
declare namespace PrettyBytes {
|
||||
interface PrettyBytesOptions {
|
||||
signed?: boolean;
|
||||
locale?: boolean | string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
import prettyBytes = require('pretty-bytes');
|
||||
import * as prettyBytes from 'pretty-bytes';
|
||||
|
||||
prettyBytes(1337);
|
||||
// => '1.34 kB'
|
||||
|
||||
prettyBytes(100);
|
||||
// => '100 B'
|
||||
|
||||
// Display file size differences
|
||||
prettyBytes(42, { signed: true });
|
||||
// => '+42 B'
|
||||
|
||||
// Localized output using German locale
|
||||
prettyBytes(1337, { locale: 'de' });
|
||||
// => '1,34 kB'
|
||||
|
||||
// Localized output using system/browser locale
|
||||
prettyBytes(1337, { locale: true });
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"pretty-bytes-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
}
|
||||
|
||||
8
types/pretty-bytes/v4/index.d.ts
vendored
Normal file
8
types/pretty-bytes/v4/index.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// Type definitions for pretty-bytes 4.0
|
||||
// Project: https://github.com/sindresorhus/pretty-bytes
|
||||
// Definitions by: York Yao <https://github.com/plantain-00>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function prettyBytes(bytes: number): string;
|
||||
export = prettyBytes;
|
||||
declare namespace prettyBytes { }
|
||||
7
types/pretty-bytes/v4/pretty-bytes-tests.ts
Normal file
7
types/pretty-bytes/v4/pretty-bytes-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import prettyBytes = require('pretty-bytes');
|
||||
|
||||
prettyBytes(1337);
|
||||
// => '1.34 kB'
|
||||
|
||||
prettyBytes(100);
|
||||
// => '100 B'
|
||||
26
types/pretty-bytes/v4/tsconfig.json
Normal file
26
types/pretty-bytes/v4/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"pretty-bytes": [ "pretty-bytes/v4" ]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"pretty-bytes-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/pretty-bytes/v4/tslint.json
Normal file
3
types/pretty-bytes/v4/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user