@types/twemoji-parser
TypeScript icon, indicating that this package has built-in type declarations

13.1.4 • Public • Published

Installation

npm install --save @types/twemoji-parser

Summary

This package contains type definitions for twemoji-parser (https://github.com/twitter/twemoji-parser).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/twemoji-parser.

index.d.ts

/**
 * A simple library for identifying emoji entities within a string in order to render them as Twemoji.
 * For example, this parser is used within the rendering flow for Tweets and other text on mobile.twitter.com
 */

export const TypeName = "emoji";

export interface EmojiEntity {
    /**
     * @default 'emoji'
     */
    type: typeof TypeName;
    text: string;
    /**
     * @default ''
     */
    url: string;
    /**
     * [startIndex: number, lastIndex: number]
     */
    indices: [number, number];
}

export interface ParsingOptions {
    buildUrl?: ((codepoints: string, assetType: AssetType) => string) | undefined;
    /**
     * @default 'svg'
     */
    assetType?: AssetType | undefined;
}

export type AssetType = "png" | "svg";
/**
 * Parser takes a string and returns an array of the emoji entities it finds.
 */
export function parse(text: string, options?: ParsingOptions): EmojiEntity[];

export function toCodePoints(unicodeSurrogates: string): string[];

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by Piotr Błażejewicz.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
13.1.41,751ts5.7
13.1.41,751ts5.6
13.1.41,751latest
13.1.41,751ts4.5
13.1.41,751ts4.6
13.1.41,751ts4.7
13.1.41,751ts4.8
13.1.41,751ts4.9
13.1.41,751ts5.0
13.1.41,751ts5.1
13.1.41,751ts5.2
13.1.41,751ts5.3
13.1.41,751ts5.4
13.1.41,751ts5.5
13.1.41,751ts5.8
13.1.1263ts3.6
13.1.1263ts3.7
13.1.1263ts3.8
13.1.1263ts3.9
13.1.1263ts4.0
13.1.1263ts4.1
13.1.1263ts4.2
13.1.2229ts4.3
13.1.2229ts4.4
12.1.03ts2.8
12.1.03ts2.9
12.1.03ts3.0
12.1.03ts3.1
12.1.03ts3.2
12.1.03ts3.3
12.1.03ts3.4
12.1.03ts3.5

Version History

VersionDownloads (Last 7 Days)Published
13.1.41,751
13.1.30
13.1.2229
13.1.1263
13.1.00
12.1.03

Package Sidebar

Install

npm i @types/twemoji-parser

Weekly Downloads

2,246

Version

13.1.4

License

MIT

Unpacked Size

4.59 kB

Total Files

5

Last publish

Collaborators

  • types