mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #31816 from mike-north/treeify
[new package] Types for treeify
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for tress 1.0
|
||||
// Project: https://github.com/notatestuser/treeify
|
||||
// Definitions by: Mike North <https://github.com/mike-north>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export interface TreeObject {
|
||||
[k: string]: TreeValue;
|
||||
}
|
||||
export type TreeValue = string | TreeObject;
|
||||
|
||||
export function asTree(
|
||||
treeObj: TreeObject,
|
||||
showValues: boolean,
|
||||
hideFunctions: boolean
|
||||
): string;
|
||||
|
||||
export function asLines(
|
||||
treeObj: TreeObject,
|
||||
showValues: boolean,
|
||||
lineCallback: (line: string) => void
|
||||
): string;
|
||||
export function asLines(
|
||||
treeObj: TreeObject,
|
||||
showValues: boolean,
|
||||
hideFunctions: boolean,
|
||||
lineCallback: (line: string) => void
|
||||
): string;
|
||||
@@ -0,0 +1,35 @@
|
||||
import * as treeify from 'treeify';
|
||||
|
||||
function log(s: string): void {}
|
||||
|
||||
treeify.asTree(
|
||||
{
|
||||
apples: 'gala', // ├─ apples: gala
|
||||
oranges: 'mandarin' // └─ oranges: mandarin
|
||||
},
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
treeify.asLines(
|
||||
{
|
||||
apples: 'gala', // ├─ apples: gala
|
||||
oranges: 'mandarin', // ├─ oranges: mandarin
|
||||
grapes: { // └─ grapes
|
||||
seedless: 'Thompson, Selma Pete', // ├─ seedless: Thompson, Selma Pete
|
||||
seeded: 'concord' // └─ seeded: Concord
|
||||
}
|
||||
},
|
||||
true,
|
||||
log
|
||||
);
|
||||
|
||||
treeify.asLines(
|
||||
{
|
||||
apples: 'gala', // ├─ apples: gala
|
||||
oranges: 'mandarin' // └─ oranges: mandarin
|
||||
},
|
||||
true,
|
||||
false,
|
||||
log
|
||||
);
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": []
|
||||
},
|
||||
"files": ["index.d.ts", "treeify-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {}
|
||||
}
|
||||
Reference in New Issue
Block a user