20 lines
462 B
JavaScript
20 lines
462 B
JavaScript
function prepareTrustItems(items) {
|
|
if (!Array.isArray(items)) return [];
|
|
return items.map((item) => ({
|
|
...item,
|
|
...(item.type === "process"
|
|
? {
|
|
lines:
|
|
typeof item.content === "string"
|
|
? item.content
|
|
.split(/\r?\n/)
|
|
.map((line) => line.trim())
|
|
.filter(Boolean)
|
|
: [],
|
|
}
|
|
: {}),
|
|
}));
|
|
}
|
|
|
|
module.exports = { prepareTrustItems };
|