1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-11-17 05:12:37 +00:00

Compare commits

..

No commits in common. "ad3d3d669bb3697946577247ebb15818f09c6c91" and "cf0abdf32502c789bdb138b6cec0ff9eff8451d7" have entirely different histories.

15
index.d.ts vendored
View File

@ -7,11 +7,9 @@
* @param options all info for this parsing operation * @param options all info for this parsing operation
* @param variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored. * @param variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored.
*/ */
export type ParseCallback = (icon: string, options: object, variant: string) => string | false; declare type ParseCallback = (icon: string, options: object, variant: string) => string | false;
export type ReplacerFunction = (substring: string, ...args: any[]) => string; declare interface TwemojiOptions {
export type TwemojiOptions = {
/** /**
* Default: MaxCDN * Default: MaxCDN
*/ */
@ -46,11 +44,7 @@ export type TwemojiOptions = {
attributes?(icon: string, variant: string): object; attributes?(icon: string, variant: string): object;
} }
export type Twemoji = { declare type Twemoji = {
base: string;
ext: string;
className: string;
size: string;
convert: { convert: {
/** /**
* Given an HEX codepoint, returns UTF16 surrogate pairs. * Given an HEX codepoint, returns UTF16 surrogate pairs.
@ -85,9 +79,6 @@ export type Twemoji = {
toCodePoint(utf16surrogatePairs: string, sep?: string): string; toCodePoint(utf16surrogatePairs: string, sep?: string): string;
}; };
parse<T extends string | HTMLElement>(node: T, options?: TwemojiOptions | ParseCallback): T; parse<T extends string | HTMLElement>(node: T, options?: TwemojiOptions | ParseCallback): T;
replace(text: string, replacer: string | ReplacerFunction): string;
test(text: string): boolean;
onerror(): void;
}; };
declare module 'twemoji' { declare module 'twemoji' {