mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// Type definitions for json_ml 0.0
|
||||
// Project: https://github.com/59naga/json-ml
|
||||
// Definitions by: Alan Plum <https://github.com/pluma>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
/// <reference types="cheerio" />
|
||||
|
||||
export type Node = string | [string, ...any[]];
|
||||
export function parse(xml: string, trim?: boolean): Node[];
|
||||
export function stringify(
|
||||
object: Node[],
|
||||
replacer?: ((node: Cheerio) => any) | null,
|
||||
indent?: number
|
||||
): string;
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference types="node" />
|
||||
import { Node, parse, stringify } from "json_ml";
|
||||
|
||||
const nodes: Node[] = parse(
|
||||
'<ul><li style="color:red">First Item</li><li title="Some hover text." style="color:green">Second Item</li><li><span class="code-example-third">Third</span>Item</li></ul>'
|
||||
);
|
||||
stringify(nodes, el => (el.is("li") ? null : el), 2);
|
||||
|
||||
stringify(
|
||||
[
|
||||
[
|
||||
"ul",
|
||||
["li", { style: "color: red" }],
|
||||
["li", { title: "Some hover text", style: "color: green" }],
|
||||
["li", ["span", { class: "code-example-third" }]]
|
||||
]
|
||||
],
|
||||
null,
|
||||
2
|
||||
);
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "json_ml-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user