node_modules/braces/lib/utils.js in immosquare-cleaner-0.1.39 vs node_modules/braces/lib/utils.js in immosquare-cleaner-0.1.40

- old
+ new

@@ -29,11 +29,11 @@ /** * Escape the given node with '\\' before node.value */ exports.escapeNode = (block, n = 0, type) => { - let node = block.nodes[n]; + const node = block.nodes[n]; if (!node) return; if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { if (node.escaped !== true) { node.value = '\\' + node.value; @@ -98,15 +98,25 @@ * Flatten an array */ exports.flatten = (...args) => { const result = []; + const flat = arr => { for (let i = 0; i < arr.length; i++) { - let ele = arr[i]; - Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele); + const ele = arr[i]; + + if (Array.isArray(ele)) { + flat(ele); + continue; + } + + if (ele !== undefined) { + result.push(ele); + } } return result; }; + flat(args); return result; };