mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-20 12:46:36 +08:00
add types for jsontoxml
This commit is contained in:
22
types/jsontoxml/index.d.ts
vendored
Normal file
22
types/jsontoxml/index.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Type definitions for jsontoxml 1.0
|
||||
// Project: https://github.com/soldair/node-jsontoxml
|
||||
// Definitions by: benstevens48 <https://github.com/benstevens48>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace jsontoxml {
|
||||
function escape(str: string): string;
|
||||
function cdata(str: string): string;
|
||||
interface JsonToXmlOptions {
|
||||
escape?: boolean;
|
||||
xmlHeader?: boolean | {standalone?: boolean};
|
||||
docType?: string;
|
||||
prettyPrint?: boolean;
|
||||
indent?: string;
|
||||
removeIllegalNameCharacters?: boolean;
|
||||
html?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare function jsontoxml(data: any, options?: jsontoxml.JsonToXmlOptions): string;
|
||||
|
||||
export = jsontoxml;
|
||||
10
types/jsontoxml/jsontoxml-tests.ts
Normal file
10
types/jsontoxml/jsontoxml-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import jsontoxml = require('jsontoxml');
|
||||
|
||||
// $ExpectType string
|
||||
jsontoxml({foo: 'bar'}, {escape: true, xmlHeader: true});
|
||||
|
||||
// $ExpectType string
|
||||
jsontoxml.escape('&test');
|
||||
|
||||
// $ExpectType string
|
||||
jsontoxml.cdata('test');
|
||||
24
types/jsontoxml/tsconfig.json
Normal file
24
types/jsontoxml/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"esModuleInterop": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jsontoxml-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/jsontoxml/tslint.json
Normal file
1
types/jsontoxml/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user