build/compare-size.js
function(src) {
    var cache;

    try {
      cache = fs.existsSync(src) ? file.readJSON(src) : undefined;
    } catch (e) {
      debug(e);
    }

    // Progressively upgrade `cache`, which is one of:
    // empty
    // {}
    // { file: size [,...] }
    // { "": { tips: { label: SHA1, ... } }, label: { file: size, ... }, ... }
    // { "": { version: 0.4, tips: { label: SHA1, ... } },
    //   label: { file: { "": size, compressor: size, ... }, ... }, ... }
    if (typeof cache !== "object") {
      cache = undefined;
    }
    if (!cache || !cache[""]) {
      // If promoting cache to dictionary, assume that data are for last run
      cache = _.zipObject(["", lastrun], [{ version: 0, tips: {} }, cache]);
    }
    if (!cache[""].version) {
      cache[""].version = 0.4;
      _.forEach(cache, function(sizes, label) {
        if (!label || !sizes) {
          return;
        }

        // If promoting sizes to dictionary, assume that compressed size data are indicated by suffixes
        Object.keys(sizes)
          .sort()
          .forEach(function(file) {
            var parts = file.split("."),
              prefix = parts.shift();

            // Append compressed size data to a matching prefix
            while (parts.length) {
              if (typeof sizes[prefix] === "object") {
                sizes[prefix][parts.join(".")] = sizes[file];
                delete sizes[file];
                return;
              }
              prefix += "." + parts.shift();
            }

            // Store uncompressed size data
            sizes[file] = { "": sizes[file] };
          });
      });
    }

    return cache;
  }
function(src) {
    var cache;

    try {
      cache = fs.existsSync(src) ? file.readJSON(src) : undefined;
    } catch (e) {
      debug(e);
    }

    // Progressively upgrade `cache`, which is one of:
    // empty
    // {}
    // { file: size [,...] }
    // { "": { tips: { label: SHA1, ... } }, label: { file: size, ... }, ... }
    // { "": { version: 0.4, tips: { label: SHA1, ... } },
    //   label: { file: { "": size, compressor: size, ... }, ... }, ... }
    if (typeof cache !== "object") {
      cache = undefined;
    }
    if (!cache || !cache[""]) {
      // If promoting cache to dictionary, assume that data are for last run
      cache = _.zipObject(["", lastrun], [{ version: 0, tips: {} }, cache]);
    }
    if (!cache[""].version) {
      cache[""].version = 0.4;
      _.forEach(cache, function(sizes, label) {
        if (!label || !sizes) {
          return;
        }

        // If promoting sizes to dictionary, assume that compressed size data are indicated by suffixes
        Object.keys(sizes)
          .sort()
          .forEach(function(file) {
            var parts = file.split("."),
              prefix = parts.shift();

            // Append compressed size data to a matching prefix
            while (parts.length) {
              if (typeof sizes[prefix] === "object") {
                sizes[prefix][parts.join(".")] = sizes[file];
                delete sizes[file];
                return;
              }
              prefix += "." + parts.shift();
            }

            // Store uncompressed size data
            sizes[file] = { "": sizes[file] };
          });
      });
    }

    return cache;
  }
function ( src ) { var cache ; try { cache = fs . existsSync ( src ) ? file . readJSON ( src ) : undefined ; } catch ( e ) { debug ( e ) ; } // Progressively upgrade `cache`, which is one of:
 // empty
 // {}
 // { file: size [,...] }
 // { "": { tips: { label: SHA1, ... } }, label: { file: size, ... }, ... }
 // { "": { version: 0.4, tips: { label: SHA1, ... } },
 //   label: { file: { "": size, compressor: size, ... }, ... }, ... }
 if ( typeof cache !== "object" ) { cache = undefined ; } if ( ! cache || ! cache [ "" ] ) { // If promoting cache to dictionary, assume that data are for last run
 cache = _ . zipObject ( [ "" , lastrun ] , [ { version : 0 , tips : { } } , cache ] ) ; } if ( ! cache [ "" ] . version ) { cache [ "" ] . version = 0.4 ; _ . forEach ( cache , function ( sizes , label ) { if ( ! label || ! sizes ) { return ; } // If promoting sizes to dictionary, assume that compressed size data are indicated by suffixes
 Object . keys ( sizes ) . sort ( ) . forEach ( function ( file ) { var parts = file . split ( "." ) , prefix = parts . shift ( ) ; // Append compressed size data to a matching prefix
 while ( parts . length ) { if ( typeof sizes [ prefix ] === "object" ) { sizes [ prefix ] [ parts . join ( "." ) ] = sizes [ file ] ; delete sizes [ file ] ; return ; } prefix += "." + parts . shift ( ) ; } // Store uncompressed size data
 sizes [ file ] = { "" : sizes [ file ] } ; } ) ; } ) ; } return cache ; }
Size cache helper
Size cache helper