mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
Merge pull request #28458 from danwbyrne/cli-truncate
adds typings for the 'cli-truncate' package
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import cliTruncate = require('cli-truncate');
|
||||
|
||||
// Truncate at different positions
|
||||
// $ExpectType string
|
||||
cliTruncate('unicorn', 4); // default position: 'end'
|
||||
|
||||
// $ExpectType string
|
||||
cliTruncate('unicorn', 4, {position: 'start'});
|
||||
|
||||
// $ExpectType string
|
||||
cliTruncate('unicorn', 4, {position: 'middle'});
|
||||
|
||||
// Truncate Unicode surrogate pairs
|
||||
// $ExpectType string
|
||||
cliTruncate('uni\uD83C\uDE00corn', 5);
|
||||
|
||||
// Truncate full-width characters
|
||||
// $ExpectType string
|
||||
cliTruncate('안녕하세요', 3);
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for cli-truncate 1.1
|
||||
// Project: https://github.com/sindresorhus/cli-truncate
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = cliTruncate;
|
||||
|
||||
declare function cliTruncate(
|
||||
input: string,
|
||||
columns: number,
|
||||
options?: {position?: 'start' | 'middle' | 'end'},
|
||||
): string;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cli-truncate-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user