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

Commit c1c385c

Browse files
author
Pedro Santos
committed
fix: repo stat for string values
1 parent 4acd43e commit c1c385c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/repo/stat.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
const promisify = require('promisify-es6')
44
const Big = require('bignumber.js')
55

6-
const transform = function (res, callback) {
6+
const transform = ({ human }) => (res, callback) => {
7+
console.log('res', res)
8+
console.log('human', human)
79
callback(null, {
8-
numObjects: new Big(res.NumObjects),
9-
repoSize: new Big(res.RepoSize),
10+
numObjects: human ? res.NumObjects : new Big(res.NumObjects),
11+
repoSize: human ? res.RepoSize : new Big(res.RepoSize),
1012
repoPath: res.RepoPath,
1113
version: res.Version,
12-
storageMax: new Big(res.StorageMax)
14+
storageMax: human ? res.StorageMax : new Big(res.StorageMax)
1315
})
1416
}
1517

@@ -20,9 +22,11 @@ module.exports = (send) => {
2022
opts = {}
2123
}
2224

25+
console.log('OPTS', opts)
26+
2327
send.andTransform({
2428
path: 'repo/stat',
2529
qs: opts
26-
}, transform, callback)
30+
}, transform(opts), callback)
2731
})
2832
}

0 commit comments

Comments
 (0)