Commit 5b2c76d5 authored by gijs's avatar gijs

Filter to apply trim on strings

parent 63d75c4f
......@@ -64,6 +64,25 @@ window.W = window.W || {};
return depthOf(json.mainline || json.sublines);
},
parse: function (data) {
function trimStrings(v) {
if (typeof v === "string") {
return v.trim();
} else if (typeof v === "number") {
return v;
} else if (Array.isArray(v)) {
return _.map(v, trimStrings);
} else if (typeof v === "object") {
return _.mapObject(v, trimStrings);
}
return v;
}
return trimStrings(data);
},
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment