New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fellow

Package Overview
Dependencies
Maintainers
2
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fellow - npm Package Compare versions

Comparing version

to
2.4.0

edition-browsers/index.js

36

HISTORY.md
# History
## v2.4.0 2019 January 1
- Fixed `twitterUrl` not being set due to a typo
- Updated [base files](https://github.com/bevry/base) and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
## v2.3.0 2016 June 13
- Fellow homepage will now change `https` to `http` to prevent duplicates
- Fellow homepage will now change `https` to `http` to prevent duplicates
## v2.2.0 2016 April 30
- Updated internal conventions
- Updated internal conventions
## v2.1.0 2015 December 9
- Updated internal conventions
- Updated internal conventions
## v2.0.0 2015 September 18
- Removed `years`, it was too specific to the [bevry/projectz](https://github.com/bevry/projectz) use case
- Added new `compare` method
- Added new `json` dynamic property
- Setting an `email` will now keep an `emails` array up to date, for multiple email support
- Renamed `setValue` to just `set`
- `ensureFields` no longer caches, and now supports array fields
- Removed `years`, it was too specific to the [bevry/projectz](https://github.com/bevry/projectz) use case
- Added new `compare` method
- Added new `json` dynamic property
- Setting an `email` will now keep an `emails` array up to date, for multiple email support
- Renamed `setValue` to just `set`
- `ensureFields` no longer caches, and now supports array fields
## v1.2.0 2015 September 16
- Added name fallbacks to githubUsername then twitterUsername
- Added name fallbacks to githubUsername then twitterUsername
## v1.1.0 2015 September 16
- Added repository helpers
- Added repository helpers
## v1.0.0 2015 September 16
- Initial working release
- Initial working release

@@ -1,3 +0,4 @@

// 2016 March 8
// https://github.com/bevry/editions
'use strict'
/** @type {typeof import("./source/index.js") } */
module.exports = require('editions').requirePackage(__dirname, require)
{
"name": "fellow",
"version": "2.3.0",
"version": "2.4.0",
"description": "Fellow is a package for creating people that can be unified by their shared values via a singleton list on the class",

@@ -28,18 +28,22 @@ "homepage": "https://github.com/bevry/fellow",

"---",
"slackin",
"patreon",
"gratipay",
"flattr",
"liberapay",
"thanksapp",
"boostlab",
"buymeacoffee",
"opencollective",
"crypto",
"paypal",
"bitcoin",
"wishlist"
],
"config": {
"buymeacoffeeUsername": "balupton",
"cryptoURL": "https://bevry.me/crypto",
"flattrUsername": "balupton",
"liberapayUsername": "bevry",
"opencollectiveUsername": "bevry",
"patreonUsername": "bevry",
"gratipayUsername": "bevry",
"flattrUsername": "balupton",
"paypalURL": "https://bevry.me/paypal",
"bitcoinURL": "https://bevry.me/bitcoin",
"wishlistURL": "https://bevry.me/wishlist",
"slackinURL": "https://slack.bevry.me"
"wishlistURL": "https://bevry.me/wishlist"
}

@@ -49,6 +53,6 @@ },

"maintainers": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
],
"contributors": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
],

@@ -60,3 +64,3 @@ "bugs": {

"type": "git",
"url": "http://github.com/bevry/fellow.git"
"url": "https://github.com/bevry/fellow.git"
},

