Skip to content
This repository was archived by the owner on Nov 10, 2021. It is now read-only.

Commit 6b83daa

Browse files
committed
Move feed item limit to config file. Run prettier.
1 parent 44c1e9a commit 6b83daa

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/lib/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

33
module.exports = {
4+
feedItemsPerPage: process.env.FEED_ITEMS_PER_PAGE || 30,
45
networkConfig: {
56
network: 'mainnet',
67
nftContract: 'KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton',

src/lib/utils.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict'
22

3-
const FEED_ITEMS_PER_PAGE = process.env.FEED_ITEMS_PER_PAGE || 30
4-
53
const axios = require('axios')
64
const conseil = require('conseil')
75
const _ = require('lodash')
86

7+
const { feedItemsPerPage } = require('config')
8+
99
module.exports = {
1010
getIpfsHash,
1111
getObjktById,
@@ -44,26 +44,26 @@ async function getObjktOwners(objkt) {
4444
).data
4545
const ownerCountList = _.values(owners)
4646

47-
let total = 0;
47+
let total = 0
4848

4949
if (ownerCountList.length) {
5050
total = ownerCountList.reduce((acc, i) => {
51-
const owned = parseInt(i)
51+
const owned = parseInt(i)
5252

53-
return owned > 0 ? acc + owned : acc
53+
return owned > 0 ? acc + owned : acc
5454
}, 0)
5555
}
5656

5757
return {
5858
total_amount: total,
59-
owners
59+
owners,
6060
}
6161
}
6262

6363
function paginateFeed(feed, cursor) {
6464
return feed.slice(
65-
cursor * FEED_ITEMS_PER_PAGE,
66-
cursor * FEED_ITEMS_PER_PAGE + FEED_ITEMS_PER_PAGE
65+
cursor * feedItemsPerPage,
66+
cursor * feedItemsPerPage + feedItemsPerPage
6767
)
6868
}
6969

0 commit comments

Comments
 (0)