From 75ed053a201b6683bbc2b353dc6b2698b9524177 Mon Sep 17 00:00:00 2001 From: Rodrigo Saboya Date: Fri, 22 Feb 2019 10:01:54 -0300 Subject: [PATCH] Adding types for word-extractor --- types/word-extractor/index.d.ts | 20 +++++++++++++++++ types/word-extractor/tsconfig.json | 23 ++++++++++++++++++++ types/word-extractor/tslint.json | 1 + types/word-extractor/word-extractor-tests.ts | 13 +++++++++++ 4 files changed, 57 insertions(+) create mode 100644 types/word-extractor/index.d.ts create mode 100644 types/word-extractor/tsconfig.json create mode 100644 types/word-extractor/tslint.json create mode 100644 types/word-extractor/word-extractor-tests.ts diff --git a/types/word-extractor/index.d.ts b/types/word-extractor/index.d.ts new file mode 100644 index 0000000000..c6e6289774 --- /dev/null +++ b/types/word-extractor/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for word-extractor 0.3 +// Project: https://github.com/morungos/node-word-extractor +// Definitions by: Rodrigo Saboya +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class WordExtractor { + extract(documentPath: string): Promise; +} + +export = WordExtractor; + +declare namespace WordExtractor { + class Document { + getBody(): string; + getFootnotes(): string; + getHeaders(): string; + getAnnotations(): string; + getEndNotes(): string; + } +} diff --git a/types/word-extractor/tsconfig.json b/types/word-extractor/tsconfig.json new file mode 100644 index 0000000000..436687e1ff --- /dev/null +++ b/types/word-extractor/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "word-extractor-tests.ts" + ] +} diff --git a/types/word-extractor/tslint.json b/types/word-extractor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/word-extractor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/word-extractor/word-extractor-tests.ts b/types/word-extractor/word-extractor-tests.ts new file mode 100644 index 0000000000..a177b9d5c5 --- /dev/null +++ b/types/word-extractor/word-extractor-tests.ts @@ -0,0 +1,13 @@ +import WordExtractor = require("word-extractor"); + +const extractor = new WordExtractor(); + +let temp: string; + +const doc = extractor.extract('/path/to/file.doc').then(document => { + temp = document.getBody(); + temp = document.getAnnotations(); + temp = document.getEndNotes(); + temp = document.getFootnotes(); + temp = document.getHeaders(); +});