@@ -68,62 +72,135 @@ "engines": {

{
"description": "Source + ESNext + Require",
"entry": "source/index.js",
"description": "esnext source code with require for modules",
"directory": "source",
"syntaxes": [
"entry": "index.js",
"tags": [
"javascript",
"esnext",
"require",
"arrows",
"const",
"let",
"classes",
"defaults",
"forof",
"getset"
]
"require"
],
"engines": {
"node": "6 || 8 || 10 || 11",
"browsers": false
}
},
{
"description": "Babel Compiled + ES2015 + Require",
"entry": "es2015/index.js",
"directory": "es2015",
"syntaxes": [
"description": "esnext compiled for browsers with require for modules",
"directory": "edition-browsers",
"entry": "index.js",
"tags": [
"javascript",
"es2015",
"require"
]
],
"engines": {
"node": false,
"browsers": "defaults"
}
},
{
"description": "esnext compiled for node.js 0.12 with require for modules",
"directory": "edition-node-0.12",
"entry": "index.js",
"tags": [
"javascript",
"require"
],
"engines": {
"node": "0.12 || 4 || 6 || 8 || 10 || 11",
"browsers": false
}
}
],
"main": "index.js",
"browser": "es2015/index.js",
"browser": "edition-browsers/index.js",
"dependencies": {
"editions": "^2.1.3"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"assert-helpers": "^4.9.3",
"eslint": "^5.11.1",
"eslint-config-bevry": "^1.1.1",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-prettier": "^3.0.1",
"jsdoc": "^3.5.5",
"kava": "^3.1.0",
"minami": "^1.2.3",
"prettier": "^1.15.3",
"projectz": "^1.7.4",
"surge": "^0.20.1",
"valid-directory": "^1.0.0"
},
"scripts": {
"setup": "npm install",
"clean": "rm -Rf ./docs ./es2015",
"compile": "npm run compile:es2015",
"compile:es2015": "babel ./source --out-dir ./es2015 --presets es2015",
"meta": "npm run meta:docs && npm run meta:projectz",
"meta:docs": "documentation build -f html -o ./docs -g --shallow ./source/**.js",
"meta:projectz": "projectz compile",
"prepare": "npm run compile && npm run test && npm run meta",
"release": "npm run prepare && npm run release:publish && npm run release:tag && npm run release:push",
"release:publish": "npm publish",
"release:tag": "git tag v$npm_package_version -a",
"release:push": "git push origin master && git push origin --tags",
"pretest": "npm run test:eslint",
"test:eslint": "eslint ./source",
"test": "node --harmony -e \"require('editions').requirePackage(process.cwd(), require, 'test.js')\""
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next",
"our:compile": "npm run our:compile:edition-browsers && npm run our:compile:edition-node-0.12",
"our:compile:edition-browsers": "env BABEL_ENV=edition-browsers babel --out-dir ./edition-browsers ./source",
"our:compile:edition-node-0.12": "env BABEL_ENV=edition-node-0.12 babel --out-dir ./edition-node-0.12 ./source",
"our:deploy": "echo no need for this project",
"our:meta": "npm run our:meta:docs && npm run our:meta:projectz",
"our:meta:docs": "npm run our:meta:docs:jsdoc",
"our:meta:docs:jsdoc": "rm -Rf ./docs && jsdoc --recurse --pedantic --access all --destination ./docs --package ./package.json --readme ./README.md --template ./node_modules/minami ./source && mv ./docs/$npm_package_name/$npm_package_version/* ./docs/ && rm -Rf ./docs/$npm_package_name/$npm_package_version",
"our:meta:projectz": "projectz compile",
"our:release": "npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push",
"our:release:check-changelog": "cat ./HISTORY.md | grep v$npm_package_version || (echo add a changelog entry for v$npm_package_version && exit -1)",
"our:release:check-dirty": "git diff --exit-code",
"our:release:prepare": "npm run our:clean && npm run our:compile && npm run our:test && npm run our:meta",
"our:release:push": "git push origin master && git push origin --tags",
"our:release:tag": "export MESSAGE=$(cat ./HISTORY.md | sed -n \"/## v$npm_package_version/,/##/p\" | sed 's/## //' | awk 'NR>1{print buf}{buf = $0}') && test \"$MESSAGE\" || (echo 'proper changelog entry not found' && exit -1) && git tag v$npm_package_version -am \"$MESSAGE\"",
"our:setup": "npm run our:setup:npm",
"our:setup:npm": "npm install",
"our:test": "npm run our:verify && npm test",
"our:verify": "npm run our:verify:directory && npm run our:verify:eslint",
"our:verify:directory": "npx valid-directory",
"our:verify:eslint": "eslint --fix --ignore-pattern '**/*.d.ts' --ignore-pattern '**/vendor/' --ignore-pattern '**/node_modules/' --ext .mjs,.js,.jsx,.ts,.tsx ./source",
"test": "node ./test.js"
},
"dependencies": {
"editions": "^1.1.1"
"eslintConfig": {
"extends": [
"bevry"
]
},
"devDependencies": {
"assert-helpers": "^4.4.0",
"babel-cli": "^6.10.1",
"babel-preset-es2015": "^6.9.0",
"eslint": "^2.12.0",
"eslint-plugin-babel": "^3.2.0",
"joe": "^1.8.0",
"joe-reporter-console": "^1.2.1",
"projectz": "^1.1.6",
"documentation": "^4.0.0-beta5"
"prettier": {
"semi": false,
"singleQuote": true
},
"babel": {
"env": {
"edition-browsers": {
"sourceType": "script",
"presets": [
[
"@babel/preset-env",
{
"targets": "defaults",
"modules": "commonjs"
}
]
],
"plugins": [
"@babel/proposal-object-rest-spread"
]
},
"edition-node-0.12": {
"sourceType": "script",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "0.12"
},
"modules": "commonjs"
}
]
],
"plugins": [
"@babel/proposal-object-rest-spread"
]
}
}
}
}

