@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.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/twemoji-parser

Weekly Downloads

3,283

Version

13.1.4

License

MIT

Unpacked Size

4.59 kB

Total Files

5

Last publish

Collaborators

  • types