1
0
mirror of https://github.com/thangisme/notes.git synced 2025-09-24 01:14:11 -04:00

Initial commit

This commit is contained in:
Patrick Marsceill
2017-03-09 13:16:08 -05:00
commit b7b0d0d7bf
4147 changed files with 401224 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
"use strict"
const chalk = require("chalk")
const path = require("path")
function logFrom(fromValue) {
if (fromValue.charAt(0) === "<") return fromValue
return path.relative(process.cwd(), fromValue).split(path.sep).join("/")
}
module.exports = function (report) {
let output = ""
report.forEach(sourceReport => {
if (!sourceReport.ranges || sourceReport.ranges.length === 0) {
return
}
output += "\n"
output += chalk.underline(logFrom(sourceReport.source)) + "\n"
sourceReport.ranges.forEach(range => {
output += `start: ${range.start}`
if (range.end !== undefined) {
output += `, end: ${range.end}`
}
output += "\n"
})
})
return output
}