@@ -16,8 +16,11 @@ <!-- TITLE/ -->

<br class="badge-separator" />
<span class="badge-slackin"><a href="https://slack.bevry.me" title="Join this project's slack community"><img src="https://slack.bevry.me/badge.svg" alt="Slack community badge" /></a></span>
<span class="badge-patreon"><a href="http://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-gratipay"><a href="https://www.gratipay.com/bevry" title="Donate weekly to this project using Gratipay"><img src="https://img.shields.io/badge/gratipay-donate-yellow.svg" alt="Gratipay donate button" /></a></span>
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span>
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
<span class="badge-thanksapp"><a href="https://givethanks.app/donate/npm/fellow" title="Donate to this project using Thanks App"><img src="https://img.shields.io/badge/thanksapp-donate-yellow.svg" alt="Thanks App donate button" /></a></span>
<span class="badge-boostlab"><a href="https://boost-lab.app/bevry/fellow" title="Donate to this project using Boost Lab"><img src="https://img.shields.io/badge/boostlab-donate-yellow.svg" alt="Boost Lab donate button" /></a></span>
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
<span class="badge-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin donate button" /></a></span>
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span>

@@ -39,25 +42,37 @@

<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>NPM</h3></a><ul>
<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>npm</h3></a>
<ul>
<li>Install: <code>npm install --save fellow</code></li>
<li>Module: <code>require('fellow')</code></li></ul>
<li>Require: <code>require('fellow')</code></li>
</ul>
<a href="http://browserify.org" title="Browserify lets you require('modules') in the browser by bundling up all of your dependencies"><h3>Browserify</h3></a><ul>
<li>Install: <code>npm install --save fellow</code></li>
<li>Module: <code>require('fellow')</code></li>
<li>CDN URL: <code>//wzrd.in/bundle/fellow@2.3.0</code></li></ul>
<a href="https://jspm.io" title="Native ES Modules CDN"><h3>jspm</h3></a>
<a href="http://enderjs.com" title="Ender is a full featured package manager for your browser"><h3>Ender</h3></a><ul>
<li>Install: <code>ender add fellow</code></li>
<li>Module: <code>require('fellow')</code></li></ul>
``` html
<script type="module">
import * as pkg from '//dev.jspm.io/fellow'
</script>
```
<h3><a href="https://github.com/bevry/editions" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3>
<h3><a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3>
<p>This package is published with the following editions:</p>
<ul><li><code>fellow</code> aliases <code>fellow/index.js</code> which uses <a href="https://github.com/bevry/editions" title="Editions are the best way to produce and consume packages you care about.">Editions</a> to automatically select the correct edition for the consumers environment</li>
<li><code>fellow/source/index.js</code> is Source + <a href="https://babeljs.io/docs/learn-es2015/" title="ECMAScript Next">ESNext</a> + <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a></li>
<li><code>fellow/es2015/index.js</code> is <a href="https://babeljs.io" title="The compiler for writing next generation JavaScript">Babel</a> Compiled + <a href="http://babeljs.io/docs/plugins/preset-es2015/" title="ECMAScript 2015">ES2015</a> + <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a></li></ul>
<ul><li><code>fellow</code> aliases <code>fellow/index.js</code> which uses <a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a> to automatically select the correct edition for the consumers environment</li>
<li><code>fellow/source/index.js</code> is esnext source code with require for modules</li>
<li><code>fellow/edition-browsers/index.js</code> is esnext compiled for browsers with require for modules</li>
<li><code>fellow/edition-node-0.12/index.js</code> is esnext compiled for node.js 0.12 with require for modules</li></ul>
<p>Older environments may need <a href="https://babeljs.io/docs/usage/polyfill/" title="A polyfill that emulates missing ECMAScript environment features">Babel's Polyfill</a> or something similar.</p>
<h3><a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a></h3>
This project provides its type information via inline <a href="http://usejsdoc.org" title="JSDoc is an API documentation generator for JavaScript, similar to Javadoc or phpDocumentor">JSDoc Comments</a>. To make use of this in <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a>, set your <code>maxNodeModuleJsDepth</code> compiler option to `5` or thereabouts. You can accomlish this via your `tsconfig.json` file like so:
``` json
{
"compilerOptions": {
"maxNodeModuleJsDepth": 5
}
}
```
<!-- /INSTALL -->

