Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing sentence granularity to types #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions dist/bundled.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { IntlSegmenterOptions, Segment } from '.';

export declare const createIntlSegmenterPolyfill: () => Promise<{
new (locale: string, options: {
granularity: "word" | "grapheme";
}): {
locale: string;
options: {
granularity: "word" | "grapheme";
};
segment(input: string): {
segment: string;
index: number;
isWordLike: boolean;
breakType: "number" | "none" | "word" | "kana" | "ideo";
}[];
};
new (locale: string, options: IntlSegmenterOptions): {
locale: string;
options: IntlSegmenterOptions;
segment(input: string): Segment[];
};
}>;
21 changes: 7 additions & 14 deletions dist/bundled_cja.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { IntlSegmenterOptions, Segment } from '.';

export declare const createIntlSegmenterPolyfill: () => Promise<{
new (locale: string, options: {
granularity: "word" | "grapheme";
}): {
locale: string;
options: {
granularity: "word" | "grapheme";
};
segment(input: string): {
segment: string;
index: number;
isWordLike: boolean;
breakType: "number" | "none" | "word" | "kana" | "ideo";
}[];
};
new (locale: string, options: IntlSegmenterOptions): {
locale: string;
options: IntlSegmenterOptions;
segment(input: string): Segment[];
};
}>;
42 changes: 18 additions & 24 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
import 'fast-text-encoding';

export type IntlSegmenterOptions = {
granularity: 'word' | 'grapheme' | 'sentence'
}

export type Segment = {
segment: string;
index: number;
isWordLike: boolean;
breakType: "number" | "none" | "word" | "kana" | "ideo";
}

export declare const createIntlSegmenterPolyfillFromFactory: (wasmFactory: (imports: Object) => {
instance: WebAssembly.Instance;
}) => Promise<{
new (locale: string, options: {
granularity: 'word' | 'grapheme';
}): {
new (locale: string, options: IntlSegmenterOptions): {
locale: string;
options: {
granularity: 'word' | 'grapheme';
};
segment(input: string): {
segment: string;
index: number;
isWordLike: boolean;
breakType: "number" | "none" | "word" | "kana" | "ideo";
}[];
options: IntlSegmenterOptions;
segment(input: string): Segment[];
};
}>;
export declare const createIntlSegmenterPolyfill: (wasm: ArrayBufferLike | PromiseLike<Response>) => Promise<{
new (locale: string, options: {
granularity: 'word' | 'grapheme';
}): {
new (locale: string, options: IntlSegmenterOptions): {
locale: string;
options: {
granularity: 'word' | 'grapheme';
};
segment(input: string): {
segment: string;
index: number;
isWordLike: boolean;
breakType: "number" | "none" | "word" | "kana" | "ideo";
}[];
options: IntlSegmenterOptions;
segment(input: string): Segment[];
};
}>;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intl-segmenter-polyfill",
"version": "0.4.4",
"version": "0.4.5",
"description": "This repo builds .wasm module using icu4c for breaking text into words, so that we can polyfill [Intl Segmenter Proposal](https://github.com/tc39/proposal-intl-segmenter) with full compatibility, even on browsers that do not expose v8BreakIterator api.",
"main": "dist/index.js",
"files": [
Expand Down
21 changes: 7 additions & 14 deletions src/bundled.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { IntlSegmenterOptions, Segment } from '.';

export declare const createIntlSegmenterPolyfill: () => Promise<{
new (locale: string, options: {
granularity: "word" | "grapheme";
}): {
locale: string;
options: {
granularity: "word" | "grapheme";
};
segment(input: string): {
segment: string;
index: number;
isWordLike: boolean;
breakType: "number" | "none" | "word" | "kana" | "ideo";
}[];
};
new (locale: string, options: IntlSegmenterOptions): {
locale: string;
options: IntlSegmenterOptions;
segment(input: string): Segment[];
};
}>;
42 changes: 18 additions & 24 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
import 'fast-text-encoding';

export type IntlSegmenterOptions = {
granularity: 'word' | 'grapheme' | 'sentence'
}

export type Segment = {
segment: string;
index: number;
isWordLike: boolean;
breakType: "number" | "none" | "word" | "kana" | "ideo";
}

export declare const createIntlSegmenterPolyfillFromFactory: (wasmFactory: (imports: Object) => {
instance: WebAssembly.Instance;
}) => Promise<{
new (locale: string, options: {
granularity: 'word' | 'grapheme';
}): {
new (locale: string, options: IntlSegmenterOptions): {
locale: string;
options: {
granularity: 'word' | 'grapheme';
};
segment(input: string): {
segment: string;
index: number;
isWordLike: boolean;
breakType: "number" | "none" | "word" | "kana" | "ideo";
}[];
options: IntlSegmenterOptions;
segment(input: string): Segment[];
};
}>;
export declare const createIntlSegmenterPolyfill: (wasm: ArrayBufferLike | PromiseLike<Response>) => Promise<{
new (locale: string, options: {
granularity: 'word' | 'grapheme';
}): {
new (locale: string, options: IntlSegmenterOptions): {
locale: string;
options: {
granularity: 'word' | 'grapheme';
};
segment(input: string): {
segment: string;
index: number;
isWordLike: boolean;
breakType: "number" | "none" | "word" | "kana" | "ideo";
}[];
options: IntlSegmenterOptions;
segment(input: string): Segment[];
};
}>;