@subsocial/utils
Version:
JavaScript utils for Subsocial blockchain.
15 lines (14 loc) • 1.04 kB
TypeScript
/** Extract video id of link given. Current supported link format: youtube & youtu.be */
export declare function extractVideoId(url: string): string | false;
export declare const allowEmbedList: readonly ["vimeo", "youtube", "youtu.be", "soundcloud"];
export declare type AllowEmbedList = typeof allowEmbedList[number];
/** Generate embed url for video url given with the given embed format */
export declare const getEmbedUrl: (url: string, embed: AllowEmbedList | undefined) => string | undefined;
/** Other supported social platform links */
declare type SocialBrand = 'facebook' | 'twitter' | 'medium' | 'linkedIn' | 'gitHub' | 'instagram' | 'youTube' | 'reddit' | 'telegram';
export declare type LinkLabel = SocialBrand | 'website';
/** Check if the link is from the specific social brand given */
export declare const isSocialBrandLink: (brand: SocialBrand, link: string) => boolean;
/** Get the social platform where the link is originated */
export declare const getLinkBrand: (link: string) => LinkLabel | undefined;
export {};