diff --git a/types/xml-c14n/index.d.ts b/types/xml-c14n/index.d.ts new file mode 100644 index 0000000000..5ac65b05e3 --- /dev/null +++ b/types/xml-c14n/index.d.ts @@ -0,0 +1,31 @@ +// Type definitions for xml-c14n 0.0 +// Project: https://github.com/deoxxa/xml-c14n +// Definitions by: Konstantin Yuriev +// Max Boguslavskiy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +declare namespace xml_c14n { + type canonicaliseCb = (err: any, data: string) => void; + + interface Options { + includeComments?: boolean; + inclusiveNamespaces?: boolean; + } + + interface Canonicalize { + name(): string; + _processInner(node: Node): string; + canonicalise(node: Node, cb: canonicaliseCb): void; + } + + interface CanonizationFactory { + createCanonicaliser(kind: string, options?: Options): Canonicalize; + getAlgorithm(uri: string): any; + registerAlgorithm(uri: string, implementation: any): any; + } +} + +declare function xml_c14n(): xml_c14n.CanonizationFactory; + +export = xml_c14n; diff --git a/types/xml-c14n/tsconfig.json b/types/xml-c14n/tsconfig.json new file mode 100644 index 0000000000..bee18a373b --- /dev/null +++ b/types/xml-c14n/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "esModuleInterop": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "xml-c14n-tests.ts" + ] +} diff --git a/types/xml-c14n/tslint.json b/types/xml-c14n/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/xml-c14n/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/xml-c14n/xml-c14n-tests.ts b/types/xml-c14n/xml-c14n-tests.ts new file mode 100644 index 0000000000..850e0c6aa1 --- /dev/null +++ b/types/xml-c14n/xml-c14n-tests.ts @@ -0,0 +1,5 @@ +import c14n from 'xml-c14n'; + +const canonizer = c14n().createCanonicaliser( + 'http://www.w3.org/2001/10/xml-exc-c14n#', +);