Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: repo stat for string values
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Santos committed Nov 11, 2019
1 parent 4acd43e commit c1c385c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/repo/stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
const promisify = require('promisify-es6')
const Big = require('bignumber.js')

const transform = function (res, callback) {
const transform = ({ human }) => (res, callback) => {
console.log('res', res)
console.log('human', human)
callback(null, {
numObjects: new Big(res.NumObjects),
repoSize: new Big(res.RepoSize),
numObjects: human ? res.NumObjects : new Big(res.NumObjects),
repoSize: human ? res.RepoSize : new Big(res.RepoSize),
repoPath: res.RepoPath,
version: res.Version,
storageMax: new Big(res.StorageMax)
storageMax: human ? res.StorageMax : new Big(res.StorageMax)
})
}

Expand All @@ -20,9 +22,11 @@ module.exports = (send) => {
opts = {}
}

console.log('OPTS', opts)

send.andTransform({
path: 'repo/stat',
qs: opts
}, transform, callback)
}, transform(opts), callback)
})
}

0 comments on commit c1c385c

Please sign in to comment.