Permalink
Browse files

Add feedback about number of redirects

  • Loading branch information...
Kikobeats committed May 3, 2018
1 parent 3544131 commit deea5c4b85ee45faea38f51688568239daa099a1
Showing with 8 additions and 3 deletions.
  1. +8 −3 bin/view/render.js
@@ -1,6 +1,6 @@
'use strict'
const { concat, toNumber, first, chain, map, reduce } = require('lodash')
const { size, concat, toNumber, first, chain, map, reduce } = require('lodash')
const prettyMs = require('pretty-ms')
const { EOL } = require('os')
@@ -53,8 +53,13 @@ const renderResume = ({ startTimestamp, count, links }) => {
const colorizeTimestamp = colorize[colorTimestamp](
`+${prettyMs(timestamp)}`
)
const urls = concat(requestUrl, redirectUrls).join('')
return `${colorizeStatusCode} ${urls} ${colorizeTimestamp}`
const urls = concat(requestUrl, redirectUrls)
const sizeRedirectUrls = size(redirectUrls)
const redirects = urls.join('')
const nRedirects = sizeRedirectUrls > 0 ? `(${sizeRedirectUrls}) ` : ''
return `${colorizeStatusCode} ${nRedirects}${redirects} ${colorizeTimestamp}`
}
).join(EOL)

0 comments on commit deea5c4

Please sign in to comment.