mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-10-24 11:50:59 +08:00
Added JSONFormatter interface and tests
This commit is contained in:
1 parent
aaab0e11c1
commit
b29239b019
2 files changed
+22
-1
No files matched your search
@@ -16,4 +16,20 @@ var json:JSON = {
|
||||
editor.set(json);
|
||||
editor.expandAll();
|
||||
|
||||
var json2:JSON = editor.get(json);
|
||||
var jsonResult:JSON = editor.get(json);
|
||||
|
||||
var options2: JSONformatterOptions = {
|
||||
"indentation": 2
|
||||
};
|
||||
var formatter:JSONFormatter = new JSONFormatter(container, options);
|
||||
var json2:JSON = {
|
||||
"Array": [1, 2, 3],
|
||||
"Boolean": true,
|
||||
"Null": null,
|
||||
"Number": 123,
|
||||
"Object": {"a": "b", "c": "d"},
|
||||
"String": "Hello World"
|
||||
};
|
||||
formatter.set(json2);
|
||||
|
||||
var jsonResult2:JSON = formatter.get(json2);
|
||||
+5
@@ -29,4 +29,9 @@ interface JSONFormatterOptions {
|
||||
|
||||
interface JSONFormatter {
|
||||
(container:HTMLElement, options?: JSONFormatterOptions, json?: JSON): JSONEditor;
|
||||
(container:HTMLElement, options?: JSONFormatterOptions, json?: string): JSONEditor;
|
||||
set(json: JSON);
|
||||
get(): JSON;
|
||||
setText(jsonString: string);
|
||||
getText(): string;
|
||||
}
|
||||
Reference in new issue
Block a user