@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.42,184ts5.8
13.1.42,184ts5.7
13.1.42,184latest
13.1.42,184ts4.5
13.1.42,184ts4.6
13.1.42,184ts4.7
13.1.42,184ts4.8
13.1.42,184ts4.9
13.1.42,184ts5.0
13.1.42,184ts5.1
13.1.42,184ts5.2
13.1.42,184ts5.3
13.1.42,184ts5.4
13.1.42,184ts5.5
13.1.42,184ts5.6
13.1.42,184ts5.9
13.1.1235ts3.6
13.1.1235ts3.7
13.1.1235ts3.8
13.1.1235ts3.9
13.1.1235ts4.0
13.1.1235ts4.1
13.1.1235ts4.2
13.1.278ts4.3
13.1.278ts4.4
12.1.011ts2.8
12.1.011ts2.9
12.1.011ts3.0
12.1.011ts3.1
12.1.011ts3.2
12.1.011ts3.3
12.1.011ts3.4
12.1.011ts3.5

Version History

VersionDownloads (Last 7 Days)Published
13.1.42,184
13.1.350
13.1.278
13.1.1235
13.1.00
12.1.011

Package Sidebar

Install

npm i @types/twemoji-parser

Weekly Downloads

2,558

Version

13.1.4

License

MIT

Unpacked Size

4.59 kB

Total Files

5

Last publish

Collaborators

  • types