{"ScriptPreparationCode":"var SRC = [\r\n [0, 1, 0],\r\n [0, 2, 3],\r\n [0, 0, 4],\r\n];\r\n\r\nfunction native(mask) {\r\n var offsetBlocks = [];\r\n for (let nRow = 0; nRow \u003C mask.length; nRow\u002B\u002B) {\r\n const row = mask[nRow];\r\n for (let nCol = 0; nCol \u003C row.length; nCol\u002B\u002B) {\r\n const identifier = row[nCol];\r\n if (identifier !== 0) {\r\n offsetBlocks.push([nCol, nRow, 0, identifier]);\r\n }\r\n }\r\n }\r\n return offsetBlocks;\r\n}\r\n\r\nfunction lodash(mask) {\r\n var offsetBlocks = [];\r\n offsetBlocks = _.flatMap(mask, (row, nRow) =\u003E {\r\n return _.map(row, (identifier, nCol) =\u003E {\r\n return identifier !== 0 ? [nCol, nRow, 0, identifier] : null;\r\n });\r\n }).filter((block) =\u003E !_.isNull(block));\r\n return offsetBlocks;\r\n}","TestCases":[{"Name":"Native loop","Code":"native(SRC);","IsDeferred":false},{"Name":"Lodash map","Code":"lodash(SRC);","IsDeferred":false}]}