'use strict';

const search = require('./search-e031eea3.js');
const klevuFetch = require('./klevuFetch-c64252bb.js');

/**
 * Create a trending products search query. Id for this query is `trendingProducts`
 *
 * @category Query
 * @param options {@link search}
 * @returns See {@link KlevuFetchFunction}
 *
 * @example Simple example
 * ```
 * const result = await KlevuFetch(
 *  trendingProducts()
 * )
 *
 * console.log(result.getQueries("trendingProducts").records)
 * ```
 */
function trendingProducts(options, ...modifiers) {
    return search.search("*", Object.assign({ id: "trendingProducts", typeOfRecords: [klevuFetch.KlevuTypeOfRecord.Product] }, options), ...modifiers);
}

/**
 * Used to replace any amount of %s tokens with array of strings to concatenated string.
 * `hello %s %s %s` with values ['1', 'world', '2'] will lead to `hello 1 world 2`.
 *
 * If there isn't enough array values then %s will be left to string.
 *
 * @param string
 * @param values
 * @returns
 */
function stringConcat(string, values) {
  let copy = string;
  for (const v of values) {
    copy = copy.replace("%s", v);
  }
  return copy;
}

exports.stringConcat = stringConcat;
exports.trendingProducts = trendingProducts;

//# sourceMappingURL=stringConcat-60ab5252.js.map