import MOCK_DATA from "./mock_data";
export var getSearchFunction = function getSearchFunction() {
  var DELAY = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
  return function (_ref) {
    var query = _ref.query,
        per_page = _ref.per_page;
    return new Promise(function (r) {
      return setTimeout(r, DELAY);
    }).then(function () {
      return MOCK_DATA.filter(function (item) {
        return item.name.includes(query) || item.description.includes(query);
      }).slice(0, per_page);
    });
  };
};