Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1954x 1329x 1329x 1954x 63x 63x 562x 562x 1x 1x | /** * Logical check whether element is an object */ const isElementObject = (element) => (element && typeof element === 'object'); /** * Validate output and return newTempObject and boolean whether getAll should continue * for next element * @param {Object} tempObject - object/array of current iteration * @param {Boolean} isLastIteration - indicator whether it is the final iteration * @returns {Object} Object with shouldItContinue and newTempObject */ const validateOutput = (tempObject, isLastIteration) => { if (isElementObject(tempObject)) { return { shouldItContinue: true, newTempObject: tempObject }; } if (!isLastIteration) { return { shouldItContinue: false, newTempObject: undefined }; } return { shouldItContinue: false, newTempObject: tempObject }; }; module.exports = validateOutput; |