Added type definitions for smart-truncate (#31743)

This commit is contained in:
Omer Yalhi
2018-12-31 08:36:18 -08:00
committed by Wesley Wigham
parent e193757d8e
commit 51474e1b4f
4 changed files with 37 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
// Type definitions for smart-truncate 1.0
// Project: https://github.com/millerized/smart-truncate
// Definitions by: Omer Yalhi <https://github.com/oyalhi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function smartTruncate(text: string, length: number, options?: { position?: number; mark?: string }): string;
@@ -0,0 +1,7 @@
import { smartTruncate } from 'smart-truncate';
const length = 9;
let result = '';
result = smartTruncate('Steve Miller', length);
result = smartTruncate('Steve Miller', length, {position: 4});
result = smartTruncate('abcdefghijklmnopqrstuvwxyz', 7, {position: 3, mark: '—'});
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"smart-truncate-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }