From f984dec95a432814ebbbb4f5b7d57c09ec27969a Mon Sep 17 00:00:00 2001 From: Manuel Wiedenmann Date: Wed, 24 Apr 2019 19:31:04 +0200 Subject: [PATCH] Style fixes --- lib/contracts/contributor.js | 2 +- lib/contracts/record.js | 4 ++-- lib/serializers/contributor.js | 28 ++++++++++++++-------------- lib/utils/format-kredits.js | 4 ++-- lib/utils/pagination.js | 6 +++--- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/contracts/contributor.js b/lib/contracts/contributor.js index 6a73260..3ca68b2 100644 --- a/lib/contracts/contributor.js +++ b/lib/contracts/contributor.js @@ -63,7 +63,7 @@ class Contributor extends Record { updateProfile (contributorId, updateAttr, callOptions = {}) { return this.getById(contributorId).then(async (contributor) => { - let updatedContributorAttr = Object.assign(contributor, updateAttr) + let updatedContributorAttr = Object.assign(contributor, updateAttr); let updatedContributor = new ContributorSerializer(updatedContributorAttr); try { await updatedContributor.validate(); } diff --git a/lib/contracts/record.js b/lib/contracts/record.js index a5d8e64..1e1f83a 100644 --- a/lib/contracts/record.js +++ b/lib/contracts/record.js @@ -2,7 +2,7 @@ const Base = require('./base'); const paged = require('../utils/pagination'); class Record extends Base { - all(options = {}) { + all (options = {}) { return this.count .then((count) => { let records = paged(count, options).map((id) => this.getById(id)); @@ -11,4 +11,4 @@ class Record extends Base { } } -module.exports = Record +module.exports = Record; diff --git a/lib/serializers/contributor.js b/lib/serializers/contributor.js index 16b4f19..92988cb 100644 --- a/lib/serializers/contributor.js +++ b/lib/serializers/contributor.js @@ -31,39 +31,39 @@ class Contributor { } = this; let data = { - "@context": "https://schema.kosmos.org", - "@type": "Contributor", + '@context': 'https://schema.kosmos.org', + '@type': 'Contributor', kind, name, - "accounts": [], + 'accounts': [], }; if (url) { - data["url"] = url; + data['url'] = url; } if (github_uid) { data.accounts.push({ - "site": "github.com", - "uid": github_uid, - "username": github_username, - "url": `https://github.com/${github_username}`, + 'site': 'github.com', + 'uid': github_uid, + 'username': github_username, + 'url': `https://github.com/${github_username}`, }); } if (gitea_username) { data.accounts.push({ - "site": "gitea.kosmos.org", - "username": gitea_username, - "url": `https://gitea.kosmos.org/${gitea_username}` + 'site': 'gitea.kosmos.org', + 'username': gitea_username, + 'url': `https://gitea.kosmos.org/${gitea_username}`, }); } if (wiki_username) { data.accounts.push({ - "site": "wiki.kosmos.org", - "username": wiki_username, - "url": `https://wiki.kosmos.org/User:${wiki_username}`, + 'site': 'wiki.kosmos.org', + 'username': wiki_username, + 'url': `https://wiki.kosmos.org/User:${wiki_username}`, }); } diff --git a/lib/utils/format-kredits.js b/lib/utils/format-kredits.js index 75e11c0..0c6b238 100644 --- a/lib/utils/format-kredits.js +++ b/lib/utils/format-kredits.js @@ -1,10 +1,10 @@ const ethersUtils = require('ethers').utils; -module.exports = function (value, options = {}) { +module.exports = function(value, options = {}) { let etherValue = ethersUtils.formatEther(value); if (options.asFloat) { return parseFloat(etherValue); } else { return parseInt(etherValue); } -} +}; diff --git a/lib/utils/pagination.js b/lib/utils/pagination.js index 02c2f97..35cfdeb 100644 --- a/lib/utils/pagination.js +++ b/lib/utils/pagination.js @@ -1,4 +1,4 @@ -function pageNumber(number, size, recordCount) { +function pageNumber (number, size, recordCount) { let numberOfPages = Math.ceil(recordCount / size); number = parseInt(number) || 1; @@ -10,7 +10,7 @@ function pageNumber(number, size, recordCount) { return number; } -function buildIds(order, number, size, recordCount) { +function buildIds (order, number, size, recordCount) { let offset = size * (number - 1); let start; @@ -34,7 +34,7 @@ function buildIds(order, number, size, recordCount) { return Array.from({ length: size }, mapFunction); } -module.exports = function paged(recordCount, options = {}) { +module.exports = function paged (recordCount, options = {}) { let { order, page } = options; order = order || 'desc'; page = page || {};