code: function compact(obj) {
    if ('object' != typeof obj) return obj;
  
    if (isArray(obj)) {
      var ret = [];
  
      for (var i in obj) {
        if (hasOwnProperty.call(obj, i)) {
          ret.push(obj[i]);
        }
      }
  
      return ret;
    }
  
    for (var key in obj) {
      obj[key] = compact(obj[key]);
    }
  
    return obj;
  }
docs: Compact sparse arrays.