istanbul-utils.js
function toYUICoverage(coverage) {
    var ret = {};

    addDerivedInfo(coverage);

    Object.keys(coverage).forEach(function (k) {
      var fileCoverage = coverage[k],
        lines = fileCoverage.l,
        functions = fileCoverage.f,
        fnMap = fileCoverage.fnMap,
        o;

      o = ret[k] = {
        lines: {},
        calledLines: 0,
        coveredLines: 0,
        functions: {},
        calledFunctions: 0,
        coveredFunctions: 0
      };
      Object.keys(lines).forEach(function (k) {
        o.lines[k] = lines[k];
        o.coveredLines += 1;
        if (lines[k] > 0) {
          o.calledLines += 1;
        }
      });
      Object.keys(functions).forEach(function (k) {
        var name = fnMap[k].name + ':' + fnMap[k].line;
        o.functions[name] = functions[k];
        o.coveredFunctions += 1;
        if (functions[k] > 0) {
          o.calledFunctions += 1;
        }
      });
    });
    return ret;
  }
function toYUICoverage(coverage) {
    var ret = {};

    addDerivedInfo(coverage);

    Object.keys(coverage).forEach(function (k) {
      var fileCoverage = coverage[k],
        lines = fileCoverage.l,
        functions = fileCoverage.f,
        fnMap = fileCoverage.fnMap,
        o;

      o = ret[k] = {
        lines: {},
        calledLines: 0,
        coveredLines: 0,
        functions: {},
        calledFunctions: 0,
        coveredFunctions: 0
      };
      Object.keys(lines).forEach(function (k) {
        o.lines[k] = lines[k];
        o.coveredLines += 1;
        if (lines[k] > 0) {
          o.calledLines += 1;
        }
      });
      Object.keys(functions).forEach(function (k) {
        var name = fnMap[k].name + ':' + fnMap[k].line;
        o.functions[name] = functions[k];
        o.coveredFunctions += 1;
        if (functions[k] > 0) {
          o.calledFunctions += 1;
        }
      });
    });
    return ret;
  }
function toYUICoverage ( coverage ) { var ret = { } ; addDerivedInfo ( coverage ) ; Object . keys ( coverage ) . forEach ( function ( k ) { var fileCoverage = coverage [ k ] , lines = fileCoverage . l , functions = fileCoverage . f , fnMap = fileCoverage . fnMap , o ; o = ret [ k ] = { lines : { } , calledLines : 0 , coveredLines : 0 , functions : { } , calledFunctions : 0 , coveredFunctions : 0 } ; Object . keys ( lines ) . forEach ( function ( k ) { o . lines [ k ] = lines [ k ] ; o . coveredLines += 1 ; if ( lines [ k ] > 0 ) { o . calledLines += 1 ; } } ) ; Object . keys ( functions ) . forEach ( function ( k ) { var name = fnMap [ k ] . name + ':' + fnMap [ k ] . line ; o . functions [ name ] = functions [ k ] ; o . coveredFunctions += 1 ; if ( functions [ k ] > 0 ) { o . calledFunctions += 1 ; } } ) ; } ) ; return ret ; }
makes the coverage object generated by this library yuitest_coverage compatible.
Note that this transformation is lossy since the returned object will not have
statement and branch coverage.

@method toYUICoverage
@static
@param {Object} coverage The `istanbul` coverage object
@return {Object} a coverage object in `yuitest_coverage` format.
makes the coverage object generated by this library yuitest_coverage compatible . Note that this transformation is lossy since the returned object will not have statement and branch coverage .