app/assets/lookbook/js/helpers/string.js in lookbook-1.1.1 vs app/assets/lookbook/js/helpers/string.js in lookbook-1.2.0

- old
+ new

@@ -6,6 +6,28 @@ function prefixString(string, prefix = null) { return prefix ? `${prefix}-${string}` : string; } -export { prefixString, decodeEntities }; +function parseSearchParamValue(value) { + const params = {}; + value.split("|").forEach((pair_str) => { + const [key, value] = pair_str.split(":").map((part) => part.trim()); + params[key] = value; + }); + return params; +} + +function buildSearchParamValue(data) { + const pairs = []; + for (const [key, value] of Object.entries(data)) { + pairs.push(`${key}:${value}`); + } + return pairs.join("|"); +} + +export { + prefixString, + decodeEntities, + parseSearchParamValue, + buildSearchParamValue, +};