Skip to content

Commit

Permalink
馃 Merge PR #53794 update(word-extractor): v1 update by @peterblazejewicz
Browse files Browse the repository at this point in the history


- new methods added
- version bump
- tests amended

morungos/node-word-extractor@0.3.0...1.0.2

Thanks!
  • Loading branch information
peterblazejewicz committed Jun 13, 2021
1 parent 5885a0e commit 598639c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
8 changes: 5 additions & 3 deletions types/word-extractor/index.d.ts
@@ -1,10 +1,10 @@
// Type definitions for word-extractor 0.3
// Type definitions for word-extractor 1.0
// 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>;
extract(documentPath: string | Uint8Array): Promise<WordExtractor.Document>;
}

export = WordExtractor;
Expand All @@ -13,8 +13,10 @@ declare namespace WordExtractor {
class Document {
getBody(): string;
getFootnotes(): string;
getHeaders(): string;
getHeaders(options?: { includeFooters?: boolean }): string;
getFooters(): string;
getAnnotations(): string;
getTextboxes(options?: { includeHeadersAndFooters?: boolean; includeBody?: boolean }): string;
getEndNotes(): string;
}
}
27 changes: 18 additions & 9 deletions types/word-extractor/word-extractor-tests.ts
@@ -1,13 +1,22 @@
import WordExtractor = require("word-extractor");
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();
extractor.extract('/path/to/file.doc').then(document => {
document.getBody(); // $ExpectType string
document.getAnnotations(); // $ExpectType string
document.getEndNotes(); // $ExpectType string
document.getFootnotes(); // $ExpectType string
document.getHeaders(); // $ExpectType string
document.getHeaders(); // $ExpectType string
// $ExpectType string
document.getHeaders({
includeFooters: false,
});
document.getFooters(); // $ExpectType string
// $ExpectType string
document.getTextboxes({
includeBody: false,
includeHeadersAndFooters: false,
});
});

0 comments on commit 598639c

Please sign in to comment.