Comparing version 3.3.0 to 4.0.0-next.1585178013.5f27cd31df03a2459b18fc88761c347324d633dd
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
'use strict' | ||
/** | ||
@@ -14,17 +14,117 @@ * A fellow with similarties to other people. | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { | ||
'@babel/helpers - typeof' | ||
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') { | ||
_typeof = function _typeof(obj) { | ||
return typeof obj | ||
} | ||
} else { | ||
_typeof = function _typeof(obj) { | ||
return obj && | ||
typeof Symbol === 'function' && | ||
obj.constructor === Symbol && | ||
obj !== Symbol.prototype | ||
? 'symbol' | ||
: typeof obj | ||
} | ||
} | ||
return _typeof(obj) | ||
} | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _createForOfIteratorHelper(o) { | ||
if (typeof Symbol === 'undefined' || o[Symbol.iterator] == null) { | ||
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { | ||
var i = 0 | ||
var F = function F() {} | ||
return { | ||
s: F, | ||
n: function n() { | ||
if (i >= o.length) return { done: true } | ||
return { done: false, value: o[i++] } | ||
}, | ||
e: function e(_e) { | ||
throw _e | ||
}, | ||
f: F, | ||
} | ||
} | ||
throw new TypeError( | ||
'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.' | ||
) | ||
} | ||
var it, | ||
normalCompletion = true, | ||
didErr = false, | ||
err | ||
return { | ||
s: function s() { | ||
it = o[Symbol.iterator]() | ||
}, | ||
n: function n() { | ||
var step = it.next() | ||
normalCompletion = step.done | ||
return step | ||
}, | ||
e: function e(_e2) { | ||
didErr = true | ||
err = _e2 | ||
}, | ||
f: function f() { | ||
try { | ||
if (!normalCompletion && it.return != null) it.return() | ||
} finally { | ||
if (didErr) throw err | ||
} | ||
}, | ||
} | ||
} | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return | ||
if (typeof o === 'string') return _arrayLikeToArray(o, minLen) | ||
var n = Object.prototype.toString.call(o).slice(8, -1) | ||
if (n === 'Object' && o.constructor) n = o.constructor.name | ||
if (n === 'Map' || n === 'Set') return Array.from(n) | ||
if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) | ||
return _arrayLikeToArray(o, minLen) | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) { | ||
arr2[i] = arr[i] | ||
} | ||
return arr2 | ||
} | ||
var Fellow = | ||
/*#__PURE__*/ | ||
function () { | ||
_createClass(Fellow, [{ | ||
key: "compare", | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError('Cannot call a class as a function') | ||
} | ||
} | ||
/** | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i] | ||
descriptor.enumerable = descriptor.enumerable || false | ||
descriptor.configurable = true | ||
if ('value' in descriptor) descriptor.writable = true | ||
Object.defineProperty(target, descriptor.key, descriptor) | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps) | ||
if (staticProps) _defineProperties(Constructor, staticProps) | ||
return Constructor | ||
} | ||
var Fellow = /*#__PURE__*/ (function () { | ||
_createClass( | ||
Fellow, | ||
[ | ||
{ | ||
key: 'compare', | ||
/** | ||
Compare a fellow to another fellow, uses ensureFields for the comparison | ||
@@ -35,65 +135,46 @@ If an ensureField is an array for both ourself and the other fellow, we will check to see if only one item of that array is similar (this is useful for email comparisons) | ||
*/ | ||
value: function compare(other) { | ||
var fields = this.ensureFields; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
value: function compare(other) { | ||
var fields = this.ensureFields | ||
try { | ||
for (var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var field = _step.value; | ||
var value = this[field]; | ||
var otherValue = other[field]; | ||
var _iterator = _createForOfIteratorHelper(fields), | ||
_step | ||
if (value && otherValue) { | ||
if (Array.isArray(value) && Array.isArray(otherValue)) { | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done; ) { | ||
var field = _step.value | ||
var value = this[field] | ||
var otherValue = other[field] | ||
try { | ||
for (var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var item = _step2.value; | ||
if (value && otherValue) { | ||
if (Array.isArray(value) && Array.isArray(otherValue)) { | ||
var _iterator2 = _createForOfIteratorHelper(value), | ||
_step2 | ||
if (otherValue.indexOf(item) !== -1) { | ||
return true; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return != null) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
} else if (value === otherValue) { | ||
return true; | ||
} | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
try { | ||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { | ||
var item = _step2.value | ||
return false; | ||
} | ||
/** | ||
if (otherValue.indexOf(item) !== -1) { | ||
return true | ||
} | ||
} | ||
} catch (err) { | ||
_iterator2.e(err) | ||
} finally { | ||
_iterator2.f() | ||
} | ||
} else if (value === otherValue) { | ||
return true | ||
} | ||
} | ||
} | ||
} catch (err) { | ||
_iterator.e(err) | ||
} finally { | ||
_iterator.f() | ||
} | ||
return false | ||
}, | ||
/** | ||
Get a fellow from the singleton list | ||
@@ -104,7 +185,7 @@ @method get | ||
*/ | ||
}, | ||
{ | ||
key: 'ensureFields', | ||
}, { | ||
key: "ensureFields", | ||
/** | ||
/** | ||
An array of fields that will denote if the user is the same user or not when using ensure | ||
@@ -114,19 +195,26 @@ @access protected | ||
*/ | ||
get: function get() { | ||
return ['emails', 'homepage', 'githubUsername', 'twitterUsername', 'facebookUsername']; | ||
} | ||
}, { | ||
key: "json", | ||
// ----------------------------------- | ||
// Properties | ||
get: function get() { | ||
return [ | ||
'emails', | ||
'homepage', | ||
'githubUsername', | ||
'twitterUsername', | ||
'facebookUsername', | ||
] | ||
}, | ||
}, | ||
{ | ||
key: 'json', | ||
// ----------------------------------- | ||
// Properties | ||
/** | ||
/** | ||
Get the serialisable values of this fellow | ||
@type {Object} | ||
*/ | ||
get: function get() { | ||
var json = JSON.parse(JSON.stringify(this)); | ||
return json; | ||
} | ||
/** | ||
get: function get() { | ||
var json = JSON.parse(JSON.stringify(this)) | ||
return json | ||
}, | ||
/** | ||
When fetching, | ||
@@ -139,18 +227,20 @@ Updating the email will add the email to the start of the `emails` array. | ||
*/ | ||
}, | ||
{ | ||
key: 'email', | ||
set: function set(value) { | ||
var index = this.emails.indexOf(value) | ||
}, { | ||
key: "email", | ||
set: function set(value) { | ||
var 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: function get() { | ||
return this.emails[0] || null; | ||
} | ||
/** | ||
this.emails.unshift(value) | ||
}, | ||
get: function get() { | ||
return this.emails[0] || null | ||
}, | ||
/** | ||
When setting, | ||
@@ -166,45 +256,53 @@ Will determine passed url is a github, facebook, or twitter url. | ||
*/ | ||
}, | ||
{ | ||
key: 'url', | ||
set: function set(value) { | ||
var githubMatch = /^.+github.com\/([^/]+)\/?$/.exec(value) | ||
}, { | ||
key: "url", | ||
set: function set(value) { | ||
var githubMatch = /^.+github.com\/([^/]+)\/?$/.exec(value); | ||
if (githubMatch) { | ||
this.githubUsername = githubMatch[1] | ||
this.githubUrl = 'https://github.com/' + this.githubUsername | ||
} else { | ||
var facebookMatch = /^.+facebook.com\/([^/]+)\/?$/.exec(value) | ||
if (githubMatch) { | ||
this.githubUsername = githubMatch[1]; | ||
this.githubUrl = 'https://github.com/' + this.githubUsername; | ||
} else { | ||
var facebookMatch = /^.+facebook.com\/([^/]+)\/?$/.exec(value); | ||
if (facebookMatch) { | ||
this.facebookUsername = facebookMatch[1] | ||
this.facebookUrl = 'https://facebook.com/' + this.facebookUsername | ||
} else { | ||
var twitterMatch = /^.+twitter.com\/([^/]+)\/?$/.exec(value) | ||
if (facebookMatch) { | ||
this.facebookUsername = facebookMatch[1]; | ||
this.facebookUrl = 'https://facebook.com/' + this.facebookUsername; | ||
} else { | ||
var twitterMatch = /^.+twitter.com\/([^/]+)\/?$/.exec(value); | ||
if (twitterMatch) { | ||
this.twitterUsername = twitterMatch[1] | ||
this.twitterUrl = 'https://twitter.com/' + this.twitterUsername | ||
} else { | ||
this.homepage = value.replace(/^https/, 'http') | ||
} | ||
} | ||
} | ||
}, | ||
get: function get() { | ||
return ( | ||
this.homepage || | ||
this.githubUrl || | ||
this.facebookUrl || | ||
this.twitterUrl || | ||
null | ||
) | ||
}, // ----------------------------------- | ||
// Methods | ||
if (twitterMatch) { | ||
this.twitterUsername = twitterMatch[1]; | ||
this.twitterUrl = 'https://twitter.com/' + this.twitterUsername; | ||
} else { | ||
this.homepage = value.replace(/^https/, 'http'); | ||
} | ||
} | ||
} | ||
}, | ||
get: function get() { | ||
return this.homepage || this.githubUrl || this.facebookUrl || this.twitterUrl || null; | ||
} // ----------------------------------- | ||
// Methods | ||
/** | ||
/** | ||
Construct our fellow instance with the value | ||
@param {*} value - The value used to set the properties of the fellow, forwarded to set | ||
*/ | ||
}, | ||
], | ||
[ | ||
{ | ||
key: 'create', | ||
// ----------------------------------- | ||
// Static Helpers | ||
}], [{ | ||
key: "create", | ||
// ----------------------------------- | ||
// Static Helpers | ||
/** | ||
/** | ||
Create a new Fellow instance with the value, however if the value is already a fellow instance, then just return it | ||
@@ -215,6 +313,6 @@ @static | ||
*/ | ||
value: function create(value) { | ||
return value instanceof this ? value : new this(value); | ||
} | ||
/** | ||
value: function create(value) { | ||
return value instanceof this ? value : new this(value) | ||
}, | ||
/** | ||
A singleton array attached to the class object that stores it's people objects | ||
@@ -224,7 +322,7 @@ @static | ||
*/ | ||
}, | ||
{ | ||
key: 'ensure', | ||
}, { | ||
key: "ensure", | ||
/** | ||
/** | ||
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 | ||
@@ -236,46 +334,41 @@ @static | ||
*/ | ||
value: function ensure(value) { | ||
var add = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
var newFellow = this.create(value); | ||
var people = this.list; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
value: function ensure(value) { | ||
var add = | ||
arguments.length > 1 && arguments[1] !== undefined | ||
? arguments[1] | ||
: true | ||
var newFellow = this.create(value) | ||
var people = this.list | ||
try { | ||
for (var _iterator3 = people[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var existingFellow = _step3.value; | ||
var _iterator3 = _createForOfIteratorHelper(people), | ||
_step3 | ||
if (newFellow.compare(existingFellow)) { | ||
return existingFellow.set(value); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return != null) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
} | ||
try { | ||
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { | ||
var existingFellow = _step3.value | ||
if (add) { | ||
people.push(newFellow); | ||
return newFellow; | ||
} else { | ||
return null; | ||
} | ||
} | ||
}, { | ||
key: "get", | ||
value: function get(value) { | ||
return this.ensure(value, false); | ||
} | ||
/** | ||
if (newFellow.compare(existingFellow)) { | ||
return existingFellow.set(value) | ||
} | ||
} | ||
} catch (err) { | ||
_iterator3.e(err) | ||
} finally { | ||
_iterator3.f() | ||
} | ||
if (add) { | ||
people.push(newFellow) | ||
return newFellow | ||
} else { | ||
return null | ||
} | ||
}, | ||
}, | ||
{ | ||
key: 'get', | ||
value: function get(value) { | ||
return this.ensure(value, false) | ||
}, | ||
/** | ||
Add a fellow or a series of people, denoted by the value, to the singleton list | ||
@@ -286,25 +379,25 @@ @static | ||
*/ | ||
}, | ||
{ | ||
key: 'add', | ||
value: function add(value) { | ||
var _this = this | ||
}, { | ||
key: "add", | ||
value: function add(value) { | ||
var _this = this; | ||
if (value instanceof this) { | ||
return [this.ensure(value)]; | ||
} else if (typeof value === 'string') { | ||
return value.split(/, +/).map(function (fellow) { | ||
return _this.ensure(fellow); | ||
}); | ||
} else if (Array.isArray(value)) { | ||
return value.map(function (value) { | ||
return _this.ensure(value); | ||
}); | ||
} else if (value) { | ||
return [this.ensure(value)]; | ||
} else { | ||
return []; | ||
} | ||
} | ||
/** | ||
if (value instanceof this) { | ||
return [this.ensure(value)] | ||
} else if (typeof value === 'string') { | ||
return value.split(/, +/).map(function (fellow) { | ||
return _this.ensure(fellow) | ||
}) | ||
} else if (Array.isArray(value)) { | ||
return value.map(function (value) { | ||
return _this.ensure(value) | ||
}) | ||
} else if (value) { | ||
return [this.ensure(value)] | ||
} else { | ||
return [] | ||
} | ||
}, | ||
/** | ||
Get all fellows who contribute to a particular repository | ||
@@ -315,11 +408,11 @@ @static | ||
*/ | ||
}, { | ||
key: "contributesRepository", | ||
value: function contributesRepository(repoSlug) { | ||
return this.list.filter(function (fellow) { | ||
return fellow.ensureRepository(repoSlug).contributes; | ||
}); | ||
} | ||
/** | ||
}, | ||
{ | ||
key: 'contributesRepository', | ||
value: function contributesRepository(repoSlug) { | ||
return this.list.filter(function (fellow) { | ||
return fellow.ensureRepository(repoSlug).contributes | ||
}) | ||
}, | ||
/** | ||
Get all fellows who maintain a particular repository | ||
@@ -330,11 +423,11 @@ @static | ||
*/ | ||
}, { | ||
key: "maintainsRepository", | ||
value: function maintainsRepository(repoSlug) { | ||
return this.list.filter(function (fellow) { | ||
return fellow.ensureRepository(repoSlug).maintains; | ||
}); | ||
} | ||
/** | ||
}, | ||
{ | ||
key: 'maintainsRepository', | ||
value: function maintainsRepository(repoSlug) { | ||
return this.list.filter(function (fellow) { | ||
return fellow.ensureRepository(repoSlug).maintains | ||
}) | ||
}, | ||
/** | ||
Get all fellows who author a particular repository | ||
@@ -345,25 +438,28 @@ @static | ||
*/ | ||
}, | ||
{ | ||
key: 'authorsRepository', | ||
value: function authorsRepository(repoSlug) { | ||
return this.list.filter(function (fellow) { | ||
return fellow.ensureRepository(repoSlug).authors | ||
}) | ||
}, | ||
}, | ||
{ | ||
key: 'list', | ||
get: function get() { | ||
if (this._list == null) this._list = [] | ||
return this._list | ||
}, | ||
}, | ||
] | ||
) | ||
}, { | ||
key: "authorsRepository", | ||
value: function authorsRepository(repoSlug) { | ||
return this.list.filter(function (fellow) { | ||
return fellow.ensureRepository(repoSlug).authors; | ||
}); | ||
} | ||
}, { | ||
key: "list", | ||
get: function get() { | ||
if (this._list == null) this._list = []; | ||
return this._list; | ||
} | ||
}]); | ||
function Fellow(value) { | ||
_classCallCheck(this, Fellow) | ||
function Fellow(value) { | ||
_classCallCheck(this, Fellow); | ||
if (!this.emails) this.emails = []; | ||
this.set(value); | ||
} | ||
/** | ||
if (!this.emails) this.emails = [] | ||
this.set(value) | ||
} | ||
/** | ||
Update our fellow with the passed value | ||
@@ -374,50 +470,57 @@ @param {String|Object} fellow - A string in the format of "Benjamin Lupton <b@lupton.cc> (https://balupton.com)" or an object with properties | ||
_createClass(Fellow, [ | ||
{ | ||
key: 'set', | ||
value: function set(fellow) { | ||
var _this2 = this | ||
_createClass(Fellow, [{ | ||
key: "set", | ||
value: function set(fellow) { | ||
var _this2 = this; | ||
// String format | ||
// Benjamin Lupton <b@lupton.cc> (https://balupton.com) | ||
if (typeof fellow === 'string') { | ||
var match = /^([^<(]+)\s*(?:<(.+?)>)?\s*(?:\((.+?)\))?$/.exec(fellow) | ||
// String format | ||
// Benjamin Lupton <b@lupton.cc> (https://balupton.com) | ||
if (typeof fellow === 'string') { | ||
var match = /^([^<(]+)\s*(?:<(.+?)>)?\s*(?:\((.+?)\))?$/.exec(fellow); | ||
if (!match) { | ||
throw new Error('Invalid fellow string') | ||
} | ||
if (!match) { | ||
throw new Error('Invalid fellow string'); | ||
} | ||
var name = (match[1] || '').trim() || null | ||
var email = (match[2] || '').trim() || null | ||
var url = (match[3] || '').trim() || null | ||
if (name) this.name = name | ||
if (email) this.email = email | ||
if (url) this.url = url | ||
} // Object Format | ||
else if (_typeof(fellow) === 'object') { | ||
var urlFields = [ | ||
'url', | ||
'homepage', | ||
'web', | ||
'githubUrl', | ||
'twitterUrl', | ||
'facebookUrl', | ||
] | ||
Object.keys(fellow).forEach(function (key) { | ||
if (key[0] === '_') return // skip if private | ||
var name = (match[1] || '').trim() || null; | ||
var email = (match[2] || '').trim() || null; | ||
var url = (match[3] || '').trim() || null; | ||
if (name) this.name = name; | ||
if (email) this.email = email; | ||
if (url) this.url = url; | ||
} // Object Format | ||
else if (_typeof(fellow) === 'object') { | ||
var urlFields = ['url', 'homepage', 'web', 'githubUrl', 'twitterUrl', 'facebookUrl']; | ||
Object.keys(fellow).forEach(function (key) { | ||
if (key[0] === '_') return; // skip if private | ||
var value = fellow[key] || null | ||
var value = fellow[key] || null; | ||
if (value) { | ||
// if not a url field, e.g. name or email | ||
if (urlFields.indexOf(key) === -1) { | ||
_this2[key] = value | ||
} // if any of the url fields, redirect to url setter | ||
else { | ||
_this2.url = value | ||
} | ||
} | ||
}) | ||
} else { | ||
throw new Error('Invalid fellow input') | ||
} | ||
if (value) { | ||
// if not a url field, e.g. name or email | ||
if (urlFields.indexOf(key) === -1) { | ||
_this2[key] = value; | ||
} // if any of the url fields, redirect to url setter | ||
else { | ||
_this2.url = value; | ||
} | ||
} | ||
}); | ||
} else { | ||
throw new Error('Invalid fellow input'); | ||
} | ||
return this | ||
}, // ----------------------------------- | ||
// Repos | ||
return this; | ||
} // ----------------------------------- | ||
// Repos | ||
/** | ||
/** | ||
Ensures that the github repository exists on the class | ||
@@ -428,23 +531,24 @@ @private | ||
*/ | ||
}, { | ||
key: "ensureRepository", | ||
value: function 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]; | ||
} | ||
/** | ||
}, | ||
{ | ||
key: 'ensureRepository', | ||
value: function 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] | ||
}, | ||
/** | ||
Get all added github repository slugs that this fellow contributes to | ||
@type {Array} | ||
*/ | ||
}, | ||
{ | ||
key: 'contributesRepository', | ||
}, { | ||
key: "contributesRepository", | ||
/** | ||
/** | ||
Make note that this fellow contributes to this repository slug | ||
@@ -454,15 +558,15 @@ @param {String} slug - The github repository slug that this user contributes to | ||
*/ | ||
value: function contributesRepository(slug) { | ||
this.ensureRepository(slug).contributes = true; | ||
return this; | ||
} | ||
/** | ||
value: function contributesRepository(slug) { | ||
this.ensureRepository(slug).contributes = true | ||
return this | ||
}, | ||
/** | ||
Get all added github repository slugs that this fellow maintains | ||
@type {Array} | ||
*/ | ||
}, | ||
{ | ||
key: 'maintainsRepository', | ||
}, { | ||
key: "maintainsRepository", | ||
/** | ||
/** | ||
Make note that this fellow maintains this repository slug | ||
@@ -472,15 +576,15 @@ @param {String} slug - The github repository slug that this user maintains | ||
*/ | ||
value: function maintainsRepository(slug) { | ||
this.ensureRepository(slug).maintains = true; | ||
return this; | ||
} | ||
/** | ||
value: function maintainsRepository(slug) { | ||
this.ensureRepository(slug).maintains = true | ||
return this | ||
}, | ||
/** | ||
Get all added github repository slugs that this fellow authors | ||
@type {Array} | ||
*/ | ||
}, | ||
{ | ||
key: 'authorsRepository', | ||
}, { | ||
key: "authorsRepository", | ||
/** | ||
/** | ||
Make note that this fellow authors this repository slug | ||
@@ -490,42 +594,45 @@ @param {String} slug - The github repository slug that this user authors | ||
*/ | ||
value: function authorsRepository(slug) { | ||
this.ensureRepository(slug).authors = true; | ||
return this; | ||
} | ||
}, { | ||
key: "contributedRepositories", | ||
get: function get() { | ||
var _this3 = this; | ||
value: function authorsRepository(slug) { | ||
this.ensureRepository(slug).authors = true | ||
return this | ||
}, | ||
}, | ||
{ | ||
key: 'contributedRepositories', | ||
get: function get() { | ||
var _this3 = this | ||
return Object.keys(this._Repositories || {}).filter(function (slug) { | ||
var repo = _this3._Repositories[slug]; | ||
return repo && repo.contributes; | ||
}); | ||
} | ||
}, { | ||
key: "maintainedRepositories", | ||
get: function get() { | ||
var _this4 = this; | ||
return Object.keys(this._Repositories || {}).filter(function (slug) { | ||
var repo = _this3._Repositories[slug] | ||
return repo && repo.contributes | ||
}) | ||
}, | ||
}, | ||
{ | ||
key: 'maintainedRepositories', | ||
get: function get() { | ||
var _this4 = this | ||
return Object.keys(this._Repositories || {}).filter(function (slug) { | ||
var repo = _this4._Repositories[slug]; | ||
return repo && repo.maintains; | ||
}); | ||
} | ||
}, { | ||
key: "authoredRepositories", | ||
get: function get() { | ||
var _this5 = this; | ||
return Object.keys(this._Repositories || {}).filter(function (slug) { | ||
var repo = _this4._Repositories[slug] | ||
return repo && repo.maintains | ||
}) | ||
}, | ||
}, | ||
{ | ||
key: 'authoredRepositories', | ||
get: function get() { | ||
var _this5 = this | ||
return Object.keys(this._Repositories || {}).filter(function (slug) { | ||
var repo = _this5._Repositories[slug]; | ||
return repo && repo.authors; | ||
}); | ||
} | ||
}]); | ||
return Object.keys(this._Repositories || {}).filter(function (slug) { | ||
var repo = _this5._Repositories[slug] | ||
return repo && repo.authors | ||
}) | ||
}, | ||
}, | ||
]) | ||
return Fellow; | ||
}(); // Export | ||
return Fellow | ||
})() // Export | ||
module.exports = Fellow; | ||
module.exports = Fellow |
# History | ||
## v4.0.0 2020 March 26 | ||
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) | ||
- Minimum required node version changed from `node: >=8` to `node: >=10` to keep up with mandatory ecosystem changes | ||
## v3.3.0 2019 December 9 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "fellow", | ||
"version": "3.3.0", | ||
"version": "4.0.0-next.1585178013.5f27cd31df03a2459b18fc88761c347324d633dd", | ||
"description": "Fellow is a package for creating people that can be unified by their shared values via a singleton list on the class", | ||
@@ -8,13 +8,16 @@ "homepage": "https://github.com/bevry/fellow", | ||
"keywords": [ | ||
"author", | ||
"authors", | ||
"browser", | ||
"contributor", | ||
"contributors", | ||
"fellow", | ||
"person", | ||
"people", | ||
"user", | ||
"github user", | ||
"contributor", | ||
"contributors", | ||
"maintainer", | ||
"maintainers", | ||
"author", | ||
"authors" | ||
"people", | ||
"person", | ||
"typed", | ||
"types", | ||
"user" | ||
], | ||
@@ -58,4 +61,3 @@ "badges": { | ||
"contributors": [ | ||
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)", | ||
"dependabot-preview[bot] (http://github.com/apps/dependabot-preview)" | ||
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)" | ||
], | ||
@@ -70,7 +72,7 @@ "bugs": { | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=10" | ||
}, | ||
"editions": [ | ||
{ | ||
"description": "esnext source code with require for modules", | ||
"description": "ESNext source code for Node.js with Require for modules", | ||
"directory": "source", | ||
@@ -84,3 +86,3 @@ "entry": "index.js", | ||
"engines": { | ||
"node": "8 || 10 || 12", | ||
"node": "10 || 12", | ||
"browsers": false | ||
@@ -90,3 +92,3 @@ } | ||
{ | ||
"description": "esnext compiled for browsers with require for modules", | ||
"description": "ESNext compiled for web browsers with Require for modules", | ||
"directory": "edition-browsers", | ||
@@ -108,19 +110,19 @@ "entry": "index.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.7.5", | ||
"@babel/core": "^7.7.5", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.7.4", | ||
"@babel/preset-env": "^7.7.6", | ||
"assert-helpers": "^5.8.0", | ||
"eslint": "^6.7.2", | ||
"eslint-config-bevry": "^2.3.0", | ||
"eslint-config-prettier": "^6.7.0", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.9.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.9.0", | ||
"@babel/preset-env": "^7.9.0", | ||
"assert-helpers": "^6.0.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-bevry": "^3.0.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-plugin-babel": "^5.3.0", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"jsdoc": "^3.6.3", | ||
"kava": "^4.3.0", | ||
"kava": "^4.4.0", | ||
"minami": "^1.2.3", | ||
"prettier": "^1.19.1", | ||
"projectz": "^1.15.0", | ||
"prettier": "^2.0.2", | ||
"projectz": "^1.19.0", | ||
"surge": "^0.21.3", | ||
"valid-directory": "^1.5.0" | ||
"valid-directory": "^1.6.0" | ||
}, | ||
@@ -146,5 +148,5 @@ "scripts": { | ||
"our:verify": "npm run our:verify:directory && npm run our:verify:eslint && npm run our:verify:prettier", | ||
"our:verify:directory": "npx valid-directory", | ||
"our:verify:directory": "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", | ||
"our:verify:prettier": "prettier --write ./source/**", | ||
"our:verify:prettier": "prettier --write .", | ||
"test": "node ./source/test.js" | ||
@@ -169,3 +171,6 @@ }, | ||
{ | ||
"targets": "defaults", | ||
"targets": { | ||
"esmodules": false, | ||
"browsers": "defaults" | ||
}, | ||
"modules": false | ||
@@ -172,0 +177,0 @@ } |
@@ -36,2 +36,6 @@ <!-- TITLE/ --> | ||
## Usage | ||
[Complete API Documentation.](http://master.fellow.bevry.surge.sh/docs/) | ||
<!-- INSTALL/ --> | ||
@@ -44,3 +48,4 @@ | ||
<li>Install: <code>npm install --save fellow</code></li> | ||
<li>Require: <code>require('fellow')</code></li> | ||
<li>Import: <code>import * as pkg from ('fellow')</code></li> | ||
<li>Require: <code>const pkg = require('fellow')</code></li> | ||
</ul> | ||
@@ -52,3 +57,3 @@ | ||
<script type="module"> | ||
import * as pkg from '//dev.jspm.io/fellow' | ||
import * as pkg from '//dev.jspm.io/fellow@4.0.0' | ||
</script> | ||
@@ -62,4 +67,4 @@ ``` | ||
<ul><li><code>fellow</code> aliases <code>fellow/source/index.js</code></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></ul> | ||
<li><code>fellow/source/index.js</code> is <a href="https://en.wikipedia.org/wiki/ECMAScript#ES.Next" title="ECMAScript Next">ESNext</a> source code for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li> | ||
<li><code>fellow/edition-browsers/index.js</code> is <a href="https://en.wikipedia.org/wiki/ECMAScript#ES.Next" title="ECMAScript Next">ESNext</a> compiled for web browsers with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li></ul> | ||
@@ -81,6 +86,2 @@ <h3><a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a></h3> | ||
## Usage | ||
[API Documentation.](http://master.fellow.bevry.surge.sh/docs/) | ||
<!-- HISTORY/ --> | ||
@@ -112,3 +113,3 @@ | ||
<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> | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a></li></ul> | ||
@@ -133,4 +134,3 @@ <h3>Sponsors</h3> | ||
<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> | ||
<li><a href="http://github.com/apps/dependabot-preview">dependabot-preview[bot]</a> — <a href="https://github.com/bevry/fellow/commits?author=dependabot-preview[bot]" title="View the GitHub contributions of dependabot-preview[bot] on repository bevry/fellow">view contributions</a></li></ul> | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a></li></ul> | ||
@@ -137,0 +137,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> |
@@ -72,3 +72,3 @@ 'use strict' | ||
'twitterUsername', | ||
'facebookUsername' | ||
'facebookUsername', | ||
] | ||
@@ -124,5 +124,5 @@ } | ||
} else if (typeof value === 'string') { | ||
return value.split(/, +/).map(fellow => this.ensure(fellow)) | ||
return value.split(/, +/).map((fellow) => this.ensure(fellow)) | ||
} else if (Array.isArray(value)) { | ||
return value.map(value => this.ensure(value)) | ||
return value.map((value) => this.ensure(value)) | ||
} else if (value) { | ||
@@ -142,3 +142,3 @@ return [this.ensure(value)] | ||
static contributesRepository(repoSlug) { | ||
return this.list.filter(function(fellow) { | ||
return this.list.filter(function (fellow) { | ||
return fellow.ensureRepository(repoSlug).contributes | ||
@@ -155,3 +155,3 @@ }) | ||
static maintainsRepository(repoSlug) { | ||
return this.list.filter(function(fellow) { | ||
return this.list.filter(function (fellow) { | ||
return fellow.ensureRepository(repoSlug).maintains | ||
@@ -168,3 +168,3 @@ }) | ||
static authorsRepository(repoSlug) { | ||
return this.list.filter(function(fellow) { | ||
return this.list.filter(function (fellow) { | ||
return fellow.ensureRepository(repoSlug).authors | ||
@@ -292,5 +292,5 @@ }) | ||
'twitterUrl', | ||
'facebookUrl' | ||
'facebookUrl', | ||
] | ||
Object.keys(fellow).forEach(key => { | ||
Object.keys(fellow).forEach((key) => { | ||
if (key[0] === '_') return // skip if private | ||
@@ -331,3 +331,3 @@ const value = fellow[key] || null | ||
maintains: false, | ||
authors: false | ||
authors: false, | ||
} | ||
@@ -342,3 +342,3 @@ return this._Repositories[slug] | ||
get contributedRepositories() { | ||
return Object.keys(this._Repositories || {}).filter(slug => { | ||
return Object.keys(this._Repositories || {}).filter((slug) => { | ||
const repo = this._Repositories[slug] | ||
@@ -364,3 +364,3 @@ return repo && repo.contributes | ||
get maintainedRepositories() { | ||
return Object.keys(this._Repositories || {}).filter(slug => { | ||
return Object.keys(this._Repositories || {}).filter((slug) => { | ||
const repo = this._Repositories[slug] | ||
@@ -386,3 +386,3 @@ return repo && repo.maintains | ||
get authoredRepositories() { | ||
return Object.keys(this._Repositories || {}).filter(slug => { | ||
return Object.keys(this._Repositories || {}).filter((slug) => { | ||
const repo = this._Repositories[slug] | ||
@@ -389,0 +389,0 @@ return repo && repo.authors |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
45871
935
7
1