code: function (func) {
      var memo = {};
      return function (term, callback) {
        if (memo[term]) {
          callback(memo[term]);
        } else {
          func.call(this, term, function (data) {
            memo[term] = (memo[term] || []).concat(data);
            callback.apply(null, arguments);
          });
        }
      };
    }
docs: Memoize a search function.