
* test for filtering products * tests for filters * change filter input selector * change filter input selector * change filter input selector * add data-test-id
12 lines
472 B
JavaScript
12 lines
472 B
JavaScript
export function stringify(obj_from_json) {
|
|
if (typeof obj_from_json !== "object" || Array.isArray(obj_from_json)) {
|
|
// not an object, stringify using native function
|
|
return JSON.stringify(obj_from_json);
|
|
}
|
|
// Implements recursive object serialization according to JSON spec
|
|
// but without quotes around the keys.
|
|
const props = Object.keys(obj_from_json)
|
|
.map(key => `${key}:${stringify(obj_from_json[key])}`)
|
|
.join(",");
|
|
return `{${props}}`;
|
|
}
|