/** Compare/comparator/comparison result */ export type Comparison = -1 | 0 | 1; /** Comparator for sorting alphanumeric strings, with support for accents */ export declare function compare(a: string, b: string): Comparison; /** Comparator for sorting fellows */ export declare function comparator(a: Fellow, b: Fellow): Comparison; /** Verify an email */ export declare function verifyEmail(email: string): boolean; /** Verify a URL */ export declare function fetchOk(url: string): Promise; /** Verify the failure of a URL */ export declare function fetchNotOk(url: string): Promise; /** A rendering style for {@link Fellow} */ export declare enum Format { /** Use {@link Fellow.toString} */ string = "string", /** Use {@link Fellow.toText} */ text = "text", /** Use {@link Fellow.toMarkdown} */ markdown = "markdown", /** Use {@link Fellow.toHtml} */ html = "html" } /** * Options for formatting the rendered outputs. * Defaults differ for each output. * Not all options are relevant on all outputs. */ export interface FormatOptions { /** When used with {@link Fellow.toFormat} this determines the format that is used. */ format?: Format | null; /** Whether or not to display {@link Fellow.url} */ displayUrl?: boolean; /** Whether or not to display {@link Fellow.description} */ displayDescription?: boolean; /** Whether or not to display {@link Fellow.email} */ displayEmail?: boolean; /** Whether or not to display the copright icon */ displayCopyright?: boolean; /** Whether or not to display {@link Fellow.years} */ displayYears?: boolean; /** Whether or not to display a link to the user's contributions. Requires {@link FormatOptions.githubSlug} */ displayContributions?: boolean; /** The repository for using with {@link FormatOptions.displayContributions} */ githubSlug?: string; /** An array of fields to prefer for the URL. {@link Fellow.toString} will output each one. */ urlFields?: Array; } /** A fellow with similarties to other people */ export default class Fellow { /** Note that any property can be assigned directly to fellow */ [key: string]: any; /** A singleton attached to the class that stores it's instances to enable convergence of data */ static readonly fellows: Array; /** GitHub Username */ githubUsername: string; /** GitLab Username */ gitlabUsername: string; /** Twitter Username */ twitterUsername: string; /** Facebook Username */ facebookUsername: string; /** OpenCollective Username */ opencollectiveUsername: string; /** Patreon Username */ patreonUsername: string; /** Patreon ID */ patreonId: string; /** Fields used to resolve {@link Fellow.username} */ protected readonly usernameFields: string[]; /** Get all unique resolved social usernames */ get usernames(): Array; /** Get the first resolved {@link Fellow.usernameFields} that is truthy. */ get username(): any; /** Storage of the years */ private _years; /** Get the resolved years: years active for the current repository, extracted from the name */ get years(): string; /** * Set the resolved years, additive to existing years, joined by comma * Correct merges of things like: * 2011-2012 Benjamin Lupton (https://balupton.com), 2013-2015 Bevry Pty Ltd (http://bevry.me), 2015+ Benjamin Lupton (https://balupton.com) * into: * 2011-2012,2015+ Benjamin Lupton (https://balupton.com), 2013-2015 Bevry Pty Ltd (http://bevry.me) */ set years(input: string); /** Storage of the Nomen (e.g. `Ben`, or `Benjamin Lupton`, but not `balupton`) */ private _nomen; /** Get the resolved Nomen */ get nomen(): string; /** * If the input is prefixed with a series of numbers, that is considered the year: * E.g. Given `2015+ Bevry Pty Ltd` then `2015+` is the years * E.g. Given `2013-2015 Bevry Pty Ltd` then `2013-2015` is the years */ set nomen(input: string); /** Get {@link Fellow.nomen} if resolved, otherwise {@link Fellow.username} */ get name(): string; /** Alias for {@link Fellow.nomen} */ set name(input: string); /** Storage of the Website URL */ private _websiteUrl; /** Get the resolved Website URL. Used by GitHub GraphQL API. */ get websiteUrl(): string; /** Alias for {@link Fellow.url} */ set websiteUrl(input: string); /** Alias for {@link Fellow.websiteUrl}. Used by npm. Used by prior Fellow versions. */ get homepage(): string; /** Alias for {@link Fellow.websiteUrl}. Used by npm. Used by prior Fellow versions. */ set homepage(input: string); /** Alias for {@link Fellow.websiteUrl}. Used by GitHub GraphQL API. */ get blog(): string; /** Alias for {@link Fellow.websiteUrl}. Used by GitHub REST API. */ set blog(input: string); /** Alias for {@link Fellow.websiteUrl}. Used by GitHub GraphQL API. */ get html_url(): string; /** Alias for {@link Fellow.websiteUrl}. Used by GitHub REST API. */ set html_url(input: string); /** Get the GitHub URL from the {@link Fellow.githubUsername} */ get githubUrl(): string; /** Set the GitHub URL and username from an input */ set githubUrl(input: string); /** Get the GitLab URL from the {@link Fellow.gitlabUsername} */ get gitlabUrl(): string; /** Set the GitLab URL and username from an input */ set gitlabUrl(input: string); /** Get the Facebook URL from the {@link Fellow.twitterUsername} */ get twitterUrl(): string; /** Set the Twitter URL and username from an input */ set twitterUrl(input: string); /** Get the Facebook URL from the {@link Fellow.facebookUsername} */ get facebookUrl(): string; /** Set the Facebook URL and username from an input */ set facebookUrl(input: string); /** Get the Patreon URL from the {@link Fellow.patreonUsername} or {@link Fellow.patreonId} */ get patreonUrl(): string; /** Set the Patreon URL and username/id from an input */ set patreonUrl(input: string); /** Get the OpenCollective URL from the {@link Fellow.opencollectiveUsername} */ get opencollectiveUrl(): string; /** Set the OpenCollective URL and username from an input */ set opencollectiveUrl(input: string); /** Store whether or not the thanksdev url is enabled */ _thanksdevUrlEnabled: boolean; /** Get the ThanksDev URL from the {@link Fellow.githubUsername} or {@link Fellow.gitlabUsername} but only if it has been explicitly set */ get thanksdevUrl(): string; /** Set the ThanksDev URL and username from an input */ set thanksdevUrl(input: string); /** URL fields used to resolve {@link Fellow.url} */ protected readonly urlFields: string[]; /** Remove invalid username urls */ verifyUrls(): Promise; /** Get all unique resolved URLs */ get urls(): string[]; /** Get the first resolved {@link Fellow.urlFields}. Used by GitHub GraphQL API. */ get url(): string; /** Set the appropriate {@link Fellow.urlFields} from the input */ set url(input: string); /** Emails used */ readonly emails: Set; /** Fetch the first email that was applied, otherwise an empty string */ get email(): string; /** Add the email to the set instead of replacing it */ set email(input: string); /** Storage of the description */ _description: string; /** Get the resolved description */ get description(): string; /** Set the resolved description */ set description(input: string); /** Alias for {@link Fellow.description} */ get bio(): string; /** Alias for {@link Fellow.description} */ set bio(input: string); /** * An array of field names that are used to determine if two fellow's are the same. * Emails are most reliable, then usernames (which are only social usernames). * Don't use urls as usernames already cover that as they are derived from urls, and employees/contributors often set websiteUrl to their company, which causes false de-duplications, as such urls cannot be used. */ protected readonly idFields: string[]; /** An array of identifiers, all lowercased to prevent typestrong/TypeStrong double-ups */ get ids(): string | string[]; /** * Construct our fellow instance with the value * @param input The value used to set the properties of the fellow, forwarded to {@link Fellow.set} */ constructor(input: any); /** * Update our fellow with the passed value * @param fellow A string or object representation of the user */ set(fellow: string | Fellow | any): this; /** Compare to another fellow for sorting. */ compare(other: Fellow): Comparison; /** * Compare to another fellow for equivalency. * First checks if any of the ids match, using {@link Fellow.ids}, otherwise checks if their {@link Fellow.toString} result is the same, otherwise checks if one is only a name that matches the other. * Note that `Adrian , Adrian` will not be de-duplicated, as no way to tell they are the same. * @param other The other fellow to compare ourselves with * @returns Returns `true` if they appear to be the same person, or `false` if not. */ same(other: Fellow): boolean; /** * Sort a list of fellows. * Uses {@link Fellow.compare} for the comparison. */ static sort(list: Array | Set): Fellow[]; /** Flatten lists of fellows into one set of fellows */ static flatten(lists: Array | Set>): Set; /** * With the value, see if an existing fellow exists in our singleton list property with the value, otherwise create a new fellow instance with the value and add them to our singleton list. * Uses {@link Fellow.same} for the comparison. * @param input The value to create a new fellow instance or find the existing fellow instance with * @param add Whether to add the created person to the list * @returns The new or existing fellow instance */ static ensure(input: any, add?: boolean): Fellow; /** * Get a fellow from the singleton list * @param input The value to fetch the value with * @returns The fetched fellow, if they exist with that value */ static get(input: any): Fellow; /** * Add a fellow or a series of people, denoted by the value, to the singleton list * @param inputs The fellow or people to add * @returns A de-duplicated sorted array of fellow objects for the passed people */ static add(...inputs: any[]): Array; /** Create a new Fellow instance with the value, however if the value is already a fellow instance, then just return it */ static create(value: any): Fellow; /** Set of GitHub repository slugs that the fellow authors */ readonly authorOfRepositories: Set; /** Get all fellows who author a particular GitHub repository */ static authorsOfRepository(repoSlug: string): Array; /** Set of GitHub repository slugs that the fellow maintains */ readonly maintainerOfRepositories: Set; /** Get all fellows who maintain a particular GitHub repository */ static maintainersOfRepository(repoSlug: string): Array; /** Map of GitHub repository slugs to the contribution count of the user */ readonly contributionsOfRepository: Map; /** Set of GitHub repository slugs that the fellow contributes to */ readonly contributorOfRepositories: Set; /** Get all fellows who contribute to a particular GitHub repository */ static contributorsOfRepository(repoSlug: string): Array; /** Set of GitHub repository slugs that the fellow initially financed */ readonly funderOfRepositories: Set; /** Get all fellows who initally financed a particular GitHub repository */ static fundersOfRepository(repoSlug: string): Array; /** Set of GitHub repository slugs that the fellow actively finances */ readonly sponsorOfRepositories: Set; /** Get all fellows who actively finance a particular GitHub repository */ static sponsorsOfRepository(repoSlug: string): Array; /** Set of GitHub repository slugs that the fellow has historically financed */ readonly donorOfRepositories: Set; /** Get all fellows who have historically financed a particular GitHub repository */ static donorsOfRepository(repoSlug: string): Array; /** Get the first field from the list that isn't empty */ getFirstField(fields: string[]): any; /** Get the all the de-duplicated fields from the list that aren't empty */ getFields(fields: string[]): string[]; /** * Convert the fellow into the usual string format * @example `NAME (URL)` */ toString(opts?: FormatOptions): string; /** * Convert the fellow into the usual text format * @example `NAME 📝 DESCRIPTION 🔗 URL` */ toText(opts?: FormatOptions): string; /** * Convert the fellow into the usual markdown format * @example `[NAME](URL) ` */ toMarkdown(opts?: FormatOptions): string; /** Convert the fellow into the usual HTML format */ toHtml(opts?: FormatOptions): string; /** Convert the fellow into the specified format */ toFormat(opts: FormatOptions & { format: Format; }): string; } //# sourceMappingURL=index.d.ts.map