-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes GH-8. Closes GH-9. Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com> Reviewed-by: Titus Wormer <tituswormer@gmail.com>
- Loading branch information
1 parent
ff7d8bd
commit 3c4d4a1
Showing
5 changed files
with
77 additions
and
2 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
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,27 @@ | ||
// TypeScript Version: 3.0 | ||
import { Node } from 'unist'; | ||
|
||
export = inpect; | ||
|
||
/* | ||
* Unist utility to inspect the details of a Unist Node | ||
* | ||
* @param node Node to inspect | ||
*/ | ||
declare function inpect(node: Node): string; | ||
|
||
declare namespace inpect { | ||
/** | ||
* Inspect the given Node and include colors from the results | ||
* | ||
* @param node Node to inspect | ||
*/ | ||
function color(node: Node): string; | ||
|
||
/** | ||
* Inspect the given Node and exclude colors from the results | ||
* | ||
* @param node Node to inspect | ||
*/ | ||
function noColor(node: Node): string; | ||
} |
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,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["es2015"], | ||
"strict": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"unist-util-inspect": ["index.d.ts"] | ||
} | ||
} | ||
} |
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,3 @@ | ||
{ | ||
"extends": "dtslint/dtslint.json" | ||
} |
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,30 @@ | ||
import * as inspect from 'unist-util-inspect'; | ||
|
||
const node = { | ||
type: 'node', | ||
data: { | ||
string: 'string', | ||
number: 1, | ||
object: { | ||
key: 'value' | ||
}, | ||
array: [], | ||
boolean: true, | ||
null: null | ||
}, | ||
position: { | ||
start: { | ||
line: 1, | ||
column: 1, | ||
offset: 0 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 4, | ||
offset: 0 | ||
}, | ||
indent: [1] | ||
} | ||
}; | ||
|
||
const result: string = inspect(node); |