UNPKG

@types/twemoji-parser

Version:
64 lines (52 loc) 1.89 kB
# 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](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/twemoji-parser/index.d.ts) ````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](https://github.com/peterblazejewicz).