diff --git a/coretool.js b/coretool.js index da18f55..9bab6d7 100644 --- a/coretool.js +++ b/coretool.js @@ -338,4 +338,14 @@ module.exports = { else // undefined, NaN, Infinity, {} return 0 }, + + shrink_story (story) { + if (Array.isArray(story)) { + story = story.filter(section => Object.values(section).some(val => val?.trim?.())) // (section.text || section.image || section.video)?.trim?.() + return story + } else { + story = [] + return story + } + } }