@@ -68,7 +83,4 @@

- [Technical Documentation](https://rawgit.com/bevry/fellow/master/docs/index.html)
- [Source Code](https://github.com/bevry/fellow/blob/master/esnext/lib/fellow.js#files)
- [Test Code](https://github.com/bevry/fellow/blob/master/esnext/lib/fellow-test.js#files)
[API Documentation.](http://master.fellow.bevry.surge.sh/docs/)
<!-- HISTORY/ -->

@@ -100,3 +112,3 @@

<ul><li><a href="https://github.com/balupton">Benjamin Lupton</a> — <a href="https://github.com/bevry/fellow/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/fellow">view contributions</a></li></ul>
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/fellow/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/fellow">view contributions</a></li></ul>

@@ -107,7 +119,11 @@ <h3>Sponsors</h3>

<span class="badge-patreon"><a href="http://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-gratipay"><a href="https://www.gratipay.com/bevry" title="Donate weekly to this project using Gratipay"><img src="https://img.shields.io/badge/gratipay-donate-yellow.svg" alt="Gratipay donate button" /></a></span>
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span>
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
<span class="badge-thanksapp"><a href="https://givethanks.app/donate/npm/fellow" title="Donate to this project using Thanks App"><img src="https://img.shields.io/badge/thanksapp-donate-yellow.svg" alt="Thanks App donate button" /></a></span>
<span class="badge-boostlab"><a href="https://boost-lab.app/bevry/fellow" title="Donate to this project using Boost Lab"><img src="https://img.shields.io/badge/boostlab-donate-yellow.svg" alt="Boost Lab donate button" /></a></span>
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
<span class="badge-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin donate button" /></a></span>
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span>

@@ -119,3 +135,3 @@

<ul><li><a href="https://github.com/balupton">Benjamin Lupton</a> — <a href="https://github.com/bevry/fellow/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/fellow">view contributions</a></li></ul>
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/fellow/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/fellow">view contributions</a></li></ul>

@@ -122,0 +138,0 @@ <a href="https://github.com/bevry/fellow/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>

@@ -0,18 +1,15 @@

'use strict'
/**
A fellow with similarties to other people.
Also contains the properties:
- {String} homepage
- {String} githubUrl
- {String} githubUsername
- {String} twitterUrl
- {String} twitterUsername
- {String} facebookUrl
- {String} facebookUsername
@class Fellow
*/
* A fellow with similarties to other people.
* @property {string} homepage
* @property {string} githubUrl
* @property {string} githubUsername
* @property {string} twitterUrl
* @property {string} twitterUsername
* @property {string} facebookUrl
* @property {string} facebookUsername
* @class
*/
class Fellow {
// -----------------------------------

@@ -27,3 +24,3 @@ // Static Helpers

*/
static create (value) {
static create(value) {
return value instanceof this ? value : new this(value)

@@ -37,4 +34,4 @@ }

*/
static get list () {
if ( this._list == null ) this._list = []
static get list() {
if (this._list == null) this._list = []
return this._list

@@ -50,15 +47,14 @@ }

*/
static ensure (value, add = true) {
static ensure(value, add = true) {
const newFellow = this.create(value)
const people = this.list
for ( const existingFellow of people ) {
if ( newFellow.compare(existingFellow) ) {
for (const existingFellow of people) {
if (newFellow.compare(existingFellow)) {
return existingFellow.set(value)
}
}
if ( add ) {
if (add) {
people.push(newFellow)
return newFellow
}
else {
} else {
return null

@@ -73,4 +69,10 @@ }

*/
get ensureFields () {
return ['emails', 'homepage', 'githubUsername', 'twitterUsername', 'facebookUsername']
get ensureFields() {
return [
'emails',
'homepage',
'githubUsername',
'twitterUsername',
'facebookUsername'
]
}

@@ -84,17 +86,16 @@

*/
compare (other) {
compare(other) {
const fields = this.ensureFields
for ( const field of fields ) {
for (const field of fields) {
const value = this[field]
const otherValue = other[field]
if ( value && otherValue ) {
if ( Array.isArray(value) && Array.isArray(otherValue) ) {
for ( const item of value ) {
if ( otherValue.indexOf(item) !== -1 ) {
if (value && otherValue) {
if (Array.isArray(value) && Array.isArray(otherValue)) {
for (const item of value) {
if (otherValue.indexOf(item) !== -1) {
return true
}
}
}
else if ( value === otherValue ) {
} else if (value === otherValue) {
return true

@@ -113,3 +114,3 @@ }

*/
static get (value) {
static get(value) {
return this.ensure(value, false)

@@ -124,16 +125,12 @@ }

*/
static add (value) {
if ( value instanceof this ) {
static add(value) {
if (value instanceof this) {
return [this.ensure(value)]
}
else if ( typeof value === 'string' ) {
return value.split(/, +/).map((fellow) => this.ensure(fellow))
}
else if ( Array.isArray(value) ) {
return value.map((value) => this.ensure(value))
}
else if ( value ) {
} else if (typeof value === 'string') {
return value.split(/, +/).map(fellow => this.ensure(fellow))
} else if (Array.isArray(value)) {
return value.map(value => this.ensure(value))
} else if (value) {
return [this.ensure(value)]
}
else {
} else {
return []

@@ -149,4 +146,4 @@ }

*/
static contributesRepository (repoSlug) {
return this.list.filter(function (fellow) {
static contributesRepository(repoSlug) {
return this.list.filter(function(fellow) {
return fellow.ensureRepository(repoSlug).contributes

@@ -162,4 +159,4 @@ })

*/
static maintainsRepository (repoSlug) {
return this.list.filter(function (fellow) {
static maintainsRepository(repoSlug) {
return this.list.filter(function(fellow) {
return fellow.ensureRepository(repoSlug).maintains

@@ -175,4 +172,4 @@ })

*/
static authorsRepository (repoSlug) {
return this.list.filter(function (fellow) {
static authorsRepository(repoSlug) {
return this.list.filter(function(fellow) {
return fellow.ensureRepository(repoSlug).authors

@@ -182,3 +179,2 @@ })

// -----------------------------------

@@ -191,3 +187,3 @@ // Properties

*/
get json () {
get json() {
const json = JSON.parse(JSON.stringify(this))

@@ -206,10 +202,12 @@ return json

*/
set email (value) {
set email(value) {
const index = this.emails.indexOf(value)
if ( index !== -1 ) {
this.emails = this.emails.slice(0, index).concat(this.emails.slice(index + 1))
if (index !== -1) {
this.emails = this.emails
.slice(0, index)
.concat(this.emails.slice(index + 1))
}
this.emails.unshift(value)
}
get email () {
get email() {
return this.emails[0] || null

@@ -230,21 +228,18 @@ }

*/
set url (value) {
const githubMatch = (/^.+github.com\/([^\/]+)\/?$/).exec(value)
if ( githubMatch ) {
set url(value) {
const githubMatch = /^.+github.com\/([^/]+)\/?$/.exec(value)
if (githubMatch) {
this.githubUsername = githubMatch[1]
this.githubUrl = 'https://github.com/' + this.githubUsername
}
else {
const facebookMatch = (/^.+facebook.com\/([^\/]+)\/?$/).exec(value)
if ( facebookMatch ) {
} else {
const facebookMatch = /^.+facebook.com\/([^/]+)\/?$/.exec(value)
if (facebookMatch) {
this.facebookUsername = facebookMatch[1]
this.facebookUrl = 'https://facebook.com/' + this.facebookUsername
}
else {
const twitterMatch = (/^.+twitter.com\/([^\/]+)\/?$/).exec(value)
if ( twitterMatch ) {
} else {
const twitterMatch = /^.+twitter.com\/([^/]+)\/?$/.exec(value)
if (twitterMatch) {
this.twitterUsername = twitterMatch[1]
this.twtterUrl = 'https://twitter.com/' + this.twitterUsername
}
else {
this.twitterUrl = 'https://twitter.com/' + this.twitterUsername
} else {
this.homepage = value.replace(/^https/, 'http')

@@ -255,7 +250,12 @@ }

}
get url () {
return this.homepage || this.githubUrl || this.facebookUrl || this.twitterUrl || null
get url() {
return (
this.homepage ||
this.githubUrl ||
this.facebookUrl ||
this.twitterUrl ||
null
)
}
// -----------------------------------

@@ -268,4 +268,4 @@ // Methods

*/
constructor (value) {
if ( !this.emails ) this.emails = []
constructor(value) {
if (!this.emails) this.emails = []
this.set(value)

@@ -279,8 +279,8 @@ }

*/
set (fellow) {
set(fellow) {
// String format
// Benjamin Lupton <b@lupton.cc> (https://balupton.com)
if ( typeof fellow === 'string' ) {
const match = (/^([^<(]+)\s*(?:<(.+?)>)?\s*(?:\((.+?)\))?$/).exec(fellow)
if ( !match ) {
if (typeof fellow === 'string') {
const match = /^([^<(]+)\s*(?:<(.+?)>)?\s*(?:\((.+?)\))?$/.exec(fellow)
if (!match) {
throw new Error('Invalid fellow string')

@@ -291,16 +291,23 @@ }

const url = (match[3] || '').trim() || null
if ( name ) this.name = name
if ( email ) this.email = email
if ( url ) this.url = url
if (name) this.name = name
if (email) this.email = email
if (url) this.url = url
}
// Object Format
else if ( typeof fellow === 'object' ) {
const urlFields = ['url', 'homepage', 'web', 'githubUrl', 'twitterUrl', 'facebookUrl']
Object.keys(fellow).forEach((key) => {
if ( key[0] === '_' ) return // skip if private
else if (typeof fellow === 'object') {
const urlFields = [
'url',
'homepage',
'web',
'githubUrl',
'twitterUrl',
'facebookUrl'
]
Object.keys(fellow).forEach(key => {
if (key[0] === '_') return // skip if private
const value = fellow[key] || null
if ( value ) {
if (value) {
// if not a url field, e.g. name or email
if ( urlFields.indexOf(key) === -1 ) {
if (urlFields.indexOf(key) === -1) {
this[key] = value

@@ -314,5 +321,3 @@ }

})
}
else {
} else {
throw new Error('Invalid fellow input')

@@ -324,3 +329,2 @@ }

// -----------------------------------

@@ -335,5 +339,10 @@ // Repos

*/
ensureRepository (slug) {
if ( this._Repositories == null ) this._Repositories = {}
if ( this._Repositories[slug] == null ) this._Repositories[slug] = {contributes: false, maintains: false, authors: false}
ensureRepository(slug) {
if (this._Repositories == null) this._Repositories = {}
if (this._Repositories[slug] == null)
this._Repositories[slug] = {
contributes: false,
maintains: false,
authors: false
}
return this._Repositories[slug]

@@ -346,4 +355,4 @@ }

*/
get contributedRepositories () {
return Object.keys(this._Repositories || {}).filter((slug) => {
get contributedRepositories() {
return Object.keys(this._Repositories || {}).filter(slug => {
const repo = this._Repositories[slug]

@@ -359,3 +368,3 @@ return repo && repo.contributes

*/
contributesRepository (slug) {
contributesRepository(slug) {
this.ensureRepository(slug).contributes = true

@@ -369,4 +378,4 @@ return this

*/
get maintainedRepositories () {
return Object.keys(this._Repositories || {}).filter((slug) => {
get maintainedRepositories() {
return Object.keys(this._Repositories || {}).filter(slug => {
const repo = this._Repositories[slug]

@@ -382,3 +391,3 @@ return repo && repo.maintains

*/
maintainsRepository (slug) {
maintainsRepository(slug) {
this.ensureRepository(slug).maintains = true

@@ -392,4 +401,4 @@ return this

*/
get authoredRepositories () {
return Object.keys(this._Repositories || {}).filter((slug) => {
get authoredRepositories() {
return Object.keys(this._Repositories || {}).filter(slug => {
const repo = this._Repositories[slug]

@@ -405,7 +414,6 @@ return repo && repo.authors

*/
authorsRepository (slug) {
authorsRepository(slug) {
this.ensureRepository(slug).authors = true
return this
}
}

@@ -412,0 +420,0 @@