All files legend.js

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                5x   22x                 5x  
import { pipe, map, join, toPairs } from "f-utility"
import chalk from "chalk"
 
/**
@method printBlocks
@param {Object} analysis - an analysis object
@returns {string} a printed and colored string of analysis blocks
*/
export const printBlocks = pipe(
  toPairs,
  map(([key, value]) => `${chalk.black(value.fn(` ${value.key} `))} = ${key}`),
  join(` `)
)
 
/**
@method printLegend
@param {Object} lookup - the legend object
@return {string} the lookup as a printed and colored string
*/
export const printLegend = lookup => `LEGEND: ${printBlocks(lookup)}\n`