code: function getCollection(items, query, cb, argsLength) {
    var skip = 0, limit = Number.MAX_SAFE_INTEGER;
    setImmediate(function() {
      if (argsLength === 1) {
        cb = query;
      } else {
        skip = (query.skip) ? query.skip : 0;
        limit = (query.limit) ? query.limit : Number.MAX_SAFE_INTEGER;
      }
      var sortedKeys = Object.keys(items);
      var qKeys = remove(remove(Object.keys(query), /skip/), /limit/);
      qKeys.forEach(function (k) {
        try {
          var re = new RegExp(query[k]);
          sortedKeys = sortedKeys.filter(function (l) {
            return items[l][k].toString().match(re);
          });
        } catch (e) {
          console.error(`Problem filtering collection for parameter ${k}.`,
            e.message);
        }
      });
      skip = checkSkip(skip, sortedKeys);
      limit = checkLimit(limit, sortedKeys);
      if (sortedKeys.length === 0 || limit === 0 || skip >= sortedKeys.length) {
        return cb(null, [], sortedKeys.length, 1, 1, 0);
      }
      var pages = Math.ceil(sortedKeys.length / limit);
      var pageOf = Math.ceil(skip / limit) + 1;
      var itemArray = new Array();
      for ( var x = skip ; x < Math.min(skip + limit, sortedKeys.length) ; x++ ) {
        itemArray.push(items[sortedKeys[x]]);
      }
      cb(null, itemArray, sortedKeys.length, pageOf, pages, itemArray.length);
    });
  }
docs: Generic get collection methods that returns an ordered sequence of items