/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['base/array.js']) {
  _$jscoverage['base/array.js'] = [];
  _$jscoverage['base/array.js'][1] = 0;
  _$jscoverage['base/array.js'][11] = 0;
  _$jscoverage['base/array.js'][12] = 0;
  _$jscoverage['base/array.js'][15] = 0;
  _$jscoverage['base/array.js'][16] = 0;
  _$jscoverage['base/array.js'][19] = 0;
  _$jscoverage['base/array.js'][20] = 0;
  _$jscoverage['base/array.js'][21] = 0;
  _$jscoverage['base/array.js'][22] = 0;
  _$jscoverage['base/array.js'][23] = 0;
  _$jscoverage['base/array.js'][24] = 0;
  _$jscoverage['base/array.js'][26] = 0;
  _$jscoverage['base/array.js'][29] = 0;
  _$jscoverage['base/array.js'][30] = 0;
  _$jscoverage['base/array.js'][31] = 0;
  _$jscoverage['base/array.js'][32] = 0;
  _$jscoverage['base/array.js'][34] = 0;
  _$jscoverage['base/array.js'][38] = 0;
  _$jscoverage['base/array.js'][39] = 0;
  _$jscoverage['base/array.js'][40] = 0;
  _$jscoverage['base/array.js'][41] = 0;
  _$jscoverage['base/array.js'][42] = 0;
  _$jscoverage['base/array.js'][43] = 0;
  _$jscoverage['base/array.js'][44] = 0;
  _$jscoverage['base/array.js'][46] = 0;
  _$jscoverage['base/array.js'][51] = 0;
  _$jscoverage['base/array.js'][54] = 0;
  _$jscoverage['base/array.js'][58] = 0;
  _$jscoverage['base/array.js'][72] = 0;
  _$jscoverage['base/array.js'][73] = 0;
  _$jscoverage['base/array.js'][74] = 0;
  _$jscoverage['base/array.js'][75] = 0;
  _$jscoverage['base/array.js'][76] = 0;
  _$jscoverage['base/array.js'][77] = 0;
  _$jscoverage['base/array.js'][78] = 0;
  _$jscoverage['base/array.js'][79] = 0;
  _$jscoverage['base/array.js'][80] = 0;
  _$jscoverage['base/array.js'][81] = 0;
  _$jscoverage['base/array.js'][82] = 0;
  _$jscoverage['base/array.js'][83] = 0;
  _$jscoverage['base/array.js'][88] = 0;
  _$jscoverage['base/array.js'][89] = 0;
  _$jscoverage['base/array.js'][93] = 0;
  _$jscoverage['base/array.js'][112] = 0;
  _$jscoverage['base/array.js'][113] = 0;
  _$jscoverage['base/array.js'][114] = 0;
  _$jscoverage['base/array.js'][115] = 0;
  _$jscoverage['base/array.js'][118] = 0;
  _$jscoverage['base/array.js'][134] = 0;
  _$jscoverage['base/array.js'][135] = 0;
  _$jscoverage['base/array.js'][136] = 0;
  _$jscoverage['base/array.js'][137] = 0;
  _$jscoverage['base/array.js'][139] = 0;
  _$jscoverage['base/array.js'][142] = 0;
  _$jscoverage['base/array.js'][164] = 0;
  _$jscoverage['base/array.js'][165] = 0;
  _$jscoverage['base/array.js'][166] = 0;
  _$jscoverage['base/array.js'][168] = 0;
  _$jscoverage['base/array.js'][169] = 0;
  _$jscoverage['base/array.js'][170] = 0;
  _$jscoverage['base/array.js'][171] = 0;
  _$jscoverage['base/array.js'][173] = 0;
  _$jscoverage['base/array.js'][174] = 0;
  _$jscoverage['base/array.js'][176] = 0;
  _$jscoverage['base/array.js'][178] = 0;
  _$jscoverage['base/array.js'][198] = 0;
  _$jscoverage['base/array.js'][199] = 0;
  _$jscoverage['base/array.js'][200] = 0;
  _$jscoverage['base/array.js'][201] = 0;
  _$jscoverage['base/array.js'][202] = 0;
  _$jscoverage['base/array.js'][204] = 0;
  _$jscoverage['base/array.js'][205] = 0;
  _$jscoverage['base/array.js'][208] = 0;
  _$jscoverage['base/array.js'][209] = 0;
  _$jscoverage['base/array.js'][210] = 0;
  _$jscoverage['base/array.js'][211] = 0;
  _$jscoverage['base/array.js'][213] = 0;
  _$jscoverage['base/array.js'][217] = 0;
  _$jscoverage['base/array.js'][221] = 0;
  _$jscoverage['base/array.js'][238] = 0;
  _$jscoverage['base/array.js'][239] = 0;
  _$jscoverage['base/array.js'][240] = 0;
  _$jscoverage['base/array.js'][241] = 0;
  _$jscoverage['base/array.js'][242] = 0;
  _$jscoverage['base/array.js'][243] = 0;
  _$jscoverage['base/array.js'][244] = 0;
  _$jscoverage['base/array.js'][245] = 0;
  _$jscoverage['base/array.js'][246] = 0;
  _$jscoverage['base/array.js'][247] = 0;
  _$jscoverage['base/array.js'][248] = 0;
  _$jscoverage['base/array.js'][250] = 0;
  _$jscoverage['base/array.js'][253] = 0;
  _$jscoverage['base/array.js'][254] = 0;
  _$jscoverage['base/array.js'][258] = 0;
  _$jscoverage['base/array.js'][272] = 0;
  _$jscoverage['base/array.js'][273] = 0;
  _$jscoverage['base/array.js'][274] = 0;
  _$jscoverage['base/array.js'][275] = 0;
  _$jscoverage['base/array.js'][276] = 0;
  _$jscoverage['base/array.js'][277] = 0;
  _$jscoverage['base/array.js'][278] = 0;
  _$jscoverage['base/array.js'][279] = 0;
  _$jscoverage['base/array.js'][281] = 0;
  _$jscoverage['base/array.js'][285] = 0;
  _$jscoverage['base/array.js'][301] = 0;
  _$jscoverage['base/array.js'][302] = 0;
  _$jscoverage['base/array.js'][303] = 0;
  _$jscoverage['base/array.js'][304] = 0;
  _$jscoverage['base/array.js'][305] = 0;
  _$jscoverage['base/array.js'][306] = 0;
  _$jscoverage['base/array.js'][309] = 0;
  _$jscoverage['base/array.js'][323] = 0;
  _$jscoverage['base/array.js'][324] = 0;
  _$jscoverage['base/array.js'][325] = 0;
  _$jscoverage['base/array.js'][326] = 0;
  _$jscoverage['base/array.js'][327] = 0;
  _$jscoverage['base/array.js'][330] = 0;
  _$jscoverage['base/array.js'][348] = 0;
  _$jscoverage['base/array.js'][349] = 0;
  _$jscoverage['base/array.js'][350] = 0;
  _$jscoverage['base/array.js'][352] = 0;
  _$jscoverage['base/array.js'][354] = 0;
  _$jscoverage['base/array.js'][356] = 0;
  _$jscoverage['base/array.js'][357] = 0;
  _$jscoverage['base/array.js'][358] = 0;
  _$jscoverage['base/array.js'][359] = 0;
  _$jscoverage['base/array.js'][362] = 0;
  _$jscoverage['base/array.js'][408] = 0;
  _$jscoverage['base/array.js'][409] = 0;
  _$jscoverage['base/array.js'][410] = 0;
  _$jscoverage['base/array.js'][411] = 0;
  _$jscoverage['base/array.js'][412] = 0;
  _$jscoverage['base/array.js'][414] = 0;
  _$jscoverage['base/array.js'][419] = 0;
  _$jscoverage['base/array.js'][457] = 0;
  _$jscoverage['base/array.js'][458] = 0;
  _$jscoverage['base/array.js'][459] = 0;
  _$jscoverage['base/array.js'][460] = 0;
  _$jscoverage['base/array.js'][475] = 0;
  _$jscoverage['base/array.js'][476] = 0;
  _$jscoverage['base/array.js'][477] = 0;
  _$jscoverage['base/array.js'][478] = 0;
  _$jscoverage['base/array.js'][481] = 0;
  _$jscoverage['base/array.js'][495] = 0;
  _$jscoverage['base/array.js'][496] = 0;
  _$jscoverage['base/array.js'][497] = 0;
  _$jscoverage['base/array.js'][499] = 0;
  _$jscoverage['base/array.js'][501] = 0;
  _$jscoverage['base/array.js'][503] = 0;
  _$jscoverage['base/array.js'][504] = 0;
  _$jscoverage['base/array.js'][510] = 0;
}
_$jscoverage['base/array.js'][1]++;
var obj = require("./object"), string = require("./string"), date = require("./date"), number = require("./number"), misc = require("./misc");
_$jscoverage['base/array.js'][11]++;
var argsToArray = exports.argsToArray = (function (args) {
  _$jscoverage['base/array.js'][12]++;
  return Array.prototype.slice.call(args);
});
_$jscoverage['base/array.js'][15]++;
var isArray = exports.isArray = (function (obj) {
  _$jscoverage['base/array.js'][16]++;
  return obj && obj instanceof Array;
});
_$jscoverage['base/array.js'][19]++;
var cross = (function (num, cross) {
  _$jscoverage['base/array.js'][20]++;
  var ret = cross.reduceRight((function (a, b) {
  _$jscoverage['base/array.js'][21]++;
  if (! isArray(b)) {
    _$jscoverage['base/array.js'][21]++;
    b = [b];
  }
  _$jscoverage['base/array.js'][22]++;
  b.unshift(num);
  _$jscoverage['base/array.js'][23]++;
  a.unshift(b);
  _$jscoverage['base/array.js'][24]++;
  return a;
}), []);
  _$jscoverage['base/array.js'][26]++;
  return ret;
});
_$jscoverage['base/array.js'][29]++;
var permute = (function (num, cross, length) {
  _$jscoverage['base/array.js'][30]++;
  var ret = [];
  _$jscoverage['base/array.js'][31]++;
  for (var i = 0; i < cross.length; i++) {
    _$jscoverage['base/array.js'][32]++;
    ret.push([num].concat(array.rotate(cross, i)).slice(0, length));
}
  _$jscoverage['base/array.js'][34]++;
  return ret;
});
_$jscoverage['base/array.js'][38]++;
var intersection = (function (a, b) {
  _$jscoverage['base/array.js'][39]++;
  var ret = [];
  _$jscoverage['base/array.js'][40]++;
  if (isArray(a) && isArray(b)) {
    _$jscoverage['base/array.js'][41]++;
    if (a.length && b.length) {
      _$jscoverage['base/array.js'][42]++;
      var aOne = a[0];
      _$jscoverage['base/array.js'][43]++;
      if (b.indexOf(aOne) != -1) {
        _$jscoverage['base/array.js'][44]++;
        ret = [aOne].concat(intersection(a.slice(1), b));
      }
      else {
        _$jscoverage['base/array.js'][46]++;
        ret = intersection(a.slice(1), b);
      }
    }
  }
  _$jscoverage['base/array.js'][51]++;
  return ret;
});
_$jscoverage['base/array.js'][54]++;
var comb = exports, array;
_$jscoverage['base/array.js'][58]++;
comb.array = {toArray: (function (o) {
  _$jscoverage['base/array.js'][72]++;
  var ret = [];
  _$jscoverage['base/array.js'][73]++;
  if (o != null) {
    _$jscoverage['base/array.js'][74]++;
    var args = argsToArray(arguments);
    _$jscoverage['base/array.js'][75]++;
    if (args.length == 1) {
      _$jscoverage['base/array.js'][76]++;
      if (isArray(o)) {
        _$jscoverage['base/array.js'][77]++;
        ret = o;
      }
      else {
        _$jscoverage['base/array.js'][78]++;
        if (string.isString(o) || date.isDate(o) || number.isNumber(o) || misc.isBoolean(o)) {
          _$jscoverage['base/array.js'][79]++;
          ret.push(o);
        }
        else {
          _$jscoverage['base/array.js'][80]++;
          if (obj.isObject(o)) {
            _$jscoverage['base/array.js'][81]++;
            for (var i in o) {
              _$jscoverage['base/array.js'][82]++;
              if (o.hasOwnProperty(i)) {
                _$jscoverage['base/array.js'][83]++;
                ret.push([i, o[i]]);
              }
}
          }
        }
      }
    }
    else {
      _$jscoverage['base/array.js'][88]++;
      args.forEach((function (a) {
  _$jscoverage['base/array.js'][89]++;
  ret = ret.concat(array.toArray(a));
}));
    }
  }
  _$jscoverage['base/array.js'][93]++;
  return ret;
}), sum: (function (array) {
  _$jscoverage['base/array.js'][112]++;
  array = array || [];
  _$jscoverage['base/array.js'][113]++;
  if (array.length) {
    _$jscoverage['base/array.js'][114]++;
    return array.reduce((function (a, b) {
  _$jscoverage['base/array.js'][115]++;
  return a + b;
}));
  }
  else {
    _$jscoverage['base/array.js'][118]++;
    return 0;
  }
}), removeDuplicates: (function (arr) {
  _$jscoverage['base/array.js'][134]++;
  if (isArray(arr)) {
    _$jscoverage['base/array.js'][135]++;
    var ret = arr.reduce((function (a, b) {
  _$jscoverage['base/array.js'][136]++;
  if (a.indexOf(b) == -1) {
    _$jscoverage['base/array.js'][137]++;
    return a.concat(b);
  }
  else {
    _$jscoverage['base/array.js'][139]++;
    return a;
  }
}), []);
    _$jscoverage['base/array.js'][142]++;
    return ret;
  }
}), rotate: (function (arr, numberOfTimes) {
  _$jscoverage['base/array.js'][164]++;
  var ret = arr.slice();
  _$jscoverage['base/array.js'][165]++;
  if (typeof numberOfTimes != "number") {
    _$jscoverage['base/array.js'][166]++;
    numberOfTimes = 1;
  }
  _$jscoverage['base/array.js'][168]++;
  if (numberOfTimes && isArray(arr)) {
    _$jscoverage['base/array.js'][169]++;
    if (numberOfTimes > 0) {
      _$jscoverage['base/array.js'][170]++;
      ret.push(ret.shift());
      _$jscoverage['base/array.js'][171]++;
      numberOfTimes--;
    }
    else {
      _$jscoverage['base/array.js'][173]++;
      ret.unshift(ret.pop());
      _$jscoverage['base/array.js'][174]++;
      numberOfTimes++;
    }
    _$jscoverage['base/array.js'][176]++;
    return array.rotate(ret, numberOfTimes);
  }
  else {
    _$jscoverage['base/array.js'][178]++;
    return ret;
  }
}), permutations: (function (arr, length) {
  _$jscoverage['base/array.js'][198]++;
  var ret = [];
  _$jscoverage['base/array.js'][199]++;
  if (isArray(arr)) {
    _$jscoverage['base/array.js'][200]++;
    var copy = arr.slice(0);
    _$jscoverage['base/array.js'][201]++;
    if (typeof length != "number") {
      _$jscoverage['base/array.js'][202]++;
      length = arr.length;
    }
    _$jscoverage['base/array.js'][204]++;
    if (! length) {
      _$jscoverage['base/array.js'][205]++;
      ret = [[]];
    }
    else {
      _$jscoverage['base/array.js'][208]++;
      if (length <= arr.length) {
        _$jscoverage['base/array.js'][209]++;
        ret = arr.reduce((function (a, b, i) {
  _$jscoverage['base/array.js'][210]++;
  if (length > 1) {
    _$jscoverage['base/array.js'][211]++;
    var ret = permute(b, array.rotate(copy, i).slice(1), length);
  }
  else {
    _$jscoverage['base/array.js'][213]++;
    ret = [[b]];
  }
  _$jscoverage['base/array.js'][217]++;
  return a.concat(ret);
}), []);
      }
    }
  }
  _$jscoverage['base/array.js'][221]++;
  return ret;
}), zip: (function () {
  _$jscoverage['base/array.js'][238]++;
  var ret = [];
  _$jscoverage['base/array.js'][239]++;
  var arrs = argsToArray(arguments);
  _$jscoverage['base/array.js'][240]++;
  if (arrs.length > 1) {
    _$jscoverage['base/array.js'][241]++;
    arr1 = arrs.shift();
    _$jscoverage['base/array.js'][242]++;
    if (isArray(arr1)) {
      _$jscoverage['base/array.js'][243]++;
      ret = arr1.reduce((function (a, b, i) {
  _$jscoverage['base/array.js'][244]++;
  var curr = [b];
  _$jscoverage['base/array.js'][245]++;
  for (var j = 0; j < arrs.length; j++) {
    _$jscoverage['base/array.js'][246]++;
    var currArr = arrs[j];
    _$jscoverage['base/array.js'][247]++;
    if (isArray(currArr) && currArr[i]) {
      _$jscoverage['base/array.js'][248]++;
      curr.push(currArr[i]);
    }
    else {
      _$jscoverage['base/array.js'][250]++;
      curr.push(null);
    }
}
  _$jscoverage['base/array.js'][253]++;
  a.push(curr);
  _$jscoverage['base/array.js'][254]++;
  return a;
}), []);
    }
  }
  _$jscoverage['base/array.js'][258]++;
  return ret;
}), transpose: (function (arr) {
  _$jscoverage['base/array.js'][272]++;
  var ret = [];
  _$jscoverage['base/array.js'][273]++;
  if (isArray(arr) && arr.length) {
    _$jscoverage['base/array.js'][274]++;
    var last;
    _$jscoverage['base/array.js'][275]++;
    arr.forEach((function (a) {
  _$jscoverage['base/array.js'][276]++;
  if (isArray(a) && (! last || a.length == last.length)) {
    _$jscoverage['base/array.js'][277]++;
    a.forEach((function (b, i) {
  _$jscoverage['base/array.js'][278]++;
  ! ret[i] && (ret[i] = []);
  _$jscoverage['base/array.js'][279]++;
  ret[i].push(b);
}));
    _$jscoverage['base/array.js'][281]++;
    last = a;
  }
}));
  }
  _$jscoverage['base/array.js'][285]++;
  return ret;
}), valuesAt: (function (arr, indexes) {
  _$jscoverage['base/array.js'][301]++;
  var ret = [];
  _$jscoverage['base/array.js'][302]++;
  var indexes = argsToArray(arguments);
  _$jscoverage['base/array.js'][303]++;
  var arr = indexes.shift(), l = arr.length;
  _$jscoverage['base/array.js'][304]++;
  if (isArray(arr) && indexes.length) {
    _$jscoverage['base/array.js'][305]++;
    for (var i = 0; i < indexes.length; i++) {
      _$jscoverage['base/array.js'][306]++;
      ret.push(arr[indexes[i]] || null);
}
  }
  _$jscoverage['base/array.js'][309]++;
  return ret;
}), union: (function () {
  _$jscoverage['base/array.js'][323]++;
  var ret = [];
  _$jscoverage['base/array.js'][324]++;
  var arrs = argsToArray(arguments);
  _$jscoverage['base/array.js'][325]++;
  if (arrs.length > 1) {
    _$jscoverage['base/array.js'][326]++;
    ret = array.removeDuplicates(arrs.reduce((function (a, b) {
  _$jscoverage['base/array.js'][327]++;
  return a.concat(b);
}), []));
  }
  _$jscoverage['base/array.js'][330]++;
  return ret;
}), intersect: (function (a, b) {
  _$jscoverage['base/array.js'][348]++;
  var collect = [], set;
  _$jscoverage['base/array.js'][349]++;
  var args = argsToArray(arguments);
  _$jscoverage['base/array.js'][350]++;
  if (args.length > 1) {
    _$jscoverage['base/array.js'][352]++;
    set = args;
  }
  else {
    _$jscoverage['base/array.js'][354]++;
    set = args[0];
  }
  _$jscoverage['base/array.js'][356]++;
  if (isArray(set)) {
    _$jscoverage['base/array.js'][357]++;
    var x = set.shift();
    _$jscoverage['base/array.js'][358]++;
    var collect = set.reduce((function (a, b) {
  _$jscoverage['base/array.js'][359]++;
  return intersection(a, b);
}), x);
  }
  _$jscoverage['base/array.js'][362]++;
  return array.removeDuplicates(collect);
}), powerSet: (function (arr) {
  _$jscoverage['base/array.js'][408]++;
  var ret = [];
  _$jscoverage['base/array.js'][409]++;
  if (isArray(arr) && arr.length) {
    _$jscoverage['base/array.js'][410]++;
    var ret = arr.reduce((function (a, b) {
  _$jscoverage['base/array.js'][411]++;
  var ret = a.map((function (c) {
  _$jscoverage['base/array.js'][412]++;
  return c.concat(b);
}));
  _$jscoverage['base/array.js'][414]++;
  return a.concat(ret);
}), [[]]);
  }
  _$jscoverage['base/array.js'][419]++;
  return ret;
}), cartesian: (function (a, b) {
  _$jscoverage['base/array.js'][457]++;
  var ret = [];
  _$jscoverage['base/array.js'][458]++;
  if (isArray(a) && isArray(b) && a.length && b.length) {
    _$jscoverage['base/array.js'][459]++;
    ret = cross(a[0], b).concat(array.cartesian(a.slice(1), b));
  }
  _$jscoverage['base/array.js'][460]++;
  return ret;
}), compact: (function (arr) {
  _$jscoverage['base/array.js'][475]++;
  var ret = [];
  _$jscoverage['base/array.js'][476]++;
  if (isArray(arr) && arr.length) {
    _$jscoverage['base/array.js'][477]++;
    ret = arr.filter((function (item) {
  _$jscoverage['base/array.js'][478]++;
  return ! misc.isUndefinedOrNull(item);
}));
  }
  _$jscoverage['base/array.js'][481]++;
  return ret;
}), flatten: (function (array) {
  _$jscoverage['base/array.js'][495]++;
  var set;
  _$jscoverage['base/array.js'][496]++;
  var args = argsToArray(arguments);
  _$jscoverage['base/array.js'][497]++;
  if (args.length > 1) {
    _$jscoverage['base/array.js'][499]++;
    set = args;
  }
  else {
    _$jscoverage['base/array.js'][501]++;
    set = array;
  }
  _$jscoverage['base/array.js'][503]++;
  return set.reduce((function (a, b) {
  _$jscoverage['base/array.js'][504]++;
  return a.concat(b);
}), []);
})};
_$jscoverage['base/array.js'][510]++;
array = comb.array;
_$jscoverage['base/array.js'].source = ["var obj = require(\"./object\"), string = require(\"./string\"), date = require(\"./date\"), number = require(\"./number\"), misc = require(\"./misc\");","","/**"," *"," * Converts an arguments object to an array"," * @function"," * @param {Arguments} args the arguments object to convert"," * @memberOf comb"," * @returns {Array} array version of the arguments object"," */","var argsToArray = exports.argsToArray = function(args) {","    return Array.prototype.slice.call(args);","};","","var isArray = exports.isArray = function(obj) {","    return obj &amp;&amp; obj instanceof Array;","};","","var cross = function(num, cross) {","    var ret = cross.reduceRight(function(a, b) {","        if (!isArray(b)) b = [b];","        b.unshift(num)","        a.unshift(b);","        return a;","    }, []);","    return ret;","};","","var permute = function(num, cross, length) {","    var ret = [];","    for (var i = 0; i &lt; cross.length; i++) {","        ret.push([num].concat(array.rotate(cross, i)).slice(0, length));","    }","    return ret;","};","","","var intersection = function(a, b) {","    var ret = [];","    if (isArray(a) &amp;&amp; isArray(b)) {","        if (a.length &amp;&amp; b.length) {","            var aOne = a[0];","            if (b.indexOf(aOne) != -1) {","                ret = [aOne].concat(intersection(a.slice(1), b));","            } else {","                ret = intersection(a.slice(1), b);","            }","        }","    }","","    return ret;","};","","var comb = exports, array;","/**"," * @namespace Utilities for Arrays"," */","comb.array = {","","","    /**","     * converts anything to an array","     *","     * @example","     *  comb.array.toArray({a : \"b\", b : \"c\"}) =&gt; [[\"a\",\"b\"], [\"b\",\"c\"]];","     *  comb.array.toArray(\"a\") =&gt; [\"a\"]","     *  comb.array.toArray([\"a\"]) =&gt;  [\"a\"];","     *  comb.array.toArray() =&gt; [];","     *  comb.array.toArray(\"a\", {a : \"b\"}) =&gt; [\"a\", [\"a\", \"b\"]];","     */","    toArray : function(o) {","        var ret = [];","        if (o != null) {","            var args = argsToArray(arguments);","            if (args.length == 1) {","                if (isArray(o)) {","                    ret = o;","                } else if (string.isString(o) || date.isDate(o) || number.isNumber(o) || misc.isBoolean(o)) {","                    ret.push(o);","                } else if (obj.isObject(o)) {","                    for (var i in o) {","                        if (o.hasOwnProperty(i)) {","                            ret.push([i, o[i]]);","                        }","                    }","                }","            } else {","                args.forEach(function(a){","                    ret = ret.concat(array.toArray(a));","                })","            }","        }","        return ret;","    },","","    /**","     * Sums all items in an array","     *","     * @example","     *","     *  comb.array.sum([1,2,3]) =&gt; 6","     *  comb.array.sum([\"A\",\"B\",\"C\"]) =&gt; \"ABC\";","     *  var d1 = new Date(1999), d2 = new Date(2000), d3 = new Date(3000);","     *  comb.array.sum([d1,d2,d3]) =&gt; \"Wed Dec 31 1969 18:00:01 GMT-0600 (CST)\"","     *                              + \"Wed Dec 31 1969\"  18:00:02 GMT-0600 (CST)\"","     *                              + \"Wed Dec 31 1969 18:00:03 GMT-0600 (CST)\"","     *  comb.array.sum([{},{},{}]) =&gt; \"[object Object][object Object][object Object]\";","     *","     * @param {Number[]} array the array of numbers to sum","     */","    sum : function(array) {","        array = array || [];","        if (array.length) {","            return array.reduce(function(a, b) {","                return a + b;","            });","        } else {","            return 0;","        }","    },","","","    /**","     * Removes duplicates from an array","     *","     * @example","     *","     * comb.array.removeDuplicates([1,1,1]) =&gt; [1]","     * comb.array.removeDuplicates([1,2,3,2]) =&gt; [1,2,3]","     *","     * @param {Aray} array the array of elements to remove duplicates from","     */","    removeDuplicates : function(arr) {","        if (isArray(arr)) {","            var ret = arr.reduce(function(a, b) {","                if (a.indexOf(b) == -1) {","                    return a.concat(b);","                } else {","                    return a;","                }","            }, []);","            return ret;","        }","    },","","    /**","     * Rotates an array the number of specified positions","     *","     * @example","     * var arr = [\"a\", \"b\", \"c\", \"d\"];","     * comb.array.rotate(arr)     =&gt; [\"b\", \"c\", \"d\", \"a\"]","     * comb.array.rotate(arr, 2)  =&gt; [\"c\", \"d\", \"a\", \"b\"]);","     * comb.array.rotate(arr, 3)  =&gt; [\"d\", \"a\", \"b\", \"c\"]);","     * comb.array.rotate(arr, 4)  =&gt; [\"a\", \"b\", \"c\", \"d\"]);","     * comb.array.rotate(arr, -1) =&gt; [\"d\", \"a\", \"b\", \"c\"]);","     * comb.array.rotate(arr, -2) =&gt; [\"c\", \"d\", \"a\", \"b\"]);","     * comb.array.rotate(arr, -3) =&gt; [\"b\", \"c\", \"d\", \"a\"]);","     * comb.array.rotate(arr, -4) =&gt; [\"a\", \"b\", \"c\", \"d\"]);","     *","     * @param {Array} array the array of elements to remove duplicates from","     * @param {Number} numberOfTimes the number of times to rotate the array","     */","    rotate : function(arr, numberOfTimes) {","        var ret = arr.slice();","        if (typeof numberOfTimes != \"number\") {","            numberOfTimes = 1;","        }","        if (numberOfTimes &amp;&amp; isArray(arr)) {","            if (numberOfTimes &gt; 0) {","                ret.push(ret.shift());","                numberOfTimes--;","            } else {","                ret.unshift(ret.pop());","                numberOfTimes++;","            }","            return array.rotate(ret, numberOfTimes);","        } else {","            return ret;","        }","    },","","    /**","     * Finds all permutations of an array","     *","     * @example","     * var arr = [1,2,3];","     * comb.array.permutations(arr)    =&gt; [[ 1, 2, 3 ],[ 1, 3, 2 ],[ 2, 3, 1 ],","     *                                     [ 2, 1, 3 ],[ 3, 1, 2 ],[ 3, 2, 1 ]]","     * comb.array.permutations(arr, 2) =&gt; [[ 1, 2],[ 1, 3],[ 2, 3],[ 2, 1],[ 3, 1],[ 3, 2]]","     * comb.array.permutations(arr, 1) =&gt; [[1],[2],[3]]","     * comb.array.permutations(arr, 0) =&gt; [[]]","     * comb.array.permutations(arr, 4) =&gt; []","     *","     * @param {Array} arr the array to permute.","     * @param {Number} length the number of elements to permute.","     */","    permutations : function(arr, length) {","        var ret = [];","        if (isArray(arr)) {","            var copy = arr.slice(0);","            if (typeof length != \"number\") {","                length = arr.length;","            }","            if (!length) {","                ret = [","                    []","                ];","            } else if (length &lt;= arr.length) {","                ret = arr.reduce(function(a, b, i) {","                    if (length &gt; 1) {","                        var ret = permute(b, array.rotate(copy, i).slice(1), length);","                    } else {","                        ret = [","                            [b]","                        ];","                    }","                    return a.concat(ret);","                }, [])","            }","        }","        return ret;","    },","","    /**","     * Zips to arrays together","     *","     * @example","     *  var a = [ 4, 5, 6 ], b = [ 7, 8, 9 ]","     *  comb.array.zip([1], [2], [3]) =&gt; [[ 1, 2, 3 ]]);","     *  comb.array.zip([1,2], [2], [3]) =&gt; [[ 1, 2, 3 ],[2, null, null]]","     *  comb.array.zip([1,2,3], a, b) =&gt; [[1, 4, 7],[2, 5, 8],[3, 6, 9]]","     *  comb.array.zip([1,2], a, b) =&gt; [[1, 4, 7],[2, 5, 8]]","     *  comb.array.zip(a, [1,2], [8]) =&gt; [[4,1,8],[5,2,null],[6,null,null]]","     *","     * @param arrays variable number of arrays to zip together","     */","    zip : function() {","        var ret = [];","        var arrs = argsToArray(arguments);","        if (arrs.length &gt; 1) {","            arr1 = arrs.shift();","            if (isArray(arr1)) {","                ret = arr1.reduce(function(a, b, i) {","                    var curr = [b];","                    for (var j = 0; j &lt; arrs.length; j++) {","                        var currArr = arrs[j];","                        if (isArray(currArr) &amp;&amp; currArr[i]) {","                            curr.push(currArr[i]);","                        } else {","                            curr.push(null);","                        }","                    }","                    a.push(curr)","                    return a;","                }, []);","            }","        }","        return ret;","    },","","    /**","     * Transposes an array of arrays","     * @example","     *","     * comb.array.transpose([[1,2,3], [4,5,6]]) =&gt; [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]","     * comb.array.transpose([[1,2], [3,4], [5,6]]) =&gt; [ [ 1, 3, 5 ], [ 2, 4, 6 ] ]","     * comb.array.transpose([[1], [3,4], [5,6]]) =&gt; [[1]])","     *","     * @param [Array[Array[]]] arr Array of arrays","     */","    transpose : function(arr) {","        var ret = [];","        if (isArray(arr) &amp;&amp; arr.length) {","            var last;","            arr.forEach(function(a) {","                if (isArray(a) &amp;&amp; (!last || a.length == last.length)) {","                    a.forEach(function(b, i) {","                        !ret[i] &amp;&amp; (ret[i] = []);","                        ret[i].push(b);","                    });","                    last = a;","                }","            });","        }","        return ret;","    },","    /**","     * Retrieves values at specified indexes in the array","     *","     * @example","     *","     *  var arr =[\"a\", \"b\", \"c\", \"d\"]","     *   comb.array.valuesAt(arr, 1,2,3) =&gt; [\"b\", \"c\", \"d\"];","     *   comb.array.valuesAt(arr, 1,2,3, 4) =&gt; [\"b\", \"c\", \"d\", null];","     *   comb.array.valuesAt(arr, 0,3) =&gt; [\"a\", \"d\"];","     *","     *   @param {Array} arr the array to retrieve values from","     *   @index {Number} index variable number of indexes to retrieve","     */","    valuesAt : function(arr, indexes) {","        var ret = [];","        var indexes = argsToArray(arguments);","        var arr = indexes.shift(), l = arr.length;","        if (isArray(arr) &amp;&amp; indexes.length) {","            for (var i = 0; i &lt; indexes.length; i++) {","                ret.push(arr[indexes[i]] || null);","            }","        }","        return ret;","    },","","    /**","     * Union a variable number of arrays together","     *","     * @example","     *","     * comb.array.union(['a','b','c'], ['b','c', 'd']) =&gt; [\"a\", \"b\", \"c\", \"d\"]","     * comb.array.union([\"a\"], [\"b\"], [\"c\"], [\"d\"], [\"c\"]) =&gt; [\"a\", \"b\", \"c\", \"d\"]","     *","     * @param arrs variable number of arrays to union","     */","    union : function() {","        var ret = [];","        var arrs = argsToArray(arguments);","        if (arrs.length &gt; 1) {","            ret = array.removeDuplicates(arrs.reduce(function(a, b) {","                return a.concat(b);","            }, []));","        }","        return ret;","    },","","    /**","     * Finds the intersection of arrays","     * NOTE : this function accepts an arbitrary number of arrays","     *","     * @example","     * comb.array.intersect([1,2], [2,3], [2,3,5]) =&gt; [2]","     * comb.array.intersect([1,2,3], [2,3,4,5], [2,3,5]) =&gt; [2,3]","     * comb.array.intersect([1,2,3,4], [2,3,4,5], [2,3,4,5]) =&gt; [2,3,4]","     * comb.array.intersect([1,2,3,4,5], [1,2,3,4,5], [1,2,3]) =&gt; [1,2,3]","     * comb.array.intersect([[1,2,3,4,5],[1,2,3,4,5],[1,2,3]]) =&gt; [1,2,3]","     *","     * @param {Array} a","     * @param {Array} b","     */","    intersect : function(a, b) {","        var collect = [], set;","        var args = argsToArray(arguments);","        if (args.length &gt; 1) {","            //assume we are intersections all the lists in the array","            set = args;","        } else {","            set = args[0];","        }","        if (isArray(set)) {","            var x = set.shift();","            var collect = set.reduce(function(a, b) {","                return intersection(a, b);","            }, x);","        }","        return array.removeDuplicates(collect);","    },","","    /**","     * Finds the powerset of an array","     *","     * @example","     *","     *  comb.array.powerSet([1,2]) =&gt; [","     *           [],","     *           [ 1 ],","     *           [ 2 ],","     *           [ 1, 2 ]","     *   ]","     *   comb.array.powerSet([1,2,3]) =&gt; [","     *           [],","     *           [ 1 ],","     *           [ 2 ],","     *           [ 1, 2 ],","     *           [ 3 ],","     *           [ 1, 3 ],","     *           [ 2, 3 ],","     *           [ 1, 2, 3 ]","     *       ]","     *   comb.array.powerSet([1,2,3,4]) =&gt; [","     *           [],","     *           [ 1 ],","     *           [ 2 ],","     *           [ 1, 2 ],","     *           [ 3 ],","     *           [ 1, 3 ],","     *           [ 2, 3 ],","     *           [ 1, 2, 3 ],","     *           [ 4 ],","     *           [ 1, 4 ],","     *           [ 2, 4 ],","     *           [ 1, 2, 4 ],","     *           [ 3, 4 ],","     *           [ 1, 3, 4 ],","     *           [ 2, 3, 4 ],","     *           [ 1, 2, 3, 4 ]","     *       ]","     *","     * @param {Array} arr the array to find the powerset of","     */","    powerSet : function(arr) {","        var ret = [];","        if (isArray(arr) &amp;&amp; arr.length) {","            var ret = arr.reduce(function(a, b) {","                var ret = a.map(function(c) {","                    return c.concat(b);","                })","                return a.concat(ret);","            }, [","                []","            ]);","        }","        return ret;","    },","","    /**","     * Find the cartesian product of two arrays","     *","     * @example","     *","     * comb.array.cartesian([1,2], [2,3]) =&gt; [","     *           [1,2],","     *           [1,3],","     *           [2,2],","     *           [2,3]","     *       ]","     * comb.array.cartesian([1,2], [2,3,4]) =&gt; [","     *           [1,2],","     *           [1,3],","     *           [1,4] ,","     *           [2,2],","     *           [2,3],","     *           [2,4]","     *       ]","     * comb.array.cartesian([1,2,3], [2,3,4]) =&gt; [","     *           [1,2],","     *           [1,3],","     *           [1,4] ,","     *           [2,2],","     *           [2,3],","     *           [2,4] ,","     *           [3,2],","     *           [3,3],","     *           [3,4]","     *       ]","     *","     * @param {Array} a","     * @param {Array} b","     */","    cartesian : function(a, b) {","        var ret = [];","        if (isArray(a) &amp;&amp; isArray(b) &amp;&amp; a.length &amp;&amp; b.length)","            ret = cross(a[0], b).concat(array.cartesian(a.slice(1), b));","        return ret;","    },","","    /**","     * Compacts an array removing null or undefined objects from the array.","     *","     * @example","     *","     * var x;","     * comb.array.compact([1,null,null,x,2]) =&gt; [1,2]","     * comb.array.compact([1,2]) =&gt; [1,2]","     *","     * @param {Array} arr","     */","    compact : function(arr){","        var ret = [];","       if(isArray(arr) &amp;&amp; arr.length){","           ret = arr.filter(function(item){","               return !misc.isUndefinedOrNull(item);","           })","       }","        return ret;","    },","","    /**","     * Flatten multiple arrays into a single array","     *","     * @example","     *","     * comb.array.flatten([1,2], [2,3], [3,4]) =&gt; [1,2,2,3,3,4]","     * comb.array.flatten([1,\"A\"], [2,\"B\"], [3,\"C\"]) =&gt; [1,\"A\",2,\"B\",3,\"C\"]","     *","     * @param array","     */","    flatten : function(array) {","        var set;","        var args = argsToArray(arguments);","        if (args.length &gt; 1) {","            //assume we are intersections all the lists in the array","            set = args;","        } else {","            set = array;","        }","        return set.reduce(function(a, b) {","            return a.concat(b);","        }, []);","    }","","};","","array = comb.array;"];
