app/assets/lookbook/js/helpers/string.js in lookbook-1.5.5 vs app/assets/lookbook/js/helpers/string.js in lookbook-2.0.0.beta.0
- old
+ new
@@ -7,23 +7,16 @@
function prefixString(string, prefix = null) {
return prefix ? `${prefix}-${string}` : string;
}
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;
+ const json = decodeURIComponent(value);
+ return JSON.parse(json);
}
function buildSearchParamValue(data) {
- const pairs = [];
- for (const [key, value] of Object.entries(data)) {
- pairs.push(`${key}:${value}`);
- }
- return pairs.join("|");
+ const str = JSON.stringify(data);
+ return encodeURIComponent(str);
}
export {
prefixString,
decodeEntities,