social-links
Version:
Validate & sanitize social links
41 lines • 1.27 kB
TypeScript
import { PREDEFINED_PROFILES } from './profiles/';
export { PREDEFINED_PROFILES };
export * from './types';
export interface ProfileMatch {
match: string;
group: number;
type?: number;
pattern?: string;
}
export interface Profile {
name: string;
matches: ProfileMatch[];
}
export interface Score {
profileName: string;
score: number;
}
export interface Config {
usePredefinedProfiles?: boolean;
trimInput?: boolean;
allowQueryParams?: boolean;
}
export declare const DEFAULT_CONFIG: Config;
export declare class SocialLinks {
private profiles;
private config;
constructor(config?: Config | boolean);
private trim;
addProfile(profileName: string, profileMatches: ProfileMatch[]): boolean;
cleanProfiles(): void;
isValid(profileName: string, link: string): boolean;
getProfileId(profileName: string, link: string): string;
getLink(profileName: string, id: string, type?: number): string;
sanitize(profileName: string, link: string, type?: number): string;
hasProfile(profileName: string): boolean;
getProfileNames(): Array<string>;
scoreProfiles(link: string): Array<Score>;
detectProfile(link: string): string;
}
export default SocialLinks;
//# sourceMappingURL=main.d.ts.map