13.1.4 • Published 6 months ago

@types/twemoji-parser v13.1.4

Weekly downloads
2,091
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for twemoji-parser 13.1
// Project: https://github.com/twitter/twemoji-parser
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/**
 * 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: Fri, 02 Jul 2021 19:37:24 GMT
  • Dependencies: none
  • Global values: none

Credits

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

13.1.3

7 months ago

13.1.4

6 months ago

13.1.2

8 months ago

13.1.1

3 years ago

13.1.0

3 years ago

12.1.0

4 years ago