Comparing version 6.3.0 to 6.4.0-next.1585544114.d8aaca9a7e6f7a446a42b3051140c8685a3392cb
@@ -316,13 +316,19 @@ /** Comparator for sorting fellows in an array */ | ||
*/ | ||
toString() { | ||
toString(format = {}) { | ||
const parts = [] | ||
if (this.name) { | ||
parts.push(this.name) | ||
if (this.email) { | ||
parts.push(`<${this.email}>`) | ||
} | ||
if (this.url) { | ||
parts.push(`(${this.url})`) | ||
} | ||
if (!this.name) return '' | ||
// copyright | ||
if (format.displayCopyright) parts.push('Copyright ©') | ||
if (format.displayYears && this.years) parts.push(this.years) | ||
// name | ||
parts.push(this.name) | ||
if (format.displayEmail && this.email) { | ||
parts.push(`<${this.email}>`) | ||
} | ||
// url | ||
if (this.url) { | ||
parts.push(`(${this.url})`) | ||
} | ||
// return | ||
return parts.join(' ') | ||
@@ -334,15 +340,60 @@ } | ||
*/ | ||
toMarkdown() { | ||
toMarkdown(format = {}) { | ||
if (!this.name) return '' | ||
const parts = [] | ||
if (this.name) { | ||
if (this.url) parts.push(`[${this.name}](${this.url})`) | ||
else parts.push(this.name) | ||
} | ||
if (this.email) { | ||
// copyright | ||
if (format.displayCopyright) parts.push('Copyright ©') | ||
if (format.displayYears && this.years) parts.push(this.years) | ||
// name + url | ||
if (this.url) parts.push(`[${this.name}](${this.url})`) | ||
else parts.push(this.name) | ||
if (format.displayEmail && this.email) { | ||
parts.push(`<${this.email}>`) | ||
} | ||
// contributions | ||
if ( | ||
format.displayContributions && | ||
format.githubRepoSlug && | ||
this.githubUsername | ||
) { | ||
const contributionsURL = `https://github.com/${format.githubRepoSlug}/commits?author=${this.githubUsername}` | ||
parts.push( | ||
`— [view contributions](${contributionsURL} "View the GitHub contributions of ${this.name} on repository ${format.githubRepoSlug}")` | ||
) | ||
} | ||
// return | ||
return parts.join(' ') | ||
} | ||
toHTML(format = {}) { | ||
if (!this.name) return '' | ||
const parts = [] | ||
// copyright | ||
if (format.displayCopyright) parts.push('Copyright ©') | ||
if (format.displayYears && this.years) parts.push(this.years) | ||
// name + url | ||
if (this.url) parts.push(`<a href="${this.url}">${this.name}</a>`) | ||
else parts.push(this.name) | ||
if (format.displayEmail && this.email) { | ||
parts.push( | ||
`<a href="mailto:${this.email}" title="Email ${this.name}"><${this.email}></a>` | ||
) | ||
} | ||
// contributions | ||
if ( | ||
format.displayContributions && | ||
format.githubRepoSlug && | ||
this.githubUsername | ||
) { | ||
const contributionsURL = `https://github.com/${format.githubRepoSlug}/commits?author=${this.githubUsername}` | ||
parts.push( | ||
`— <a href="${contributionsURL}" title="View the GitHub contributions of ${this.name} on repository ${format.githubRepoSlug}">view contributions</a>` | ||
) | ||
} | ||
// return | ||
return parts.join(' ') | ||
} | ||
} | ||
/** A singleton attached to the class that stores it's instances to enable convergence of data */ | ||
Fellow.fellows = [] |
@@ -319,13 +319,19 @@ 'use strict' | ||
*/ | ||
toString() { | ||
toString(format = {}) { | ||
const parts = [] | ||
if (this.name) { | ||
parts.push(this.name) | ||
if (this.email) { | ||
parts.push(`<${this.email}>`) | ||
} | ||
if (this.url) { | ||
parts.push(`(${this.url})`) | ||
} | ||
if (!this.name) return '' | ||
// copyright | ||
if (format.displayCopyright) parts.push('Copyright ©') | ||
if (format.displayYears && this.years) parts.push(this.years) | ||
// name | ||
parts.push(this.name) | ||
if (format.displayEmail && this.email) { | ||
parts.push(`<${this.email}>`) | ||
} | ||
// url | ||
if (this.url) { | ||
parts.push(`(${this.url})`) | ||
} | ||
// return | ||
return parts.join(' ') | ||
@@ -337,13 +343,58 @@ } | ||
*/ | ||
toMarkdown() { | ||
toMarkdown(format = {}) { | ||
if (!this.name) return '' | ||
const parts = [] | ||
if (this.name) { | ||
if (this.url) parts.push(`[${this.name}](${this.url})`) | ||
else parts.push(this.name) | ||
} | ||
if (this.email) { | ||
// copyright | ||
if (format.displayCopyright) parts.push('Copyright ©') | ||
if (format.displayYears && this.years) parts.push(this.years) | ||
// name + url | ||
if (this.url) parts.push(`[${this.name}](${this.url})`) | ||
else parts.push(this.name) | ||
if (format.displayEmail && this.email) { | ||
parts.push(`<${this.email}>`) | ||
} | ||
// contributions | ||
if ( | ||
format.displayContributions && | ||
format.githubRepoSlug && | ||
this.githubUsername | ||
) { | ||
const contributionsURL = `https://github.com/${format.githubRepoSlug}/commits?author=${this.githubUsername}` | ||
parts.push( | ||
`— [view contributions](${contributionsURL} "View the GitHub contributions of ${this.name} on repository ${format.githubRepoSlug}")` | ||
) | ||
} | ||
// return | ||
return parts.join(' ') | ||
} | ||
toHTML(format = {}) { | ||
if (!this.name) return '' | ||
const parts = [] | ||
// copyright | ||
if (format.displayCopyright) parts.push('Copyright ©') | ||
if (format.displayYears && this.years) parts.push(this.years) | ||
// name + url | ||
if (this.url) parts.push(`<a href="${this.url}">${this.name}</a>`) | ||
else parts.push(this.name) | ||
if (format.displayEmail && this.email) { | ||
parts.push( | ||
`<a href="mailto:${this.email}" title="Email ${this.name}"><${this.email}></a>` | ||
) | ||
} | ||
// contributions | ||
if ( | ||
format.displayContributions && | ||
format.githubRepoSlug && | ||
this.githubUsername | ||
) { | ||
const contributionsURL = `https://github.com/${format.githubRepoSlug}/commits?author=${this.githubUsername}` | ||
parts.push( | ||
`— <a href="${contributionsURL}" title="View the GitHub contributions of ${this.name} on repository ${format.githubRepoSlug}">view contributions</a>` | ||
) | ||
} | ||
// return | ||
return parts.join(' ') | ||
} | ||
} | ||
@@ -350,0 +401,0 @@ exports.default = Fellow |
# History | ||
## v6.4.0 2020 March 30 | ||
- Added formatting options | ||
- Format without email by default, add it back with the `displayEmail: true` format option | ||
## v6.3.0 2020 March 30 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "fellow", | ||
"version": "6.3.0", | ||
"version": "6.4.0-next.1585544114.d8aaca9a7e6f7a446a42b3051140c8685a3392cb", | ||
"description": "Fellow is a package for creating people that can be unified by their shared values via a singleton list on the class", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/bevry/fellow", |
@@ -55,3 +55,3 @@ <!-- TITLE/ --> | ||
<script type="module"> | ||
import pkg from '//cdn.pika.dev/fellow/^6.3.0' | ||
import pkg from '//cdn.pika.dev/fellow/^6.4.0' | ||
</script> | ||
@@ -64,3 +64,3 @@ ``` | ||
<script type="module"> | ||
import pkg from '//unpkg.com/fellow@^6.3.0' | ||
import pkg from '//unpkg.com/fellow@^6.4.0' | ||
</script> | ||
@@ -73,3 +73,3 @@ ``` | ||
<script type="module"> | ||
import pkg from '//dev.jspm.io/fellow@6.3.0' | ||
import pkg from '//dev.jspm.io/fellow@6.4.0' | ||
</script> | ||
@@ -76,0 +76,0 @@ ``` |
@@ -0,1 +1,18 @@ | ||
export interface FormatOptions { | ||
/** Whether or not to display the fellow's email */ | ||
displayEmail?: true | ||
/** Whether or not to display the copright icon */ | ||
displayCopyright?: boolean | ||
/** Whether or not to display the copyright years */ | ||
displayYears?: boolean | ||
/** Whether or not to display a link to the user's contributions, if used along with {@link .githubRepoSlug} */ | ||
displayContributions?: boolean | ||
/** The repository for when using with {@link .displayContributions} */ | ||
githubRepoSlug?: string | ||
} | ||
/** Comparator for sorting fellows in an array */ | ||
@@ -18,3 +35,3 @@ export function comparator(a: Fellow, b: Fellow) { | ||
/** Years active for the current repository, extracted from the name */ | ||
private years?: string | ||
public years?: string | ||
@@ -368,13 +385,24 @@ /** URLs used */ | ||
*/ | ||
toString(): string { | ||
toString(format: FormatOptions = {}): string { | ||
const parts = [] | ||
if (this.name) { | ||
parts.push(this.name) | ||
if (this.email) { | ||
parts.push(`<${this.email}>`) | ||
} | ||
if (this.url) { | ||
parts.push(`(${this.url})`) | ||
} | ||
if (!this.name) return '' | ||
// copyright | ||
if (format.displayCopyright) parts.push('Copyright ©') | ||
if (format.displayYears && this.years) parts.push(this.years) | ||
// name | ||
parts.push(this.name) | ||
if (format.displayEmail && this.email) { | ||
parts.push(`<${this.email}>`) | ||
} | ||
// url | ||
if (this.url) { | ||
parts.push(`(${this.url})`) | ||
} | ||
// return | ||
return parts.join(' ') | ||
@@ -387,13 +415,69 @@ } | ||
*/ | ||
toMarkdown(): string { | ||
toMarkdown(format: FormatOptions = {}): string { | ||
if (!this.name) return '' | ||
const parts = [] | ||
if (this.name) { | ||
if (this.url) parts.push(`[${this.name}](${this.url})`) | ||
else parts.push(this.name) | ||
} | ||
if (this.email) { | ||
// copyright | ||
if (format.displayCopyright) parts.push('Copyright ©') | ||
if (format.displayYears && this.years) parts.push(this.years) | ||
// name + url | ||
if (this.url) parts.push(`[${this.name}](${this.url})`) | ||
else parts.push(this.name) | ||
if (format.displayEmail && this.email) { | ||
parts.push(`<${this.email}>`) | ||
} | ||
// contributions | ||
if ( | ||
format.displayContributions && | ||
format.githubRepoSlug && | ||
this.githubUsername | ||
) { | ||
const contributionsURL = `https://github.com/${format.githubRepoSlug}/commits?author=${this.githubUsername}` | ||
parts.push( | ||
`— [view contributions](${contributionsURL} "View the GitHub contributions of ${this.name} on repository ${format.githubRepoSlug}")` | ||
) | ||
} | ||
// return | ||
return parts.join(' ') | ||
} | ||
toHTML(format: FormatOptions = {}): string { | ||
if (!this.name) return '' | ||
const parts = [] | ||
// copyright | ||
if (format.displayCopyright) parts.push('Copyright ©') | ||
if (format.displayYears && this.years) parts.push(this.years) | ||
// name + url | ||
if (this.url) parts.push(`<a href="${this.url}">${this.name}</a>`) | ||
else parts.push(this.name) | ||
if (format.displayEmail && this.email) { | ||
parts.push( | ||
`<a href="mailto:${this.email}" title="Email ${this.name}"><${this.email}></a>` | ||
) | ||
} | ||
// contributions | ||
if ( | ||
format.displayContributions && | ||
format.githubRepoSlug && | ||
this.githubUsername | ||
) { | ||
const contributionsURL = `https://github.com/${format.githubRepoSlug}/commits?author=${this.githubUsername}` | ||
parts.push( | ||
`— <a href="${contributionsURL}" title="View the GitHub contributions of ${this.name} on repository ${format.githubRepoSlug}">view contributions</a>` | ||
) | ||
} | ||
// return | ||
return parts.join(' ') | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
59507
1227
1