From 330f8625ff6dcbdf8b9132cb285f219d6c4fdafa Mon Sep 17 00:00:00 2001 From: Brian Cort Date: Tue, 26 Mar 2019 17:13:56 -0400 Subject: [PATCH 1/4] Definition for sbd library --- types/sbd/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 types/sbd/index.d.ts diff --git a/types/sbd/index.d.ts b/types/sbd/index.d.ts new file mode 100644 index 0000000000..39d280a56a --- /dev/null +++ b/types/sbd/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for sbd 1.0.15 +// Project: https://github.com/Tessmore/sbd +// Definitions by: Brian Cort + +export as namespace sbd; + +export interface Options { + newline_boundaries?: boolean; + html_boundaries?: boolean; + sanitize?: boolean; + allowed_tags?: false | string[]; + preserve_whitespace?: boolean; + abbreviations?: string[]; +} + +export function sentences(text: string, options?: Options): string[]; From 6f30dd4d9528442f1ba5cc0120d61b5c560d4566 Mon Sep 17 00:00:00 2001 From: Brian Cort Date: Tue, 26 Mar 2019 17:43:05 -0400 Subject: [PATCH 2/4] Type definition for sbd library --- types/sbd/index.d.ts | 14 +++++++------- types/sbd/sbd-tests.ts | 5 +++++ types/sbd/tsconfig.json | 22 ++++++++++++++++++++++ types/sbd/tslint.json | 1 + 4 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 types/sbd/sbd-tests.ts create mode 100644 types/sbd/tsconfig.json create mode 100644 types/sbd/tslint.json diff --git a/types/sbd/index.d.ts b/types/sbd/index.d.ts index 39d280a56a..fd2cd21c53 100644 --- a/types/sbd/index.d.ts +++ b/types/sbd/index.d.ts @@ -1,16 +1,16 @@ -// Type definitions for sbd 1.0.15 +// Type definitions for sbd v1.0.15 // Project: https://github.com/Tessmore/sbd // Definitions by: Brian Cort export as namespace sbd; export interface Options { - newline_boundaries?: boolean; - html_boundaries?: boolean; - sanitize?: boolean; - allowed_tags?: false | string[]; - preserve_whitespace?: boolean; - abbreviations?: string[]; + newline_boundaries?: boolean; + html_boundaries?: boolean; + sanitize?: boolean; + allowed_tags?: false | string[]; + preserve_whitespace?: boolean; + abbreviations?: string[]; } export function sentences(text: string, options?: Options): string[]; diff --git a/types/sbd/sbd-tests.ts b/types/sbd/sbd-tests.ts new file mode 100644 index 0000000000..53f6cd9d14 --- /dev/null +++ b/types/sbd/sbd-tests.ts @@ -0,0 +1,5 @@ +import * as tokenizer from 'sbd'; + +const text = "On Jan. 20, former Sen. Barack Obama became the 44th President of the U.S. Millions attended the Inauguration."; +tokenizer.sentences(text); +tokenizer.sentences(text, {sanitize: true}); diff --git a/types/sbd/tsconfig.json b/types/sbd/tsconfig.json new file mode 100644 index 0000000000..1cdfca28ba --- /dev/null +++ b/types/sbd/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "sbd-tests.ts" + ] +} diff --git a/types/sbd/tslint.json b/types/sbd/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sbd/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 317e03b1e10c8d94d13547cf2a3c938093e13750 Mon Sep 17 00:00:00 2001 From: Brian Cort Date: Tue, 26 Mar 2019 17:54:26 -0400 Subject: [PATCH 3/4] Fix lint errors --- types/sbd/index.d.ts | 5 +++-- types/sbd/tsconfig.json | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/sbd/index.d.ts b/types/sbd/index.d.ts index fd2cd21c53..2d7ed4c998 100644 --- a/types/sbd/index.d.ts +++ b/types/sbd/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for sbd v1.0.15 -// Project: https://github.com/Tessmore/sbd +// Type definitions for sbd 1.0 +// Project: http://github.com/tessmore/sbd // Definitions by: Brian Cort +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace sbd; diff --git a/types/sbd/tsconfig.json b/types/sbd/tsconfig.json index 1cdfca28ba..8374644d40 100644 --- a/types/sbd/tsconfig.json +++ b/types/sbd/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From eb92b0e38fffa34f270ea2f4bfdd8414f346f871 Mon Sep 17 00:00:00 2001 From: Brian Cort Date: Mon, 1 Apr 2019 18:16:32 -0400 Subject: [PATCH 4/4] Remove namespace from sbd type as requested in PR review. --- types/sbd/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/sbd/index.d.ts b/types/sbd/index.d.ts index 2d7ed4c998..0934ba937c 100644 --- a/types/sbd/index.d.ts +++ b/types/sbd/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Brian Cort // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export as namespace sbd; - export interface Options { newline_boundaries?: boolean; html_boundaries?: boolean;