Added new definitions for asciichart (#36273)

This commit is contained in:
pokutuna
2019-06-21 23:54:24 -07:00
committed by Daniel Rosenwasser
parent 24b24fa197
commit 845d001fe5
4 changed files with 53 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import * as asciichart from 'asciichart';
asciichart.plot([1, 2, 3]);
asciichart.plot([1, 2, 3], {});
asciichart.plot([1, 2, 3], { offset: 4 });
asciichart.plot([1, 2, 3], { padding: ' > ' });
asciichart.plot([1, 2, 3], { height: 10 });
asciichart.plot([1, 2, 3], { format: x => x.toFixed(1) });
asciichart.plot([1, 2, 3], { format: (x, i) => (i === 2 ? ' * ' : x.toFixed(2)) });
asciichart.plot([1, 2, 3], {
offset: 4,
padding: ' >',
height: 10,
format: (x, i) => (i === 2 ? ' * ' : x.toFixed(2)),
});
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for asciichart 1.5
// Project: https://github.com/kroitor/asciichart
// Definitions by: pokutuna <https://github.com/DefinitelyTyped>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface PlotConfig {
offset?: number;
padding?: string;
height?: number;
format?: (x: number, i: number) => string;
}
export function plot(series: ReadonlyArray<number>, cfg?: PlotConfig): string;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"asciichart-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }