Skip to content

Commit 2272849

Browse files
committed
Merge pull request DefinitelyTyped#3710 from borisyankov/add-archy
add archy definitions
2 parents 8e85bba + b3def0f commit 2272849

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

archy/archy-tests.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/// <reference path="./archy.d.ts" />
2+
3+
import archy = require("archy");
4+
5+
var opts: archy.Options = {
6+
};
7+
8+
var data: archy.Data = {
9+
label: 'beep',
10+
nodes: [
11+
'ity',
12+
{
13+
label: 'boop',
14+
nodes: [
15+
{
16+
label: 'o_O',
17+
nodes: [
18+
{
19+
label: 'oh',
20+
nodes: ['hello', 'puny']
21+
},
22+
'human'
23+
]
24+
},
25+
'party\ntime!'
26+
]
27+
}
28+
]
29+
};
30+
31+
var str = archy(data);
32+
console.log(str);

archy/archy.d.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Type definitions for archy
2+
// Project: https://github.com/substack/node-archy
3+
// Definitions by: vvakame <https://github.com/vvakame/>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
6+
declare module "archy" {
7+
function archy(obj: archy.Data, prefix?: string, opts?: archy.Options): string;
8+
function archy(obj: string, prefix?: string, opts?: archy.Options): string;
9+
10+
module archy {
11+
interface Data {
12+
label: string;
13+
nodes?: (Data | string)[];
14+
}
15+
interface Options {
16+
unicode?: boolean;
17+
}
18+
}
19+
20+
export = archy;
21+
}

0 commit comments

Comments
 (0)