forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DefinitelyTyped#3710 from borisyankov/add-archy
add archy definitions
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// <reference path="./archy.d.ts" /> | ||
|
||
import archy = require("archy"); | ||
|
||
var opts: archy.Options = { | ||
}; | ||
|
||
var data: archy.Data = { | ||
label: 'beep', | ||
nodes: [ | ||
'ity', | ||
{ | ||
label: 'boop', | ||
nodes: [ | ||
{ | ||
label: 'o_O', | ||
nodes: [ | ||
{ | ||
label: 'oh', | ||
nodes: ['hello', 'puny'] | ||
}, | ||
'human' | ||
] | ||
}, | ||
'party\ntime!' | ||
] | ||
} | ||
] | ||
}; | ||
|
||
var str = archy(data); | ||
console.log(str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Type definitions for archy | ||
// Project: https://github.com/substack/node-archy | ||
// Definitions by: vvakame <https://github.com/vvakame/> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
declare module "archy" { | ||
function archy(obj: archy.Data, prefix?: string, opts?: archy.Options): string; | ||
function archy(obj: string, prefix?: string, opts?: archy.Options): string; | ||
|
||
module archy { | ||
interface Data { | ||
label: string; | ||
nodes?: (Data | string)[]; | ||
} | ||
interface Options { | ||
unicode?: boolean; | ||
} | ||
} | ||
|
||
export = archy; | ||
} |