export type Token = { type: 'tag' | 'mention'; /** * - Lowercased, without the sign */ value: string; /** * - Index of the sign in the text */ start: number; /** * - Index after the token, so text.slice(start, end) is "#Techno" */ end: number; }; /** * @typedef {Object} Token * @property {'tag' | 'mention'} type * @property {string} value - Lowercased, without the sign * @property {number} start - Index of the sign in the text * @property {number} end - Index after the token, so text.slice(start, end) is "#Techno" */ /** * Every tag and mention in the text, in order, with where it sits. For * rendering links; use extractTokens() when you only need the values. * @param {string | null | undefined} text * @returns {Token[]} */ export declare function findTokens(text: string | null | undefined): Token[]; /** * Extract tags (#hashtag) and mentions (@channel) from text, the way the database does. * @param {string | null | undefined} str - Text to extract from * @returns {{mentions: string[], tags: string[]}} * @example * extractTokens("Check out @detecteve #Ambient #jazz,") * // => {mentions: ['detecteve'], tags: ['ambient', 'jazz']} */ export declare function extractTokens(str: string | null | undefined): { mentions: string[]; tags: string[]; };