Merge pull request #33280 from saboya/word-extractor-typings

Adding types for word-extractor
This commit is contained in:
Andrew Casey
2019-02-22 10:52:55 -08:00
committed by GitHub
4 changed files with 57 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for word-extractor 0.3
// Project: https://github.com/morungos/node-word-extractor
// Definitions by: Rodrigo Saboya <https://github.com/saboya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class WordExtractor {
extract(documentPath: string): Promise<WordExtractor.Document>;
}
export = WordExtractor;
declare namespace WordExtractor {
class Document {
getBody(): string;
getFootnotes(): string;
getHeaders(): string;
getAnnotations(): string;
getEndNotes(): string;
}
}
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -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();
});